aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-11-04 20:04:15 +0100
committerMax Kellermann <max@duempel.org>2010-11-04 20:04:15 +0100
commit3f89f77429b0501aa50148dde7e7faefeea4d178 (patch)
treead4b4e133cbd5c4382d1911fe7fa5d5c4025ce57 /src/decoder
parent9dee419b7ca92fbd0d376e0cf6d55903150d0e3b (diff)
downloadmpd-3f89f77429b0501aa50148dde7e7faefeea4d178.tar.gz
mpd-3f89f77429b0501aa50148dde7e7faefeea4d178.tar.xz
mpd-3f89f77429b0501aa50148dde7e7faefeea4d178.zip
decoder/ffmpeg: check AVCodecContext.sample_fmt value
.. instead of av_get_bits_per_sample_format(). The SampleFormat enum value is authoritative.
Diffstat (limited to '')
-rw-r--r--src/decoder/ffmpeg_decoder_plugin.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c
index d47356581..ea5b97d08 100644
--- a/src/decoder/ffmpeg_decoder_plugin.c
+++ b/src/decoder/ffmpeg_decoder_plugin.c
@@ -231,16 +231,18 @@ static enum sample_format
ffmpeg_sample_format(G_GNUC_UNUSED const AVCodecContext *codec_context)
{
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(41<<8)+0)
- int bits = (uint8_t) av_get_bits_per_sample_format(codec_context->sample_fmt);
+ switch (codec_context->sample_fmt) {
+ case SAMPLE_FMT_S16:
+ return SAMPLE_FORMAT_S16;
- /* XXX implement & test other sample formats */
+ case SAMPLE_FMT_S32:
+ return SAMPLE_FORMAT_S32;
- switch (bits) {
- case 16:
- return SAMPLE_FORMAT_S16;
+ default:
+ g_warning("Unsupported libavcodec SampleFormat value: %d",
+ codec_context->sample_fmt);
+ return SAMPLE_FORMAT_UNDEFINED;
}
-
- return SAMPLE_FORMAT_UNDEFINED;
#else
/* XXX fixme 16-bit for older ffmpeg (13 Aug 2007) */
return SAMPLE_FORMAT_S16;