Ticket #51197: patch-goldendict-ffmpeg-3.0.diff

File patch-goldendict-ffmpeg-3.0.diff, 2.1 KB (added by dbevans (David B. Evans), 9 years ago)

Proposed patch allowing build with either ffmpeg 2.8 or 3.0+

  • Portfile

     
    66PortGroup           qmake 1.0
    77
    88github.setup        goldendict goldendict 1.5.0-RC
    9 revision            2
     9revision            3
    1010# FIXME: add proper categories
    1111categories          office
    1212platforms           darwin
     
    4040                    port:phonon \
    4141                    port:zlib
    4242
    43 patchfiles          patch-goldendict.pro.diff
     43patchfiles          patch-goldendict.pro.diff \
     44                    patch-ffmpeg-3.0.diff
    4445
    4546post-patch {
    4647    reinplace "s|@VERSION@|${version}|g" ${worksrcpath}/goldendict.pro
  • files/patch-ffmpeg-3.0.diff

     
     1--- ffmpegaudio.cc.orig 2013-06-06 06:39:06.000000000 -0700
     2+++ ffmpegaudio.cc      2016-04-21 12:06:50.000000000 -0700
     3@@ -326,7 +326,11 @@
     4 
     5 bool DecoderContext::play( QString & errorString )
     6 {
     7+#if LIBAVCODEC_VERSION_MAJOR < 55 || ( LIBAVCODEC_VERSION_MAJOR == 55 && LIBAVCODEC_VERSION_MINOR < 28 )
     8   AVFrame * frame = avcodec_alloc_frame();
     9+#else
     10+  AVFrame * frame = av_frame_alloc();
     11+#endif
     12   if ( !frame )
     13   {
     14     errorString = QObject::tr( "avcodec_alloc_frame() failed." );
     15@@ -348,7 +352,11 @@
     16       }
     17     }
     18     // av_free_packet() must be called after each call to av_read_frame()
     19+#if LIBAVCODEC_VERSION_MAJOR < 57 || ( LIBAVCODEC_VERSION_MAJOR == 57 && LIBAVCODEC_VERSION_MINOR < 7 )
     20     av_free_packet( &packet );
     21+#else
     22+    av_packet_unref( &packet );
     23+#endif
     24   }
     25 
     26   if ( !isCancelled_ && codecContext_->codec->capabilities & CODEC_CAP_DELAY )
     27@@ -365,8 +373,10 @@
     28 
     29 #if LIBAVCODEC_VERSION_MAJOR < 54
     30   av_free( frame );
     31-#else
     32+#elif LIBAVCODEC_VERSION_MAJOR < 55 || ( LIBAVCODEC_VERSION_MAJOR == 55 && LIBAVCODEC_VERSION_MINOR < 28 )
     33   avcodec_free_frame( &frame );
     34+#else
     35+  av_frame_free( &frame );
     36 #endif
     37 
     38   return true;