[SCM] gmerlin-encoders/master: Fix FTBFS with ffmpeg-2.9

umlaeute at users.alioth.debian.org umlaeute at users.alioth.debian.org
Tue Nov 3 12:52:26 UTC 2015


The following commit has been merged in the master branch:
commit eba64fe1e8bff27a14501e634574433f2d2c2596
Author: IOhannes m zmölnig <zmoelnig at umlautQ.umlaeute.mur.at>
Date:   Tue Nov 3 12:44:01 2015 +0100

    Fix FTBFS with ffmpeg-2.9
    
    Closes: #803818
    Thanks: Andreas Cadhalpun

diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 0000000..93e68eb
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,342 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
+Last-Update: <2015-11-02>
+
+--- gmerlin-encoders-1.2.0.orig/plugins/ffmpeg/codecs.c
++++ gmerlin-encoders-1.2.0/plugins/ffmpeg/codecs.c
+@@ -119,7 +119,6 @@
+   },                                        \
+   PARAM_GOP_SIZE,                      \
+   PARAM_SCENE_CHANGE_THRESHOLD,       \
+-  PARAM_SCENECHANGE_FACTOR,        \
+   PARAM_FLAG_CLOSED_GOP         \
+ 
+ #define ENCODE_PARAM_VIDEO_FRAMETYPES_IPB \
+@@ -414,63 +413,63 @@ static const ffmpeg_codec_info_t video_c
+       .long_name  = TRS("Motion JPEG"),
+       .id         = AV_CODEC_ID_MJPEG,
+       .parameters = parameters_mjpeg,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "mpeg4",
+       .long_name  = TRS("MPEG-4"),
+       .id         = AV_CODEC_ID_MPEG4,
+       .parameters = parameters_mpeg4,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "msmpeg4v3",
+       .long_name  = TRS("Divx 3 compatible"),
+       .id         = AV_CODEC_ID_MSMPEG4V3,
+       .parameters = parameters_msmpeg4v3,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "mpeg1video",
+       .long_name  = TRS("MPEG-1 Video"),
+       .id         = AV_CODEC_ID_MPEG1VIDEO,
+       .parameters = parameters_mpeg1,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "mpeg2video",
+       .long_name  = TRS("MPEG-2 Video"),
+       .id         = AV_CODEC_ID_MPEG2VIDEO,
+       .parameters = parameters_mpeg1,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "flv1",
+       .long_name  = TRS("Flash 1"),
+       .id         = AV_CODEC_ID_FLV1,
+       .parameters = parameters_msmpeg4v3,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "wmv1",
+       .long_name  = TRS("WMV 1"),
+       .id         = AV_CODEC_ID_WMV1,
+       .parameters = parameters_msmpeg4v3,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "rv10",
+       .long_name  = TRS("Real Video 1"),
+       .id         = AV_CODEC_ID_RV10,
+       .parameters = parameters_msmpeg4v3,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+     {
+       .name       = "libx264",
+       .long_name  = TRS("H.264"),
+       .id         = AV_CODEC_ID_H264,
+       .parameters = parameters_libx264,
+-      .pixelformats = (enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NB },
++      .pixelformats = (enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NB },
+     },
+ #if 0
+     {
+@@ -972,7 +971,6 @@ bg_ffmpeg_set_codec_parameter(AVCodecCon
+   PARAM_INT("ff_me_penalty_compensation",me_penalty_compensation);
+   PARAM_INT("ff_bidir_refine",bidir_refine);
+   PARAM_INT("ff_brd_scale",brd_scale);
+-  PARAM_INT("ff_scenechange_factor",scenechange_factor);
+   PARAM_FLAG("ff_flag_qscale",CODEC_FLAG_QSCALE);
+   PARAM_FLAG("ff_flag_4mv",CODEC_FLAG_4MV);
+   PARAM_FLAG("ff_flag_qpel",CODEC_FLAG_QPEL);
+@@ -980,7 +978,6 @@ bg_ffmpeg_set_codec_parameter(AVCodecCon
+   PARAM_FLAG("ff_flag_mv0",CODEC_FLAG_MV0);
+   //  PARAM_FLAG("ff_flag_part",CODEC_FLAG_PART);
+   PARAM_FLAG("ff_flag_gray",CODEC_FLAG_GRAY);
+-  PARAM_FLAG("ff_flag_emu_edge",CODEC_FLAG_EMU_EDGE);
+   PARAM_FLAG("ff_flag_normalize_aqp",CODEC_FLAG_NORMALIZE_AQP);
+   //  PARAM_FLAG("ff_flag_alt_scan",CODEC_FLAG_ALT_SCAN);
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+@@ -1007,7 +1004,7 @@ bg_ffmpeg_set_codec_parameter(AVCodecCon
+   
+   }
+ 
+-enum PixelFormat * bg_ffmpeg_get_pixelformats(enum AVCodecID id)
++enum AVPixelFormat * bg_ffmpeg_get_pixelformats(enum AVCodecID id)
+   {
+   int i = 0;
+   while(video_codecs[i].name)
+--- gmerlin-encoders-1.2.0.orig/plugins/ffmpeg/ffmpeg_common.c
++++ gmerlin-encoders-1.2.0/plugins/ffmpeg/ffmpeg_common.c
+@@ -777,7 +777,7 @@ static int open_video_encoder(ffmpeg_pri
+   st->buffer_alloc = st->format.image_width * st->format.image_width * 4;
+   st->buffer = malloc(st->buffer_alloc);
+   
+-  st->frame = avcodec_alloc_frame();
++  st->frame = av_frame_alloc();
+   st->initialized = 1;
+   
+   return 1;
+@@ -888,26 +888,27 @@ static int flush_audio(ffmpeg_priv_t * p
+                        ffmpeg_audio_stream_t * st)
+   {
+   AVPacket pkt;
+-  AVFrame f;
++  AVFrame *f = av_frame_alloc();
+   int got_packet;
++  int ret = 0;
+   
+   av_init_packet(&pkt);
+ 
+   pkt.data = st->buffer;
+   pkt.size = st->buffer_alloc;
+   
+-  avcodec_get_frame_defaults(&f);
+-  f.nb_samples = st->frame->valid_samples;
++  av_frame_unref(f);
++  f->nb_samples = st->frame->valid_samples;
+ 
+-  f.pts = st->samples_written;
++  f->pts = st->samples_written;
+   
+-  avcodec_fill_audio_frame(&f, st->format.num_channels, st->stream->codec->sample_fmt,
++  avcodec_fill_audio_frame(f, st->format.num_channels, st->stream->codec->sample_fmt,
+                            st->frame->samples.u_8,
+                            st->stream->codec->frame_size * st->format.num_channels * 2, 1);
+     
+   if(avcodec_encode_audio2(st->stream->codec, &pkt,
+-                           &f, &got_packet) < 0)
+-    return 0;
++                           f, &got_packet) < 0)
++    goto end;
+   
+   if(got_packet && pkt.size)
+     {
+@@ -924,7 +925,7 @@ static int flush_audio(ffmpeg_priv_t * p
+       //    if(av_write_frame(priv->ctx, &pkt) != 0)
+       {
+       priv->got_error = 1;
+-      return 0;
++      goto end;
+       }
+     }
+   
+@@ -933,7 +934,10 @@ static int flush_audio(ffmpeg_priv_t * p
+   st->frame->valid_samples = 0;
+   st->samples_written += st->format.samples_per_frame;
+   
+-  return pkt.size;
++  ret = pkt.size;
++  end:
++  av_frame_free(&f);
++  return ret;
+   }
+ 
+ #else
+@@ -1238,7 +1242,7 @@ static void close_video_encoder(ffmpeg_p
+   //  st->stream->codec = NULL;
+   
+   if(st->frame)
+-    free(st->frame);
++    av_frame_free(&st->frame);
+   if(st->buffer)
+     free(st->buffer);
+ 
+@@ -1321,50 +1325,50 @@ const bg_encoder_framerate_t bg_ffmpeg_m
+ 
+ static const struct
+   {
+-  enum PixelFormat  ffmpeg_csp;
++  enum AVPixelFormat  ffmpeg_csp;
+   gavl_pixelformat_t gavl_csp;
+   }
+ pixelformats[] =
+   {
+-    { PIX_FMT_YUV420P,       GAVL_YUV_420_P },  ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
++    { AV_PIX_FMT_YUV420P,       GAVL_YUV_420_P },  ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+-    { PIX_FMT_YUV422,        GAVL_YUY2      },
++    { AV_PIX_FMT_YUV422,        GAVL_YUY2      },
+ #else
+-    { PIX_FMT_YUYV422,       GAVL_YUY2      },
++    { AV_PIX_FMT_YUYV422,       GAVL_YUY2      },
+ #endif
+-    { PIX_FMT_YUV422P,       GAVL_YUV_422_P },  ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
+-    { PIX_FMT_YUV444P,       GAVL_YUV_444_P }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
+-    { PIX_FMT_YUV411P,       GAVL_YUV_411_P }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
+-    { PIX_FMT_YUVJ420P,      GAVL_YUVJ_420_P }, ///< Planar YUV 4:2:0 full scale (jpeg)
+-    { PIX_FMT_YUVJ422P,      GAVL_YUVJ_422_P }, ///< Planar YUV 4:2:2 full scale (jpeg)
+-    { PIX_FMT_YUVJ444P,      GAVL_YUVJ_444_P }, ///< Planar YUV 4:4:4 full scale (jpeg)
++    { AV_PIX_FMT_YUV422P,       GAVL_YUV_422_P },  ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
++    { AV_PIX_FMT_YUV444P,       GAVL_YUV_444_P }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
++    { AV_PIX_FMT_YUV411P,       GAVL_YUV_411_P }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
++    { AV_PIX_FMT_YUVJ420P,      GAVL_YUVJ_420_P }, ///< Planar YUV 4:2:0 full scale (jpeg)
++    { AV_PIX_FMT_YUVJ422P,      GAVL_YUVJ_422_P }, ///< Planar YUV 4:2:2 full scale (jpeg)
++    { AV_PIX_FMT_YUVJ444P,      GAVL_YUVJ_444_P }, ///< Planar YUV 4:4:4 full scale (jpeg)
+ 
+ #if 0 // Not needed in the forseeable future    
+-    { PIX_FMT_RGB24,         GAVL_RGB_24    },  ///< Packed pixel, 3 bytes per pixel, RGBRGB...
+-    { PIX_FMT_BGR24,         GAVL_BGR_24    },  ///< Packed pixel, 3 bytes per pixel, BGRBGR...
++    { AV_PIX_FMT_RGB24,         GAVL_RGB_24    },  ///< Packed pixel, 3 bytes per pixel, RGBRGB...
++    { AV_PIX_FMT_BGR24,         GAVL_BGR_24    },  ///< Packed pixel, 3 bytes per pixel, BGRBGR...
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+-    { PIX_FMT_RGBA32,        GAVL_RGBA_32   },  ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
++    { AV_PIX_FMT_RGBA32,        GAVL_RGBA_32   },  ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
+ #else
+-    { PIX_FMT_RGB32,         GAVL_RGBA_32   },  ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
++    { AV_PIX_FMT_RGB32,         GAVL_RGBA_32   },  ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
+ #endif
+-    { PIX_FMT_YUV410P,       GAVL_YUV_410_P }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
+-    { PIX_FMT_RGB565,        GAVL_RGB_16 }, ///< always stored in cpu endianness
+-    { PIX_FMT_RGB555,        GAVL_RGB_15 }, ///< always stored in cpu endianness, most significant bit to 1
+-    { PIX_FMT_GRAY8,         GAVL_PIXELFORMAT_NONE },
+-    { PIX_FMT_MONOWHITE,     GAVL_PIXELFORMAT_NONE }, ///< 0 is white
+-    { PIX_FMT_MONOBLACK,     GAVL_PIXELFORMAT_NONE }, ///< 0 is black
+-    // { PIX_FMT_PAL8,          GAVL_RGB_24     }, ///< 8 bit with RGBA palette
+-    { PIX_FMT_XVMC_MPEG2_MC, GAVL_PIXELFORMAT_NONE }, ///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
+-    { PIX_FMT_XVMC_MPEG2_IDCT, GAVL_PIXELFORMAT_NONE },
++    { AV_PIX_FMT_YUV410P,       GAVL_YUV_410_P }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
++    { AV_PIX_FMT_RGB565,        GAVL_RGB_16 }, ///< always stored in cpu endianness
++    { AV_PIX_FMT_RGB555,        GAVL_RGB_15 }, ///< always stored in cpu endianness, most significant bit to 1
++    { AV_PIX_FMT_GRAY8,         GAVL_PIXELFORMAT_NONE },
++    { AV_PIX_FMT_MONOWHITE,     GAVL_PIXELFORMAT_NONE }, ///< 0 is white
++    { AV_PIX_FMT_MONOBLACK,     GAVL_PIXELFORMAT_NONE }, ///< 0 is black
++    // { AV_PIX_FMT_PAL8,          GAVL_RGB_24     }, ///< 8 bit with RGBA palette
++    { AV_PIX_FMT_XVMC_MPEG2_MC, GAVL_PIXELFORMAT_NONE }, ///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
++    { AV_PIX_FMT_XVMC_MPEG2_IDCT, GAVL_PIXELFORMAT_NONE },
+ #if LIBAVCODEC_BUILD >= ((51<<16)+(45<<8)+0)
+-    { PIX_FMT_YUVA420P,      GAVL_YUVA_32 },
++    { AV_PIX_FMT_YUVA420P,      GAVL_YUVA_32 },
+ #endif
+     
+ #endif // Not needed
+-    { PIX_FMT_NB, GAVL_PIXELFORMAT_NONE }
++    { AV_PIX_FMT_NB, GAVL_PIXELFORMAT_NONE }
+ };
+ 
+-gavl_pixelformat_t bg_pixelformat_ffmpeg_2_gavl(enum PixelFormat p)
++gavl_pixelformat_t bg_pixelformat_ffmpeg_2_gavl(enum AVPixelFormat p)
+   {
+   int i;
+   for(i = 0; i < sizeof(pixelformats)/sizeof(pixelformats[0]); i++)
+@@ -1375,7 +1379,7 @@ gavl_pixelformat_t bg_pixelformat_ffmpeg
+   return GAVL_PIXELFORMAT_NONE;
+   }
+ 
+-enum PixelFormat bg_pixelformat_gavl_2_ffmpeg(gavl_pixelformat_t p)
++enum AVPixelFormat bg_pixelformat_gavl_2_ffmpeg(gavl_pixelformat_t p)
+   {
+   int i;
+   for(i = 0; i < sizeof(pixelformats)/sizeof(pixelformats[0]); i++)
+@@ -1383,7 +1387,7 @@ enum PixelFormat bg_pixelformat_gavl_2_f
+     if(pixelformats[i].gavl_csp == p)
+       return pixelformats[i].ffmpeg_csp;
+     }
+-  return PIX_FMT_NONE;
++  return AV_PIX_FMT_NONE;
+   }
+ 
+ 
+--- gmerlin-encoders-1.2.0.orig/plugins/ffmpeg/ffmpeg_common.h
++++ gmerlin-encoders-1.2.0/plugins/ffmpeg/ffmpeg_common.h
+@@ -61,7 +61,7 @@ typedef struct
+   const bg_parameter_info_t * parameters;
+ 
+   /* Terminated with PIX_FMT_NB */
+-  enum PixelFormat * pixelformats;
++  enum AVPixelFormat * pixelformats;
+   
+   } ffmpeg_codec_info_t;
+ 
+@@ -237,7 +237,7 @@ void bg_ffmpeg_set_audio_parameter(void
+ void bg_ffmpeg_set_video_parameter(void * data, int stream, const char * name,
+                                   const bg_parameter_value_t * v);
+ 
+-enum PixelFormat * bg_ffmpeg_get_pixelformats(enum AVCodecID id);
++enum AVPixelFormat * bg_ffmpeg_get_pixelformats(enum AVCodecID id);
+ 
+ 
+ int bg_ffmpeg_set_video_pass(void * data, int stream, int pass,
+@@ -264,8 +264,8 @@ int bg_ffmpeg_write_subtitle_text(void *
+ 
+ int bg_ffmpeg_close(void * data, int do_delete);
+ 
+-gavl_pixelformat_t bg_pixelformat_ffmpeg_2_gavl(enum PixelFormat p);
+-enum PixelFormat bg_pixelformat_gavl_2_ffmpeg(gavl_pixelformat_t p);
++gavl_pixelformat_t bg_pixelformat_ffmpeg_2_gavl(enum AVPixelFormat p);
++enum AVPixelFormat bg_pixelformat_gavl_2_ffmpeg(gavl_pixelformat_t p);
+ 
+ gavl_sample_format_t bg_sample_format_ffmpeg_2_gavl(enum SampleFormat p);
+ 
+--- gmerlin-encoders-1.2.0.orig/plugins/ffmpeg/params.h
++++ gmerlin-encoders-1.2.0/plugins/ffmpeg/params.h
+@@ -146,7 +146,7 @@ TRS("X1"), TRS("Epzs"), TRS("Full"), (ch
+     .type =      BG_PARAMETER_SLIDER_INT,                                       \
+     .val_default = { .val_i = 0 },                                        \
+     .val_min =     { .val_i = 0 },                                        \
+-    .val_max =     { .val_i = FF_MAX_B_FRAMES },                          \
++    .val_max =     { .val_i = INT_MAX },                          \
+     .help_string = TRS("Maximum number of B-frames between non B-frames") \
+   }
+ 
+@@ -763,16 +763,6 @@ RC buffer size") \
+   }
+ 
+ 
+-/** Frame types */
+-#define PARAM_SCENECHANGE_FACTOR  \
+-  { \
+-    .name = "ff_scenechange_factor", \
+-    .long_name = TRS("Scenechange factor"),    \
+-    .type = BG_PARAMETER_INT,             \
+-    .val_default = { .val_i = 0 }, \
+-    .help_string = TRS("Multiplied by qscale for each frame and added to scene_change_score") \
+-  }
+-
+ /** Quantizer */
+ #define PARAM_QSCALE \
+   {                              \
diff --git a/debian/patches/series b/debian/patches/series
index 8237205..c5eefc3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ libav.patch
 fix_typos.patch
 plugins-ldflags.patch
 libav10.patch
+ffmpeg_2.9.patch

-- 
gmerlin-encoders packaging



More information about the pkg-multimedia-commits mailing list