diff options
Diffstat (limited to 'src/audio_parser.c')
-rw-r--r-- | src/audio_parser.c | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/src/audio_parser.c b/src/audio_parser.c index c37effff..99a448cd 100644 --- a/src/audio_parser.c +++ b/src/audio_parser.c @@ -32,6 +32,8 @@ #include <string.h> #include <stdlib.h> +#include <libavutil/samplefmt.h> + /** * The GLib quark used for errors reported by this library. */ @@ -67,23 +69,22 @@ parse_sample_rate(const char *src, bool mask, uint32_t *sample_rate_r, return true; } -static bool -parse_sample_format(const char *src, bool mask, - enum sample_format *sample_format_r, - const char **endptr_r, GError **error_r) +static bool parse_sample_format(const char *src, bool mask, + enum AVSampleFormat *sample_format_r, + const char **endptr_r, GError **error_r) { unsigned long value; char *endptr; - enum sample_format sample_format; + enum AVSampleFormat sample_format; if (mask && *src == '*') { - *sample_format_r = SAMPLE_FORMAT_UNDEFINED; + *sample_format_r = AV_SAMPLE_FMT_NONE; *endptr_r = src + 1; return true; } if (*src == 'f') { - *sample_format_r = SAMPLE_FORMAT_FLOAT; + *sample_format_r = AV_SAMPLE_FMT_FLT; *endptr_r = src + 1; return true; } @@ -97,23 +98,15 @@ parse_sample_format(const char *src, bool mask, switch (value) { case 8: - sample_format = SAMPLE_FORMAT_S8; + sample_format = AV_SAMPLE_FMT_U8; break; case 16: - sample_format = SAMPLE_FORMAT_S16; - break; - - case 24: - if (memcmp(endptr, "_3", 2) == 0) - /* for backwards compatibility */ - endptr += 2; - - sample_format = SAMPLE_FORMAT_S24_P32; + sample_format = AV_SAMPLE_FMT_S16; break; case 32: - sample_format = SAMPLE_FORMAT_S32; + sample_format = AV_SAMPLE_FMT_S32; break; default: @@ -160,18 +153,12 @@ audio_format_parse(struct audio_format *dest, const char *src, bool mask, GError **error_r) { uint32_t rate; - enum sample_format sample_format; + enum AVSampleFormat sample_format; uint8_t channels; audio_format_clear(dest); /* parse sample rate */ - -#if GCC_CHECK_VERSION(4,7) - /* workaround -Wmaybe-uninitialized false positive */ - rate = 0; -#endif - if (!parse_sample_rate(src, mask, &rate, &src, error_r)) return false; @@ -182,12 +169,6 @@ audio_format_parse(struct audio_format *dest, const char *src, } /* parse sample format */ - -#if GCC_CHECK_VERSION(4,7) - /* workaround -Wmaybe-uninitialized false positive */ - sample_format = SAMPLE_FORMAT_UNDEFINED; -#endif - if (!parse_sample_format(src, mask, &sample_format, &src, error_r)) return false; |