diff options
author | wm4 <wm4@nowhere> | 2013-11-27 00:11:35 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-27 00:16:05 +0100 |
commit | addfcf9ce339f487c94c36f6e72fc7e736586015 (patch) | |
tree | 0aa3a9b83ca5f203737573d12b4afb017fdb43a5 /audio/audio.c | |
parent | ce1a511e221b032acc863d86b8d5b1644af00445 (diff) | |
download | mpv-addfcf9ce339f487c94c36f6e72fc7e736586015.tar.bz2 mpv-addfcf9ce339f487c94c36f6e72fc7e736586015.tar.xz |
audio: better rejection of invalid formats
This includes the case when lavc decodes audio with more than 8
channels, which our audio chain currently does not support.
the changes in ad_lavc.c are just simplifications. The code tried to
avoid overriding global parameters if it found something invalid, but
that is not needed anymore.
Diffstat (limited to 'audio/audio.c')
-rw-r--r-- | audio/audio.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/audio/audio.c b/audio/audio.c index 02cd27d0d0..b40ef6fab3 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -79,6 +79,12 @@ bool mp_audio_config_equals(const struct mp_audio *a, const struct mp_audio *b) mp_chmap_equals(&a->channels, &b->channels); } +bool mp_audio_config_valid(const struct mp_audio *mpa) +{ + return mp_chmap_is_valid(&mpa->channels) && af_fmt_is_valid(mpa->format) + && mpa->rate >= 1 && mpa->rate < 10000000; +} + char *mp_audio_fmt_to_str(int srate, const struct mp_chmap *chmap, int format) { char *chstr = mp_chmap_to_str(chmap); |