Bug#638564: Needs to be adapted for libav/0.7.1

Colin Watson cjwatson at ubuntu.com
Tue Aug 30 00:08:12 UTC 2011


tags 638564 patch
user ubuntu-devel at lists.ubuntu.com
usertags ubuntu-patch oneiric
thanks

On Fri, Aug 19, 2011 at 09:40:11PM +0200, Moritz Muehlenhoff wrote:
> Your package currently fails to build from source when built against
> libav/0.7.1 and needs to be adapted.

Here's a patch.  There are still a few deprecations left, but this
builds against 0.7.1 so it should be a decent start.

  * Port to libav 0.7 API (closes: #638564).

diff -Nru gmerlin-avdecoder-1.1.0~dfsg/debian/patches/libav_0.7.patch gmerlin-avdecoder-1.1.0~dfsg/debian/patches/libav_0.7.patch
--- gmerlin-avdecoder-1.1.0~dfsg/debian/patches/libav_0.7.patch	1970-01-01 01:00:00.000000000 +0100
+++ gmerlin-avdecoder-1.1.0~dfsg/debian/patches/libav_0.7.patch	2011-08-30 00:59:18.000000000 +0100
@@ -0,0 +1,196 @@
+Index: b/lib/demux_ffmpeg.c
+===================================================================
+--- a/lib/demux_ffmpeg.c
++++ b/lib/demux_ffmpeg.c
+@@ -29,6 +29,29 @@
+ 
+ #define PROBE_SIZE 2048 /* Same as in MPlayer */
+ 
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 30, 2)
++#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
++#endif
++
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
++#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
++#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
++#define AVMEDIA_TYPE_SUBTITLE CODEC_TYPE_SUBTITLE
++#endif
++
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 102, 0)
++#define AVIOContext ByteIOContext
++#endif
++
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 105, 0)
++#define avio_open url_fopen
++#endif
++
++#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 5, 0)
++#define AVDictionaryEntry AVMetadataTag
++#define av_dict_get av_metadata_get
++#endif
++
+ static void cleanup_stream_ffmpeg(bgav_stream_t * s)
+   {
+   if(s->type == BGAV_STREAM_VIDEO)
+@@ -45,7 +68,7 @@
+ #if LIBAVFORMAT_VERSION_INT < ((52<<16)+(0<<8)+0)
+   ByteIOContext pb;
+ #else
+-  ByteIOContext * pb;
++  AVIOContext * pb;
+ #endif
+   } ffmpeg_priv_t;
+ 
+@@ -572,9 +595,16 @@
+   int i;
+   ffmpeg_priv_t * priv;
+   AVFormatContext *avfc;
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 2, 0)
+   AVFormatParameters ap;
++#endif
+   char * tmp_filename;
++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0)
++  AVDictionaryEntry *entry;
++#endif
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 2, 0)
+   memset(&ap, 0, sizeof(ap));
++#endif
+   priv = calloc(1, sizeof(*priv));
+   ctx->priv = priv;
+ 
+@@ -582,8 +612,10 @@
+      called multiple times */
+ #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 29, 0)
+   register_protocol(&bgav_protocol);
+-#else
++#elif LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 69, 0)
+   av_register_protocol(&bgav_protocol);
++#else
++  av_register_protocol2(&bgav_protocol, sizeof(bgav_protocol));
+ #endif
+   
+ #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 26, 0)
+@@ -594,7 +626,7 @@
+   
+   tmp_filename = bgav_sprintf("bgav:%s", ctx->input->filename);
+ 
+-  url_fopen(&priv->pb, tmp_filename, URL_RDONLY);
++  avio_open(&priv->pb, tmp_filename, URL_RDONLY);
+ #if LIBAVFORMAT_VERSION_INT < ((52<<16)+(0<<8)+0)
+   ((URLContext*)(priv->pb.opaque))->priv_data= ctx->input;
+ #else
+@@ -604,8 +636,11 @@
+   
+ #if LIBAVFORMAT_VERSION_INT < ((52<<16)+(0<<8)+0)
+   if(av_open_input_stream(&avfc, &priv->pb, tmp_filename, priv->avif, &ap)<0)
+-#else
++#elif LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 2, 0)
+   if(av_open_input_stream(&avfc, priv->pb, tmp_filename, priv->avif, &ap)<0)
++#else
++  avfc->pb = priv->pb;
++  if(avformat_open_input(&avfc, tmp_filename, priv->avif, NULL)<0)
+ #endif
+     {
+     bgav_log(ctx->opt,BGAV_LOG_ERROR,LOG_DOMAIN,
+@@ -629,13 +664,13 @@
+     {
+     switch(avfc->streams[i]->codec->codec_type)
+       {
+-      case CODEC_TYPE_AUDIO:
++      case AVMEDIA_TYPE_AUDIO:
+         init_audio_stream(ctx, avfc->streams[i], i);
+         break;
+-      case CODEC_TYPE_VIDEO:
++      case AVMEDIA_TYPE_VIDEO:
+         init_video_stream(ctx, avfc->streams[i], i);
+         break;
+-      case CODEC_TYPE_SUBTITLE:
++      case AVMEDIA_TYPE_SUBTITLE:
+         break;
+       default:
+         break;
+@@ -654,6 +689,7 @@
+                                          priv->avfc->iformat->long_name);
+ 
+   /* Metadata */
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 31, 0)
+   if(avfc->title[0])
+     ctx->tt->cur->metadata.title = bgav_strdup(avfc->title);
+   if(avfc->author[0])
+@@ -664,6 +700,27 @@
+     ctx->tt->cur->metadata.album = bgav_strdup(avfc->album);
+   if(avfc->genre[0])
+     ctx->tt->cur->metadata.genre = bgav_strdup(avfc->genre);
++#else
++  entry = av_dict_get(avfc->metadata, "title", NULL, 0);
++  if (entry->value[0])
++    ctx->tt->cur->metadata.title = bgav_strdup(entry->value);
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 50, 0)
++  entry = av_dict_get(avfc->metadata, "author", NULL, 0);
++#else
++  entry = av_dict_get(avfc->metadata, "artist", NULL, 0);
++#endif
++  if (entry->value[0])
++    ctx->tt->cur->metadata.author = bgav_strdup(entry->value);
++  entry = av_dict_get(avfc->metadata, "copyright", NULL, 0);
++  if (entry->value[0])
++    ctx->tt->cur->metadata.copyright = bgav_strdup(entry->value);
++  entry = av_dict_get(avfc->metadata, "album", NULL, 0);
++  if (entry->value[0])
++    ctx->tt->cur->metadata.album = bgav_strdup(entry->value);
++  entry = av_dict_get(avfc->metadata, "genre", NULL, 0);
++  if (entry->value[0])
++    ctx->tt->cur->metadata.genre = bgav_strdup(entry->value);
++#endif
+   
+   return 1;
+   }
+@@ -739,7 +796,7 @@
+     s->data.video.palette_changed = 1;
+     }
+   
+-  if(pkt.flags&PKT_FLAG_KEY)
++  if(pkt.flags&AV_PKT_FLAG_KEY)
+     PACKET_SET_KEYFRAME(p);
+   bgav_stream_done_packet_write(s, p);
+   
+Index: b/lib/video_ffmpeg.c
+===================================================================
+--- a/lib/video_ffmpeg.c
++++ b/lib/video_ffmpeg.c
+@@ -64,6 +64,15 @@
+ 
+ #define HAS_DELAY      (1<<0)
+ 
++#if LIBPOSTPROC_VERSION_MAJOR < 52
++#define pp_context pp_context_t
++#define pp_mode pp_mode_t
++#endif
++
++#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
++#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
++#endif
++
+ static int get_format_jpeg(bgav_stream_t*, bgav_packet_t * p);
+ static int get_format_dv(bgav_stream_t*, bgav_packet_t * p);
+ 
+@@ -116,8 +125,8 @@
+ 
+ #ifdef HAVE_LIBPOSTPROC
+   int do_pp;
+-  pp_context_t *pp_context;
+-  pp_mode_t    *pp_mode;
++  pp_context *pp_context;
++  pp_mode    *pp_mode;
+ #endif
+ 
+ #ifdef HAVE_LIBSWSCALE
+@@ -836,7 +845,7 @@
+   if(s->action == BGAV_STREAM_PARSE)
+     return 1;
+   
+-  priv->ctx->codec_type = CODEC_TYPE_VIDEO;
++  priv->ctx->codec_type = AVMEDIA_TYPE_VIDEO;
+   
+   priv->ctx->bit_rate = 0;
+ 
diff -Nru gmerlin-avdecoder-1.1.0~dfsg/debian/patches/series gmerlin-avdecoder-1.1.0~dfsg/debian/patches/series
--- gmerlin-avdecoder-1.1.0~dfsg/debian/patches/series	2011-01-12 20:06:26.000000000 +0000
+++ gmerlin-avdecoder-1.1.0~dfsg/debian/patches/series	2011-08-30 00:11:57.000000000 +0100
@@ -2,3 +2,4 @@
 autoconf_removed_sources.patch
 system_gsm.patch
 fix_typos.patch
+libav_0.7.patch

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]





More information about the pkg-multimedia-maintainers mailing list