[PATCH] motion: port to FFmpeg-0.8 API

Dominik 'Rathann' Mierzejewski dominik at greysector.net
Sun Sep 4 00:06:39 CEST 2011


Attached.

-- 
Fedora http://fedoraproject.org/wiki/User:Rathann
RPMFusion http://rpmfusion.org | MPlayer http://mplayerhq.hu
"Faith manages."
        -- Delenn to Lennier in Babylon 5:"Confessions and Lamentations"
-------------- next part --------------
diff -up motion-3.3.0/ffmpeg.c.ffmpeg motion-3.3.0/ffmpeg.c
--- motion-3.3.0/ffmpeg.c.ffmpeg	2011-08-12 08:02:01.000000000 +0200
+++ motion-3.3.0/ffmpeg.c	2011-09-01 03:01:51.000000000 +0200
@@ -277,8 +277,12 @@ void ffmpeg_init()
 
     /* Register the append file protocol. */
 #if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8)
+#if FF_API_REGISTER_PROTOCOL
     av_register_protocol(&mpeg1_file_protocol);
 #else
+    av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol));
+#endif
+#else
     register_protocol(&mpeg1_file_protocol);
 #endif
 }
@@ -472,7 +476,11 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
 
     ffmpeg->c     = c = AVSTREAM_CODEC_PTR(ffmpeg->video_st);
     c->codec_id   = ffmpeg->oc->oformat->video_codec;
+#if LIBAVCODEC_VERSION_MAJOR < 53
     c->codec_type = CODEC_TYPE_VIDEO;
+#else
+    c->codec_type = AVMEDIA_TYPE_VIDEO;
+#endif
     is_mpeg1      = c->codec_id == CODEC_ID_MPEG1VIDEO;
 
     if (strcmp(ffmpeg_video_codec, "ffv1") == 0)
@@ -789,7 +797,11 @@ int ffmpeg_put_frame(struct ffmpeg *ffmp
     if (ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE) {
         /* Raw video case. The API will change slightly in the near future for that. */
 #ifdef FFMPEG_AVWRITEFRAME_NEWAPI
+#if LIBAVCODEC_VERSION_MAJOR < 53
         pkt.flags |= PKT_FLAG_KEY;
+#else
+        pkt.flags |= AV_PKT_FLAG_KEY;
+#endif
         pkt.data = (uint8_t *)pic;
         pkt.size = sizeof(AVPicture);
         ret = av_write_frame(ffmpeg->oc, &pkt);
@@ -813,7 +825,11 @@ int ffmpeg_put_frame(struct ffmpeg *ffmp
             pkt.pts = AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->pts;
 
             if (AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->key_frame)
+#if LIBAVCODEC_VERSION_MAJOR < 53
                 pkt.flags |= PKT_FLAG_KEY;
+#else
+                pkt.flags |= AV_PKT_FLAG_KEY;
+#endif
 
 
             pkt.data = ffmpeg->video_outbuf;


More information about the rpmfusion-developers mailing list