diff options
Diffstat (limited to '')
-rw-r--r-- | src/decoder/audiofile_plugin.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/decoder/audiofile_plugin.c b/src/decoder/audiofile_plugin.c index ca096c06e..058f87813 100644 --- a/src/decoder/audiofile_plugin.c +++ b/src/decoder/audiofile_plugin.c @@ -19,6 +19,7 @@ #include "config.h" #include "decoder_api.h" +#include "audio_check.h" #include <audiofile.h> #include <af_vfs.h> @@ -103,6 +104,7 @@ setup_virtual_fops(struct input_stream *stream) static void audiofile_stream_decode(struct decoder *decoder, struct input_stream *is) { + GError *error = NULL; AFvirtualfile *vf; int fs, frame_count; AFfilehandle af_fp; @@ -138,13 +140,13 @@ audiofile_stream_decode(struct decoder *decoder, struct input_stream *is) AF_SAMPFMT_TWOSCOMP, bits); afGetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits); - audio_format_init(&audio_format, afGetRate(af_fp, AF_DEFAULT_TRACK), - bits, afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK)); - - 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); + if (!audio_format_init_checked(&audio_format, + afGetRate(af_fp, AF_DEFAULT_TRACK), + bits, + afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK), + &error)) { + g_warning("%s", error->message); + g_error_free(error); afCloseFile(af_fp); return; } |