aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/ffmpeg_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-21 20:27:30 +0100
committerMax Kellermann <max@duempel.org>2008-11-21 20:27:30 +0100
commit976d5045c671700b1e16ed2b98e746a67fa91e8b (patch)
tree06acf6433adcaf822c212be15a099ff40c62eb04 /src/decoder/ffmpeg_plugin.c
parentbe9e60d55ef191b5b50a9d1eb2337a6b1199c8d4 (diff)
downloadmpd-976d5045c671700b1e16ed2b98e746a67fa91e8b.tar.gz
mpd-976d5045c671700b1e16ed2b98e746a67fa91e8b.tar.xz
mpd-976d5045c671700b1e16ed2b98e746a67fa91e8b.zip
decoder: check audio_format_valid() in all decoders
Refuse to play audio formats which are not supported by MPD.
Diffstat (limited to '')
-rw-r--r--src/decoder/ffmpeg_plugin.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 1d98f8051..f9e40e2f5 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -255,6 +255,13 @@ ffmpeg_decode_internal(struct ffmpeg_context *ctx)
audio_format.sample_rate = (unsigned int)codec_context->sample_rate;
audio_format.channels = codec_context->channels;
+ if (!audio_format_valid(&audio_format)) {
+ g_warning("Invalid audio format: %u:%u:%u\n",
+ audio_format.sample_rate, audio_format.bits,
+ audio_format.channels);
+ return false;
+ }
+
//there is some problem with this on some demux (mp3 at least)
if (format_context->duration != (int)AV_NOPTS_VALUE) {
total_time = format_context->duration / AV_TIME_BASE;