[PATCH] xmms2-freeworld: port to FFmpeg-0.8 API

Dominik 'Rathann' Mierzejewski dominik at greysector.net
Sun Sep 4 00:17:40 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 xmms2-0.7DrNo/src/plugins/avcodec/avcodec.c.ffmpeg xmms2-0.7DrNo/src/plugins/avcodec/avcodec.c
--- xmms2-0.7DrNo/src/plugins/avcodec/avcodec.c.ffmpeg	2010-02-19 18:43:54.000000000 +0100
+++ xmms2-0.7DrNo/src/plugins/avcodec/avcodec.c	2011-08-27 18:04:03.000000000 +0200
@@ -160,7 +164,11 @@ xmms_avcodec_init (xmms_xform_t *xform)
 		goto err;
 	}
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
 	if (codec->type != CODEC_TYPE_AUDIO) {
+#else
+	if (codec->type != AVMEDIA_TYPE_AUDIO) {
+#endif
 		XMMS_DBG ("Codec '%s' found but its type is not audio", data->codec_id);
 		goto err;
 	}
@@ -332,9 +340,18 @@ xmms_avcodec_read (xmms_xform_t *xform, 
 		}
 
 		outbufsize = sizeof (outbuf);
+#if FF_API_AUDIO_OLD
 		bytes_read = avcodec_decode_audio2 (data->codecctx, (short *) outbuf,
 		                                    &outbufsize, data->buffer_pos,
 		                                    data->buffer_length);
+#else
+		AVPacket avpkt;
+		av_init_packet(&avpkt);
+		avpkt.data = (uint8_t *) data->buffer_pos;
+		avpkt.size = data->buffer_length;
+		bytes_read = avcodec_decode_audio3 (data->codecctx, outbuf,
+		                                    &outbufsize, &avpkt);
+#endif
 
 		if (bytes_read < 0 || bytes_read > data->buffer_length) {
 			XMMS_DBG ("Error decoding data!");


More information about the rpmfusion-developers mailing list