aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/_flac_common.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 19:01:38 +0100
committerMax Kellermann <max@duempel.org>2009-11-14 00:47:22 +0100
commit719990b1c5db93ccdc21e5f91e98ed9e8540ade1 (patch)
treeef03f58f54767b73c4c8d267e7b0008938863a17 /src/decoder/_flac_common.c
parentf47bb8c1db91b50be95c4d5dd301728e38c57274 (diff)
downloadmpd-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/_flac_common.c')
-rw-r--r--src/decoder/_flac_common.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index 77483efcb..213516524 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -25,6 +25,7 @@
#include "_flac_common.h"
#include "flac_metadata.h"
#include "flac_pcm.h"
+#include "audio_check.h"
#include <glib.h>
@@ -63,20 +64,19 @@ bool
flac_data_get_audio_format(struct flac_data *data,
struct audio_format *audio_format)
{
+ GError *error = NULL;
+
if (!data->have_stream_info) {
g_warning("no STREAMINFO packet found");
return false;
}
- audio_format_init(audio_format, data->stream_info.sample_rate,
- data->stream_info.bits_per_sample,
- data->stream_info.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);
+ if (!audio_format_init_checked(audio_format,
+ data->stream_info.sample_rate,
+ data->stream_info.bits_per_sample,
+ data->stream_info.channels, &error)) {
+ g_warning("%s", error->message);
+ g_error_free(error);
return false;
}