diff options
author | Max Kellermann <max@duempel.org> | 2009-11-10 19:01:38 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-14 00:47:22 +0100 |
commit | 719990b1c5db93ccdc21e5f91e98ed9e8540ade1 (patch) | |
tree | ef03f58f54767b73c4c8d267e7b0008938863a17 /src/decoder/mad_plugin.c | |
parent | f47bb8c1db91b50be95c4d5dd301728e38c57274 (diff) | |
download | mpd-719990b1c5db93ccdc21e5f91e98ed9e8540ade1.tar.gz mpd-719990b1c5db93ccdc21e5f91e98ed9e8540ade1.tar.xz mpd-719990b1c5db93ccdc21e5f91e98ed9e8540ade1.zip |
decoder: use audio_format_init_checked()
Let the audio_check library verify the audio format in all (relevant,
i.e. non-hardcoded) plugins.
Diffstat (limited to 'src/decoder/mad_plugin.c')
-rw-r--r-- | src/decoder/mad_plugin.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/decoder/mad_plugin.c b/src/decoder/mad_plugin.c index d8231014f..da93fe45b 100644 --- a/src/decoder/mad_plugin.c +++ b/src/decoder/mad_plugin.c @@ -21,6 +21,7 @@ #include "decoder_api.h" #include "conf.h" #include "tag_id3.h" +#include "audio_check.h" #include <assert.h> #include <unistd.h> @@ -1174,6 +1175,7 @@ static void mp3_decode(struct decoder *decoder, struct input_stream *input_stream) { struct mp3_data data; + GError *error = NULL; struct tag *tag = NULL; struct replay_gain_info *replay_gain_info = NULL; struct audio_format audio_format; @@ -1185,8 +1187,20 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream) return; } - audio_format_init(&audio_format, data.frame.header.samplerate, 24, - MAD_NCHANNELS(&data.frame.header)); + if (!audio_format_init_checked(&audio_format, + data.frame.header.samplerate, 24, + MAD_NCHANNELS(&data.frame.header), + &error)) { + g_warning("%s", error->message); + g_error_free(error); + + if (tag != NULL) + tag_free(tag); + if (replay_gain_info != NULL) + replay_gain_info_free(replay_gain_info); + mp3_data_finish(&data); + return; + } decoder_initialized(decoder, &audio_format, data.input_stream->seekable, data.total_time); |