[PATCH] support FFmpeg-0.8 API

Dominik 'Rathann' Mierzejewski <[email protected]> Thu, 1 Sep 2011 03:10:55 +0200
Newsgroups gmane.comp.video.kino.devel
Message-ID <[email protected]>
--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi all,
I know kino is unmaintained, but nevertheless here's a patch if someone
would like to build kino against current FFmpeg 0.8 branch. I haven't
really tested it apart from compilation, but I hope it works.

Regards,
Dominik

-- 
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"

--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kino-ffmpeg.patch"

diff -up kino-1.3.4/src/frame.cc.ffmpeg kino-1.3.4/src/frame.cc
--- kino-1.3.4/src/frame.cc.ffmpeg	2009-09-08 06:34:42.000000000 +0200
+++ kino-1.3.4/src/frame.cc	2011-09-01 01:46:16.000000000 +0200
@@ -1063,7 +1063,15 @@ int Frame::ExtractRGB( void * rgb )
 	AVPicture dest;
 	int got_picture;
 
+#if FF_API_VIDEO_OLD
 	avcodec_decode_video( libavcodec, frame, &got_picture, data, GetFrameSize() );
+#else
+	AVPacket avpkt;
+	av_init_packet(&avpkt);
+	avpkt.data = data;
+	avpkt.size = GetFrameSize();
+	avcodec_decode_video2( libavcodec, frame, &got_picture, &avpkt);
+#endif
 	if ( got_picture )
 	{
 		avpicture_fill( &dest, static_cast<uint8_t*>( rgb ), PIX_FMT_RGB24, GetWidth(), GetHeight() );
@@ -1123,7 +1131,15 @@ int Frame::ExtractYUV( void *yuv )
 	AVPicture output;
 	int got_picture;
 
+#if FF_API_VIDEO_OLD
 	avcodec_decode_video( libavcodec, frame, &got_picture, data, GetFrameSize() );
+#else
+	AVPacket avpkt;
+	av_init_packet(&avpkt);
+	avpkt.data = data;
+	avpkt.size = GetFrameSize();
+	avcodec_decode_video2( libavcodec, frame, &got_picture, &avpkt);
+#endif
 	if ( got_picture )
 	{
 		avpicture_fill( &output, static_cast<uint8_t*>( yuv ), PIX_FMT_YUV422, GetWidth(), GetHeight() );
@@ -1156,7 +1172,15 @@ int Frame::ExtractYUV420( uint8_t *yuv, 
 	AVFrame *frame = avcodec_alloc_frame();
 	int got_picture;
 
+#if FF_API_VIDEO_OLD
 	avcodec_decode_video( libavcodec, frame, &got_picture, data, GetFrameSize() );
+#else
+	AVPacket avpkt;
+	av_init_packet(&avpkt);
+	avpkt.data = data;
+	avpkt.size = GetFrameSize();
+	avcodec_decode_video2( libavcodec, frame, &got_picture, &avpkt);
+#endif
 
 	int width = GetWidth(), height = GetHeight();
 
@@ -1319,12 +1343,24 @@ bool Frame::CreateEncoder( bool isPAL, b
 #if defined(HAVE_LIBAVCODEC)
 	if ( avformatEncoder == NULL )
 	{
+#if FF_API_ALLOC_FORMAT_CONTEXT
 		avformatEncoder = av_alloc_format_context();
+#else
+		avformatEncoder = avformat_alloc_context();
+#endif
 		if ( avformatEncoder )
 		{
+#if FF_API_GUESS_FORMAT
 			avformatEncoder->oformat = guess_format( "dv", NULL, NULL );
+#else
+			avformatEncoder->oformat = av_guess_format( "dv", NULL, NULL );
+#endif
 			AVStream* vst = av_new_stream( avformatEncoder, 0 );
+#if LIBAVCODEC_VERSION_MAJOR < 53
 			vst->codec->codec_type = CODEC_TYPE_VIDEO;
+#else
+			vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+#endif
 			vst->codec->codec_id = CODEC_ID_DVVIDEO;
 			vst->codec->bit_rate = 25000000;
 			vst->start_time = 0;

--huq684BweRXVnRxX
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
--huq684BweRXVnRxX
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Kino-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kino-dev

--huq684BweRXVnRxX--