Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile with ffmpeg >= 2.0 #36

Open
ifschleife opened this issue Sep 8, 2013 · 2 comments
Open

Can't compile with ffmpeg >= 2.0 #36

ifschleife opened this issue Sep 8, 2013 · 2 comments

Comments

@ifschleife
Copy link

When compiling on a current Archlinux install with ffmpeg 2.0.1 I get errors in LAV_Source.cpp because AVCODEC_MAX_AUDIO_FRAME_SIZE is not declared.

Googling for AVCODEC_MAX_AUDIO_FRAME_SIZE gets me this:
xbmc/xbmc#3006

So I guess the lastfm client is not compatible with the ffmpeg 2.0 release.

@ifschleife
Copy link
Author

Well, if anybody's interested:
I added const int AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000; to app/fingerprinter/LAV_Source.cpp.
This way I could successfully compile and run the scrobbler.

Found this here: http://www.mail-archive.com/[email protected]/msg141328.html

@woodsb02
Copy link

Note, to get it to compile with FFmpeg >= 3.0, the full patch needed is:

--- app/fingerprinter/LAV_Source.cpp.orig       2013-09-03 12:19:10 UTC
+++ app/fingerprinter/LAV_Source.cpp
@@ -23,6 +23,10 @@
 #define __STDC_CONSTANT_MACROS 1
 #endif

+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
+#endif
+
 extern "C" {
 #include <libavformat/avformat.h>
 #include <libavutil/mathematics.h>
@@ -113,7 +117,7 @@ uint8_t * LAV_SourcePrivate::decodeOneFr
 {
     char buf[256];
     AVPacket packet;
-    AVFrame *decodedFrame = avcodec_alloc_frame();
+    AVFrame *decodedFrame = av_frame_alloc();
     av_init_packet(&packet);

     int frameFinished = 0;
@@ -288,7 +292,7 @@ uint8_t * LAV_SourcePrivate::decodeOneFr
         av_free_packet(&packet);
     }
     timestamp += (double)nSamples / decodedFrame->sample_rate;
-    avcodec_free_frame(&decodedFrame);
+    av_frame_free(&decodedFrame);
     return outBuffer;
 }

@@ -405,7 +409,7 @@ void LAV_Source::getInfo(int& lengthSecs

 void LAV_Source::release()
 {
-    if ( d->inCodecContext && d->inCodecContext->codec_id != CODEC_ID_NONE )
+    if ( d->inCodecContext && d->inCodecContext->codec_id != AV_CODEC_ID_NONE )
     {
         avcodec_close(d->inCodecContext);
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants