]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/formats.c
doc/muxers: remove confusing example for segment muxer option clocktime_wrap_duration
[ffmpeg] / libavfilter / formats.c
index 20f45e33cc7be47842c137d7e9cae44d4dd997fd..d4de86223750373006311fa058147c6ddee85ad7 100644 (file)
@@ -596,12 +596,12 @@ static int default_query_formats_common(AVFilterContext *ctx,
 
 int ff_default_query_formats(AVFilterContext *ctx)
 {
-    return default_query_formats_common(ctx, ff_all_channel_layouts);
+    return default_query_formats_common(ctx, ff_all_channel_counts);
 }
 
-int ff_query_formats_all(AVFilterContext *ctx)
+int ff_query_formats_all_layouts(AVFilterContext *ctx)
 {
-    return default_query_formats_common(ctx, ff_all_channel_counts);
+    return default_query_formats_common(ctx, ff_all_channel_layouts);
 }
 
 /* internal functions for parsing audio format arguments */
@@ -664,22 +664,26 @@ int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg,
 {
     char *tail;
     int64_t chlayout;
-
-    chlayout = av_get_channel_layout(arg);
-    if (chlayout == 0) {
-        chlayout = strtol(arg, &tail, 10);
-        if (!(*tail == '\0' || *tail == 'c' && *(tail + 1) == '\0') || chlayout <= 0 || chlayout > 63) {
+    int nb_channels;
+
+    if (av_get_extended_channel_layout(arg, &chlayout, &nb_channels) < 0) {
+        /* [TEMPORARY 2016-12 -> 2017-12]*/
+        nb_channels = strtol(arg, &tail, 10);
+        if (!errno && *tail == 'c' && *(tail + 1) == '\0' && nb_channels > 0 && nb_channels < 64) {
+            chlayout = 0;
+            av_log(log_ctx, AV_LOG_WARNING, "Deprecated channel count specification '%s'. This will stop working in releases made in 2018 and after.\n", arg);
+        } else {
             av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg);
             return AVERROR(EINVAL);
         }
-        if (nret) {
-            *nret = chlayout;
-            *ret = 0;
-            return 0;
-        }
+    }
+    if (!chlayout && !nret) {
+        av_log(log_ctx, AV_LOG_ERROR, "Unknown channel layout '%s' is not supported.\n", arg);
+        return AVERROR(EINVAL);
     }
     *ret = chlayout;
     if (nret)
-        *nret = av_get_channel_layout_nb_channels(chlayout);
+        *nret = nb_channels;
+
     return 0;
 }