diff options
author | Nicolas George <george@nsup.org> | 2013-10-25 15:07:40 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2013-11-03 10:30:25 +0100 |
commit | 6e2473edfda26a556c615ebc04d8aeba800bef7e (patch) | |
tree | fab01a80a859aeee3e50aba1a963d6b2be6d4d2d /libavfilter/formats.c | |
parent | d300f5f6f570659e4b58567b35c9e8600c9f2956 (diff) | |
download | ffmpeg-6e2473edfda26a556c615ebc04d8aeba800bef7e.tar.gz |
lavfi: parsing helper for unknown channel layouts.
Make ff_parse_channel_layout() accept unknown layouts too.
Diffstat (limited to 'libavfilter/formats.c')
-rw-r--r-- | libavfilter/formats.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c index d51bf3c51d..5816032746 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -615,10 +615,21 @@ int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx) return 0; } -int ff_parse_channel_layout(int64_t *ret, const char *arg, void *log_ctx) +int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, + void *log_ctx) { char *tail; - int64_t chlayout = av_get_channel_layout(arg); + int64_t chlayout, count; + + if (nret) { + count = strtol(arg, &tail, 10); + if (*tail == 'c' && !tail[1] && count > 0 && count < 63) { + *nret = count; + *ret = 0; + return 0; + } + } + chlayout = av_get_channel_layout(arg); if (chlayout == 0) { chlayout = strtol(arg, &tail, 10); if (*tail || chlayout == 0) { @@ -627,6 +638,8 @@ int ff_parse_channel_layout(int64_t *ret, const char *arg, void *log_ctx) } } *ret = chlayout; + if (nret) + *nret = av_get_channel_layout_nb_channels(chlayout); return 0; } |