Hi folks - this is essentially two 1-line patches. 

One adds the http protocol as an available input option to ffmpeg input
plugin.  The other adds the "audio/aacp" mime-type to ffmpeg output
plugin. 

I made these changes to fix an issue where streaming radio stations were
not being decoded properly by libfaad2.  When trying to decode an
internet radio station, I would get the following error in the log:

Dec 14 14:14 : player_thread: played
"http://wwdc-fm.akacast.akamaistream.net/7/634/20131/v1/auth.akacast.akamaistream.net/wwdc-fm";
Dec 14 14:14 : faad: error decoding AAC stream: Invalid number of channels

It would repeat those lines over the span of several seconds until
(presumably) it read a sequence of bytes that it understood and finally
connected.  The average wait time was about 5 seconds when it would
connect and it would fail to connect at all about 25% of the time.  This
was even after compiling with the most recent libfaad2 source.

ffmpeg is pretty much the de-facto all-in-one decoder, though, so I
wanted to use that instead.  I added the following to mpd.conf to
disable faad and mad (which was having issues with decoding 22050 mp3s):

decoder {
plugin "faad"
enabled "no"
}
decoder {
plugin "mad"
enabled "no"
}

When I did that, though, ffmpeg still wasn't being called to decode the
stream and now mpd wouldn't do anything with it.  I checked the mime-type:

curl --dump-header -
http://wwdc-fm.akacast.akamaistream.net/7/634/20131/v1/auth.akacast.akamaistream.net/wwdc-fm
| head -10 | grep Content

Content-Type: audio/aacp

and after recompiling mpd with the added ffmpeg mime-type, the radio
stream sprung to life.  ffmpeg starts decoding correctly immediately and
has not failed to decode a stream yet.  I'm using the most recent stable
ffmpeg 1.0.1 code.

Hope this patch can make it upstream.  :)

Thanks much
-Sven



The "http" change may be superfluous, but the
>From 3141b73617793e798dd5bea1707cb4572ea66fc3 Mon Sep 17 00:00:00 2001
From: Sven Carlberg <sven...@gmail.com>
Date: Fri, 21 Dec 2012 06:39:06 -0500
Subject: [PATCH 1/1] allow http protocol in ffmpeg input plugin

add audio/aacp as an available mime-type to the ffmpeg decoder
---
 .gitignore                          |    3 +++
 src/decoder/ffmpeg_decoder_plugin.c |    1 +
 src/input/ffmpeg_input_plugin.c     |    1 +
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 67b2610..b630452 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,3 +67,6 @@ test/run_ntp_server
 test/run_resolver
 test/run_tcp_connect
 test/test_pcm
+.cproject
+.project
+.settings
diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c
index 72a5ff3..c7ecfc4 100644
--- a/src/decoder/ffmpeg_decoder_plugin.c
+++ b/src/decoder/ffmpeg_decoder_plugin.c
@@ -711,6 +711,7 @@ static const char *const ffmpeg_mime_types[] = {
 	"audio/8svx",
 	"audio/16sv",
 	"audio/aac",
+	"audio/aacp",
 	"audio/ac3",
 	"audio/aiff"
 	"audio/amr",
diff --git a/src/input/ffmpeg_input_plugin.c b/src/input/ffmpeg_input_plugin.c
index 6d339a0..398c093 100644
--- a/src/input/ffmpeg_input_plugin.c
+++ b/src/input/ffmpeg_input_plugin.c
@@ -82,6 +82,7 @@ input_ffmpeg_open(const char *uri,
 	struct input_ffmpeg *i;
 
 	if (!g_str_has_prefix(uri, "gopher://";) &&
+	    !g_str_has_prefix(uri, "http://";) &&
 	    !g_str_has_prefix(uri, "rtp://") &&
 	    !g_str_has_prefix(uri, "rtsp://") &&
 	    !g_str_has_prefix(uri, "rtmp://") &&
-- 
1.6.3.3

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to