Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2013-10-25 17:07:40 +0400
committerNicolas George <george@nsup.org>2013-11-03 13:30:25 +0400
commit6e2473edfda26a556c615ebc04d8aeba800bef7e (patch)
treefab01a80a859aeee3e50aba1a963d6b2be6d4d2d /libavfilter/formats.c
parentd300f5f6f570659e4b58567b35c9e8600c9f2956 (diff)
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.c17
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;
}