Ticket #51198: patch-libextractor-ffmpeg-3.0.diff

File patch-libextractor-ffmpeg-3.0.diff, 5.9 KB (added by dbevans (David B. Evans), 8 years ago)

Proposed patch allowing build with either ffmpeg 2.8 or 3.0+

  • Portfile

     
    55
    66name                libextractor
    77version             1.3
    8 revision            2
     8revision            3
    99categories          devel
    1010license             GPL-3+
    1111maintainers         ryandesign openmaintainer
     
    5353
    5454patchfiles          patch-configure.diff \
    5555                    patch-src-plugins-html_extractor.c.diff \
    56                     patch-src-plugins-jpeg_extractor.c.diff
     56                    patch-src-plugins-jpeg_extractor.c.diff \
     57                    patch-ffmpeg-3.0.diff
    5758
    5859configure.args      --enable-ffmpeg \
    5960                    --enable-glib \
  • files/patch-ffmpeg-3.0.diff

     
     1diff -ur src/plugins.orig/previewopus_extractor.c src/plugins/previewopus_extractor.c
     2--- src/plugins.orig/previewopus_extractor.c    2016-04-21 14:25:09.000000000 -0700
     3+++ src/plugins/previewopus_extractor.c 2016-04-21 14:26:39.000000000 -0700
     4@@ -296,7 +296,7 @@
     5 /** Initialize one audio frame for reading from the input file */
     6 static int init_input_frame(AVFrame **frame)
     7 {
     8-    if (!(*frame = avcodec_alloc_frame())) {
     9+    if (!(*frame = av_frame_alloc())) {
     10  #if DEBUG
     11         fprintf(stderr, "Could not allocate input frame\n");
     12 #endif
     13@@ -655,7 +655,7 @@
     14         av_freep(&converted_input_samples[0]);
     15         free(converted_input_samples);
     16     }
     17-    avcodec_free_frame(&input_frame);
     18+    av_frame_free(&input_frame);
     19 
     20     return ret;
     21 }
     22@@ -671,7 +671,7 @@
     23     int error;
     24 
     25     /** Create a new frame to store the audio samples. */
     26-    if (!(*frame = avcodec_alloc_frame())) {
     27+    if (!(*frame = av_frame_alloc())) {
     28         #if DEBUG
     29                fprintf(stderr, "Could not allocate output frame\n");
     30                #endif
     31@@ -702,7 +702,7 @@
     32         #if DEBUG
     33                fprintf(stderr, "Could allocate output frame samples (error '%s')\n", get_error_text(error));
     34                #endif
     35-        avcodec_free_frame(frame);
     36+        av_frame_free(frame);
     37         return error;
     38     }
     39 
     40@@ -783,17 +783,17 @@
     41         #if DEBUG
     42                fprintf(stderr, "Could not read data from FIFO\n");
     43                #endif
     44-        avcodec_free_frame(&output_frame);
     45+        av_frame_free(&output_frame);
     46         return AVERROR_EXIT;
     47     }
     48 
     49     /** Encode one frame worth of audio samples. */
     50     if (encode_audio_frame(output_frame, output_format_context,
     51                            output_codec_context, &data_written)) {
     52-        avcodec_free_frame(&output_frame);
     53+        av_frame_free(&output_frame);
     54         return AVERROR_EXIT;
     55     }
     56-    avcodec_free_frame(&output_frame);
     57+    av_frame_free(&output_frame);
     58     return 0;
     59 }
     60 /** Write the trailer of the output file container. */
     61@@ -907,7 +907,7 @@
     62       return;
     63     }
     64 
     65-  if (NULL == (frame = avcodec_alloc_frame ()))
     66+  if (NULL == (frame = av_frame_alloc ()))
     67     {
     68 #if DEBUG
     69       fprintf (stderr,
     70diff -ur src/plugins.orig/thumbnailffmpeg_extractor.c src/plugins/thumbnailffmpeg_extractor.c
     71--- src/plugins.orig/thumbnailffmpeg_extractor.c        2016-04-21 14:25:09.000000000 -0700
     72+++ src/plugins/thumbnailffmpeg_extractor.c     2016-04-21 14:25:19.000000000 -0700
     73@@ -153,7 +153,7 @@
     74 static size_t
     75 create_thumbnail (int src_width, int src_height,
     76                  int src_stride[],
     77-                 enum PixelFormat src_pixfmt,
     78+                 enum AVPixelFormat src_pixfmt,
     79                  const uint8_t * const src_data[],
     80                  int dst_width, int dst_height,
     81                  uint8_t **output_data,
     82@@ -189,7 +189,7 @@
     83   if (NULL ==
     84       (scaler_ctx =
     85        sws_getContext (src_width, src_height, src_pixfmt,
     86-                      dst_width, dst_height, PIX_FMT_RGB24,
     87+                      dst_width, dst_height, AV_PIX_FMT_RGB24,
     88                       SWS_BILINEAR, NULL, NULL, NULL)))
     89     {
     90 #if DEBUG
     91@@ -199,7 +199,7 @@
     92       return 0;
     93     }
     94 
     95-  if (NULL == (dst_frame = avcodec_alloc_frame ()))
     96+  if (NULL == (dst_frame = av_frame_alloc ()))
     97     {
     98 #if DEBUG
     99       fprintf (stderr,
     100@@ -209,7 +209,7 @@
     101       return 0;
     102     }
     103   if (NULL == (dst_buffer =
     104-              av_malloc (avpicture_get_size (PIX_FMT_RGB24, dst_width, dst_height))))
     105+              av_malloc (avpicture_get_size (AV_PIX_FMT_RGB24, dst_width, dst_height))))
     106     {
     107 #if DEBUG
     108       fprintf (stderr,
     109@@ -220,7 +220,7 @@
     110       return 0;
     111     }
     112   avpicture_fill ((AVPicture *) dst_frame, dst_buffer,
     113-                  PIX_FMT_RGB24, dst_width, dst_height);
     114+                  AV_PIX_FMT_RGB24, dst_width, dst_height);
     115   sws_scale (scaler_ctx,
     116              src_data,
     117              src_stride,
     118@@ -255,7 +255,7 @@
     119     }
     120   encoder_codec_ctx->width = dst_width;
     121   encoder_codec_ctx->height = dst_height;
     122-  encoder_codec_ctx->pix_fmt = PIX_FMT_RGB24;
     123+  encoder_codec_ctx->pix_fmt = AV_PIX_FMT_RGB24;
     124   opts = NULL;
     125   if (avcodec_open2 (encoder_codec_ctx, encoder_codec, &opts) < 0)
     126     {
     127@@ -283,7 +283,7 @@
     128   err = pkt.size;
     129   memcpy(encoder_output_buffer,pkt.data, pkt.size);
     130 
     131-  av_free_packet(&pkt);
     132+  av_packet_unref(&pkt);
     133                                                         
     134                                                         
     135 #else
     136@@ -410,7 +410,7 @@
     137       return;
     138     }
     139   av_dict_free (&opts);
     140-  if (NULL == (frame = avcodec_alloc_frame ()))
     141+  if (NULL == (frame = av_frame_alloc ()))
     142     {
     143 #if DEBUG
     144       fprintf (stderr,
     145@@ -563,7 +563,7 @@
     146       return;
     147     }
     148 
     149-  if (NULL == (frame = avcodec_alloc_frame ()))
     150+  if (NULL == (frame = av_frame_alloc ()))
     151     {
     152 #if DEBUG
     153       fprintf (stderr,
     154@@ -603,11 +603,11 @@
     155                                 &packet);
     156           if (frame_finished && frame->key_frame)
     157             {
     158-              av_free_packet (&packet);
     159+              av_packet_unref (&packet);
     160               break;
     161             }
     162         }
     163-      av_free_packet (&packet);
     164+      av_packet_unref (&packet);
     165     }
     166 
     167   if (! frame_finished)