From 719990b1c5db93ccdc21e5f91e98ed9e8540ade1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 10 Nov 2009 19:01:38 +0100 Subject: decoder: use audio_format_init_checked() Let the audio_check library verify the audio format in all (relevant, i.e. non-hardcoded) plugins. --- src/decoder/mad_plugin.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/decoder/mad_plugin.c') 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 #include @@ -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); -- cgit v1.2.3