[FFmpeg-cvslog] af_join: switch to an AVOptions-based system.

Anton Khirnov git at videolan.org
Thu Apr 11 02:42:41 CEST 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Feb 25 21:21:29 2013 +0100| [dd7fc37c71955b78a2687f29e871f714d18de386] | committer: Anton Khirnov

af_join: switch to an AVOptions-based system.

Change the mappings separator from comma to '|' to avoid excessive
escaping, since comma is already used for separating filters in the
filtergraph description.

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

 doc/filters.texi      |    4 ++--
 libavfilter/af_join.c |   19 +++++++++++--------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index c75b0ee..dd70f74 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -347,7 +347,7 @@ Number of input streams. Defaults to 2.
 Desired output channel layout. Defaults to stereo.
 
 @item map
-Map channels from inputs to output. The argument is a comma-separated list of
+Map channels from inputs to output. The argument is a '|'-separated list of
 mappings, each in the @code{@var{input_idx}. at var{in_channel}- at var{out_channel}}
 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
 can be either the name of the input channel (e.g. FL for front left) or its
@@ -367,7 +367,7 @@ avconv -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
 To build a 5.1 output from 6 single-channel streams:
 @example
 avconv -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
-'join=inputs=6:channel_layout=5.1:map=0.0-FL\,1.0-FR\,2.0-FC\,3.0-SL\,4.0-SR\,5.0-LFE'
+'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
 out
 @end example
 
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index 172eda3..4b60509 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -102,14 +102,23 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
 static int parse_maps(AVFilterContext *ctx)
 {
     JoinContext *s = ctx->priv;
+    char separator = '|';
     char *cur      = s->map;
 
+#if FF_API_OLD_FILTER_OPTS
+    if (cur && strchr(cur, ',')) {
+        av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use '|' to "
+               "separate the mappings.\n");
+        separator = ',';
+    }
+#endif
+
     while (cur && *cur) {
         char *sep, *next, *p;
         uint64_t in_channel = 0, out_channel = 0;
         int input_idx, out_ch_idx, in_ch_idx;
 
-        next = strchr(cur, ',');
+        next = strchr(cur, separator);
         if (next)
             *next++ = 0;
 
@@ -182,13 +191,6 @@ static int join_init(AVFilterContext *ctx, const char *args)
     JoinContext *s = ctx->priv;
     int ret, i;
 
-    s->class = &join_class;
-    av_opt_set_defaults(s);
-    if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
-        av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
-        return ret;
-    }
-
     if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) {
         av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n",
                s->channel_layout_str);
@@ -512,6 +514,7 @@ AVFilter avfilter_af_join = {
     .description    = NULL_IF_CONFIG_SMALL("Join multiple audio streams into "
                                            "multi-channel output"),
     .priv_size      = sizeof(JoinContext),
+    .priv_class     = &join_class,
 
     .init           = join_init,
     .uninit         = join_uninit,



More information about the ffmpeg-cvslog mailing list