aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio_parser.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 19:00:41 +0100
committerMax Kellermann <max@duempel.org>2009-11-14 00:47:19 +0100
commitf47bb8c1db91b50be95c4d5dd301728e38c57274 (patch)
treebdac25b566c030979eadc459caac8ff918026045 /src/audio_parser.c
parent873025a495795c88880114f73b4fbba000670877 (diff)
downloadmpd-f47bb8c1db91b50be95c4d5dd301728e38c57274.tar.gz
mpd-f47bb8c1db91b50be95c4d5dd301728e38c57274.tar.xz
mpd-f47bb8c1db91b50be95c4d5dd301728e38c57274.zip
audio_check: checker functions for audio_format attributes
These functions are a wrapper for audio_valid_X(). On error, they return a GError object.
Diffstat (limited to 'src/audio_parser.c')
-rw-r--r--src/audio_parser.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/audio_parser.c b/src/audio_parser.c
index 5795c35dd..df87be325 100644
--- a/src/audio_parser.c
+++ b/src/audio_parser.c
@@ -25,6 +25,7 @@
#include "config.h"
#include "audio_parser.h"
#include "audio_format.h"
+#include "audio_check.h"
#include <stdlib.h>
@@ -55,11 +56,8 @@ parse_sample_rate(const char *src, bool mask, uint32_t *sample_rate_r,
g_set_error(error_r, audio_parser_quark(), 0,
"Failed to parse the sample rate");
return false;
- } else if (!audio_valid_sample_rate(value)) {
- g_set_error(error_r, audio_parser_quark(), 0,
- "Invalid sample rate: %lu", value);
+ } else if (!audio_check_sample_rate(value, error_r))
return false;
- }
*sample_rate_r = value;
*endptr_r = endptr;
@@ -84,11 +82,8 @@ parse_sample_format(const char *src, bool mask, uint8_t *bits_r,
g_set_error(error_r, audio_parser_quark(), 0,
"Failed to parse the sample format");
return false;
- } else if (!audio_valid_sample_format(value)) {
- g_set_error(error_r, audio_parser_quark(), 0,
- "Invalid sample format: %lu", value);
+ } else if (!audio_check_sample_format(value, error_r))
return false;
- }
*bits_r = value;
*endptr_r = endptr;
@@ -113,11 +108,8 @@ parse_channel_count(const char *src, bool mask, uint8_t *channels_r,
g_set_error(error_r, audio_parser_quark(), 0,
"Failed to parse the channel count");
return false;
- } else if (!audio_valid_channel_count(value)) {
- g_set_error(error_r, audio_parser_quark(), 0,
- "Invalid channel count: %lu", value);
+ } else if (!audio_check_channel_count(value, error_r))
return false;
- }
*channels_r = value;
*endptr_r = endptr;