Package: pianobar
Version: 2014.09.28-1
Severity: important
Tags: patch
User: pkg-multimedia-maintain...@lists.alioth.debian.org
Usertags: ffmpeg2.9

Dear Maintainer,

your package fails to build with the upcoming ffmpeg 2.9.
This bug will become release-critical at some point when the
ffmpeg2.9 transition gets closer.

Attached is a patch replacing the deprecated functionality.
It also works with ffmpeg 2.8.
Please apply this patch and forward it upstream, if necessary.

These changes are non-trivial and should be runtime-tested.

Best regards,
Andreas

diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 0000000..fabda4f
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,67 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2015-11-02>
+
+--- pianobar-2014.09.28.orig/src/player.c
++++ pianobar-2014.09.28/src/player.c
+@@ -77,7 +77,6 @@ void BarPlayerInit () {
+ 
+ void BarPlayerDestroy () {
+ 	avformat_network_deinit ();
+-	avfilter_uninit ();
+ 	ao_shutdown ();
+ }
+ 
+@@ -299,9 +298,9 @@ static int play (player_t * const player
+ 	pkt.size = 0;
+ 
+ 	AVFrame *frame = NULL, *filteredFrame = NULL;
+-	frame = avcodec_alloc_frame ();
++	frame = av_frame_alloc ();
+ 	assert (frame != NULL);
+-	filteredFrame = avcodec_alloc_frame ();
++	filteredFrame = av_frame_alloc ();
+ 	assert (filteredFrame != NULL);
+ 
+ 	while (!player->doQuit) {
+@@ -347,28 +346,16 @@ static int play (player_t * const player
+ 				assert (ret >= 0);
+ 
+ 				while (true) {
+-					AVFilterBufferRef *audioref = NULL;
+-#ifdef HAVE_AV_BUFFERSINK_GET_BUFFER_REF
+-					/* ffmpeg’s compatibility layer is broken in some releases */
+-					if (av_buffersink_get_buffer_ref (player->fbufsink,
+-							&audioref, 0) < 0) {
+-#else
+-					if (av_buffersink_read (player->fbufsink, &audioref) < 0) {
+-#endif
++					if (av_buffersink_get_frame(player->fbufsink, filteredFrame) < 0) {
+ 						/* try again next frame */
+ 						break;
+ 					}
+ 
+-					ret = avfilter_copy_buf_props (filteredFrame, audioref);
+-					assert (ret >= 0);
+-
+ 					const int numChannels = av_get_channel_layout_nb_channels (
+ 							filteredFrame->channel_layout);
+ 					const int bps = av_get_bytes_per_sample(filteredFrame->format);
+ 					ao_play (player->aoDev, (char *) filteredFrame->data[0],
+ 							filteredFrame->nb_samples * numChannels * bps);
+-
+-					avfilter_unref_bufferp (&audioref);
+ 				}
+ 			}
+ 
+@@ -382,8 +369,8 @@ static int play (player_t * const player
+ 		player->lastTimestamp = pkt.pts;
+ 	}
+ 
+-	avcodec_free_frame (&filteredFrame);
+-	avcodec_free_frame (&frame);
++	av_frame_free (&filteredFrame);
++	av_frame_free (&frame);
+ 
+ 	return 0;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index e69de29..f762d21 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -0,0 +1 @@
+ffmpeg_2.9.patch

Reply via email to