[FFmpeg-devel] [PATCH] lavf/tee: provide aliases for the f and bsfs special options

Stefano Sabatini stefasab at gmail.com
Wed Jul 31 18:25:06 CEST 2013


Reduce the risk of option name conflict.
---
 doc/muxers.texi   |  4 ++--
 libavformat/tee.c | 20 +++++++++++---------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 7c5a1c8..70649ab 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -825,11 +825,11 @@ must be escaped; note that this is a second level escaping.
 
 The following special options are also recognized:
 @table @option
- at item f
+ at item f, tee_f
 Specify the format name. Useful if it cannot be guessed from the
 output name suffix.
 
- at item bsfs
+ at item bsfs, tee_bsfs
 Specify a list of bitstream filters to apply to the specified
 output. It is possible to specify to which streams a given bitstream
 filter applies, by appending a stream specifier to a bitstream filter
diff --git a/libavformat/tee.c b/libavformat/tee.c
index ebcee9f..5a5342d 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -187,17 +187,19 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
 
     if ((ret = parse_slave_options(avf, slave, &options, &filename)) < 0)
         return ret;
-    if ((entry = av_dict_get(options, "f", NULL, 0))) {
-        format = entry->value;
-        entry->value = NULL; /* prevent it from being freed */
-        av_dict_set(&options, "f", NULL, 0);
-    }
-    if ((entry = av_dict_get(options, "bsfs", NULL, 0))) {
-        bsfs = entry->value;
-        entry->value = NULL; /* prevent it from being freed */
-        av_dict_set(&options, "bsfs", NULL, 0);
+
+#define SET_OPT(var, key)                                      \
+    if ((entry = av_dict_get(options, key, NULL, 0))) {        \
+        var = entry->value;                                    \
+        entry->value = NULL; /* prevent it from being freed */ \
+        av_dict_set(&options, key, NULL, 0);                   \
     }
 
+    SET_OPT(format, "f");
+    SET_OPT(format, "tee_f");
+    SET_OPT(bsfs, "bsfs");
+    SET_OPT(bsfs, "tee_bsfs");
+
     ret = avformat_alloc_output_context2(&avf2, NULL, format, filename);
     if (ret < 0)
         goto fail;
-- 
1.8.1.2



More information about the ffmpeg-devel mailing list