[PATCH] kino: port to FFmpeg-0.8 API
Dominik 'Rathann' Mierzejewski
dominik at greysector.net
Sun Sep 4 00:04:59 CEST 2011
Apart from this patch, kino needs to be ported to v4l2 API as well,
as the v4l1 API is already gone from F16+ kernels. One can make it
build (as I did) by using the backwards-compatibility header from
libv4l (libv4l1-videodev.h), but haven't tested if the built binary
actually works.
--
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 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;
More information about the rpmfusion-developers
mailing list