aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mpg123_decoder_plugin.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/mpg123_decoder_plugin.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 '')
-rw-r--r--src/decoder/mpg123_decoder_plugin.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/decoder/mpg123_decoder_plugin.c b/src/decoder/mpg123_decoder_plugin.c
index 20d9c4a54..922e56484 100644
--- a/src/decoder/mpg123_decoder_plugin.c
+++ b/src/decoder/mpg123_decoder_plugin.c
@@ -19,6 +19,7 @@
#include "config.h" /* must be first for large file support */
#include "decoder_api.h"
+#include "audio_check.h"
#include <glib.h>
@@ -54,6 +55,7 @@ static bool
mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
struct audio_format *audio_format)
{
+ GError *gerror = NULL;
char *path_dup;
int error;
int channels, encoding;
@@ -85,9 +87,10 @@ mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
return false;
}
- audio_format_init(audio_format, rate, 16, channels);
- if (!audio_format_valid(audio_format)) {
- g_warning("invalid audio format");
+ if (!audio_format_init_checked(audio_format, rate, 16,
+ channels, &gerror)) {
+ g_warning("%s", gerror->message);
+ g_error_free(gerror);
return false;
}