[FFmpeg-cvslog] lavfi: implement ff_query_formats_all().

Nicolas George git at videolan.org
Sat Jan 26 11:20:43 CET 2013


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Wed Dec 26 16:47:18 2012 +0100| [b6b2f3433c217b01c75729df0e316d525cd8d804] | committer: Nicolas George

lavfi: implement ff_query_formats_all().

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6b2f3433c217b01c75729df0e316d525cd8d804
---

 libavfilter/formats.c |   15 +++++++++++++--
 libavfilter/formats.h |    8 ++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 5f8954c..0284db2 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -516,7 +516,8 @@ void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
                        ff_formats_ref, formats);
 }
 
-int ff_default_query_formats(AVFilterContext *ctx)
+static int default_query_formats_common(AVFilterContext *ctx,
+                                        AVFilterChannelLayouts *(layouts)(void))
 {
     enum AVMediaType type = ctx->inputs  && ctx->inputs [0] ? ctx->inputs [0]->type :
                             ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
@@ -524,13 +525,23 @@ int ff_default_query_formats(AVFilterContext *ctx)
 
     ff_set_common_formats(ctx, ff_all_formats(type));
     if (type == AVMEDIA_TYPE_AUDIO) {
-        ff_set_common_channel_layouts(ctx, ff_all_channel_layouts());
+        ff_set_common_channel_layouts(ctx, layouts());
         ff_set_common_samplerates(ctx, ff_all_samplerates());
     }
 
     return 0;
 }
 
+int ff_default_query_formats(AVFilterContext *ctx)
+{
+    return default_query_formats_common(ctx, ff_all_channel_layouts);
+}
+
+int ff_query_formats_all(AVFilterContext *ctx)
+{
+    return default_query_formats_common(ctx, ff_all_channel_counts);
+}
+
 /* internal functions for parsing audio format arguments */
 
 int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ctx)
diff --git a/libavfilter/formats.h b/libavfilter/formats.h
index 4ef63df..a476e70 100644
--- a/libavfilter/formats.h
+++ b/libavfilter/formats.h
@@ -172,6 +172,14 @@ void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
 
 int ff_default_query_formats(AVFilterContext *ctx);
 
+/**
+ * Set the formats list to all existing formats.
+ * This function behaves like ff_default_query_formats(), except it also
+ * accepts channel layouts with unknown disposition. It should only be used
+ * with audio filters.
+ */
+int ff_query_formats_all(AVFilterContext *ctx);
+
 
 /**
  * Create a list of supported formats. This is intended for use in



More information about the ffmpeg-cvslog mailing list