Browse Source

Merge commit 'ec36aa69448f20a78d8c4588265022e0b2272ab5'

* commit 'ec36aa69448f20a78d8c4588265022e0b2272ab5':
  x86: Fix linking with some or all of yasm, mmx, optimizations disabled
  configure: Add more fine-grained SSE CPU capabilities flags
  avfilter: x86: Use more precise compile template names
  x86: cosmetics: Comment some #endifs for better readability
  g723_1: add comfort noise generation
  utvideoenc: Switch to dsputils' median prediction
  utvideoenc: Avoid writing into the input picture
  avtools: remove the distinction between func_arg and func2_arg.
  avconv: make the -passlogfile option per-stream.
  avconv: make the -pass option per-stream.
  cmdutils: make -codecs print lossy/lossless flags.
  lavc: add lossy/lossless codec properties.

Conflicts:
	Changelog
	cmdutils.c
	configure
	doc/APIchanges
	ffmpeg.h
	ffmpeg_opt.c
	ffprobe.c
	libavcodec/codec_desc.c
	libavcodec/g723_1.c
	libavcodec/utvideoenc.c
	libavcodec/version.h
	libavcodec/x86/mpegaudiodec.c
	libavcodec/x86/rv40dsp_init.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer 12 years ago
parent
commit
98298eb103
10 changed files with 189 additions and 172 deletions
  1. 1 0
      Changelog
  2. 33 30
      cmdutils.c
  3. 22 22
      cmdutils.h
  4. 29 12
      configure
  5. 4 0
      doc/APIchanges
  6. 2 2
      doc/ffmpeg.texi
  7. 4 2
      ffmpeg.c
  8. 5 1
      ffmpeg.h
  9. 85 99
      ffmpeg_opt.c
  10. 4 4
      ffplay.c

+ 1 - 0
Changelog

@@ -50,6 +50,7 @@ version next:
 - edge detection filter
 - edge detection filter
 - framestep filter
 - framestep filter
 - ffmpeg -shortest option is now per-output file
 - ffmpeg -shortest option is now per-output file
+  -pass and -passlogfile are now per-output stream
 - volume measurement filter
 - volume measurement filter
 - Ut Video encoder
 - Ut Video encoder
 - Matroska demuxer now identifies SRT subtitles as AV_CODEC_ID_SUBRIP
 - Matroska demuxer now identifies SRT subtitles as AV_CODEC_ID_SUBRIP

+ 33 - 30
cmdutils.c

@@ -316,8 +316,7 @@ int parse_option(void *optctx, const char *opt, const char *arg,
     } else if (po->flags & OPT_DOUBLE) {
     } else if (po->flags & OPT_DOUBLE) {
         *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY);
         *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY);
     } else if (po->u.func_arg) {
     } else if (po->u.func_arg) {
-        int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg)
-                                        : po->u.func_arg(opt, arg);
+        int ret = po->u.func_arg(optctx, opt, arg);
         if (ret < 0) {
         if (ret < 0) {
             av_log(NULL, AV_LOG_ERROR,
             av_log(NULL, AV_LOG_ERROR,
                    "Failed to set value '%s' for option '%s'\n", arg, opt);
                    "Failed to set value '%s' for option '%s'\n", arg, opt);
@@ -416,7 +415,7 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
     if (!idx)
     if (!idx)
         idx = locate_option(argc, argv, options, "v");
         idx = locate_option(argc, argv, options, "v");
     if (idx && argv[idx + 1])
     if (idx && argv[idx + 1])
-        opt_loglevel("loglevel", argv[idx + 1]);
+        opt_loglevel(NULL, "loglevel", argv[idx + 1]);
     idx = locate_option(argc, argv, options, "report");
     idx = locate_option(argc, argv, options, "report");
     if (idx || getenv("FFREPORT")) {
     if (idx || getenv("FFREPORT")) {
         opt_report("report");
         opt_report("report");
@@ -433,7 +432,7 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
 }
 }
 
 
 #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
 #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
-int opt_default(const char *opt, const char *arg)
+int opt_default(void *optctx, const char *opt, const char *arg)
 {
 {
     const AVOption *o;
     const AVOption *o;
     char opt_stripped[128];
     char opt_stripped[128];
@@ -482,7 +481,7 @@ int opt_default(const char *opt, const char *arg)
     return AVERROR_OPTION_NOT_FOUND;
     return AVERROR_OPTION_NOT_FOUND;
 }
 }
 
 
-int opt_loglevel(const char *opt, const char *arg)
+int opt_loglevel(void *optctx, const char *opt, const char *arg)
 {
 {
     const struct { const char *name; int level; } log_levels[] = {
     const struct { const char *name; int level; } log_levels[] = {
         { "quiet"  , AV_LOG_QUIET   },
         { "quiet"  , AV_LOG_QUIET   },
@@ -549,7 +548,7 @@ int opt_report(const char *opt)
     return 0;
     return 0;
 }
 }
 
 
-int opt_max_alloc(const char *opt, const char *arg)
+int opt_max_alloc(void *optctx, const char *opt, const char *arg)
 {
 {
     char *tail;
     char *tail;
     size_t max;
     size_t max;
@@ -563,7 +562,7 @@ int opt_max_alloc(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int opt_cpuflags(const char *opt, const char *arg)
+int opt_cpuflags(void *optctx, const char *opt, const char *arg)
 {
 {
     int ret;
     int ret;
     unsigned flags = av_get_cpu_flags();
     unsigned flags = av_get_cpu_flags();
@@ -575,13 +574,13 @@ int opt_cpuflags(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int opt_codec_debug(const char *opt, const char *arg)
+int opt_codec_debug(void *optctx, const char *opt, const char *arg)
 {
 {
     av_log_set_level(AV_LOG_DEBUG);
     av_log_set_level(AV_LOG_DEBUG);
-    return opt_default(opt, arg);
+    return opt_default(NULL, opt, arg);
 }
 }
 
 
-int opt_timelimit(const char *opt, const char *arg)
+int opt_timelimit(void *optctx, const char *opt, const char *arg)
 {
 {
 #if HAVE_SETRLIMIT
 #if HAVE_SETRLIMIT
     int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
     int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
@@ -680,7 +679,7 @@ void show_banner(int argc, char **argv, const OptionDef *options)
     print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_INFO);
     print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_INFO);
 }
 }
 
 
-int show_version(const char *opt, const char *arg)
+int show_version(void *optctx, const char *opt, const char *arg)
 {
 {
     av_log_set_callback(log_callback_help);
     av_log_set_callback(log_callback_help);
     print_program_info (0           , AV_LOG_INFO);
     print_program_info (0           , AV_LOG_INFO);
@@ -689,7 +688,7 @@ int show_version(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int show_license(const char *opt, const char *arg)
+int show_license(void *optctx, const char *opt, const char *arg)
 {
 {
     printf(
     printf(
 #if CONFIG_NONFREE
 #if CONFIG_NONFREE
@@ -760,7 +759,7 @@ int show_license(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int show_formats(const char *opt, const char *arg)
+int show_formats(void *optctx, const char *opt, const char *arg)
 {
 {
     AVInputFormat *ifmt  = NULL;
     AVInputFormat *ifmt  = NULL;
     AVOutputFormat *ofmt = NULL;
     AVOutputFormat *ofmt = NULL;
@@ -902,18 +901,20 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder)
     printf(")");
     printf(")");
 }
 }
 
 
-int show_codecs(const char *opt, const char *arg)
+int show_codecs(void *optctx, const char *opt, const char *arg)
 {
 {
     const AVCodecDescriptor *desc = NULL;
     const AVCodecDescriptor *desc = NULL;
 
 
     printf("Codecs:\n"
     printf("Codecs:\n"
-           " D... = Decoding supported\n"
-           " .E.. = Encoding supported\n"
-           " ..V. = Video codec\n"
-           " ..A. = Audio codec\n"
-           " ..S. = Subtitle codec\n"
-           " ...I = Intra frame-only codec\n"
-           " -----\n");
+           " D..... = Decoding supported\n"
+           " .E.... = Encoding supported\n"
+           " ..V... = Video codec\n"
+           " ..A... = Audio codec\n"
+           " ..S... = Subtitle codec\n"
+           " ...I.. = Intra frame-only codec\n"
+           " ....L. = Lossy compression\n"
+           " .....S = Lossless compression\n"
+           " -------\n");
     while ((desc = avcodec_descriptor_next(desc))) {
     while ((desc = avcodec_descriptor_next(desc))) {
         const AVCodec *codec = NULL;
         const AVCodec *codec = NULL;
 
 
@@ -923,6 +924,8 @@ int show_codecs(const char *opt, const char *arg)
 
 
         printf("%c", get_media_type_char(desc->type));
         printf("%c", get_media_type_char(desc->type));
         printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
         printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
+        printf((desc->props & AV_CODEC_PROP_LOSSY)      ? "L" : ".");
+        printf((desc->props & AV_CODEC_PROP_LOSSLESS)   ? "S" : ".");
 
 
         printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
         printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
 
 
@@ -982,19 +985,19 @@ static void print_codecs(int encoder)
     }
     }
 }
 }
 
 
-int show_decoders(const char *opt, const char *arg)
+int show_decoders(void *optctx, const char *opt, const char *arg)
 {
 {
     print_codecs(0);
     print_codecs(0);
     return 0;
     return 0;
 }
 }
 
 
-int show_encoders(const char *opt, const char *arg)
+int show_encoders(void *optctx, const char *opt, const char *arg)
 {
 {
     print_codecs(1);
     print_codecs(1);
     return 0;
     return 0;
 }
 }
 
 
-int show_bsfs(const char *opt, const char *arg)
+int show_bsfs(void *optctx, const char *opt, const char *arg)
 {
 {
     AVBitStreamFilter *bsf = NULL;
     AVBitStreamFilter *bsf = NULL;
 
 
@@ -1005,7 +1008,7 @@ int show_bsfs(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int show_protocols(const char *opt, const char *arg)
+int show_protocols(void *optctx, const char *opt, const char *arg)
 {
 {
     void *opaque = NULL;
     void *opaque = NULL;
     const char *name;
     const char *name;
@@ -1020,7 +1023,7 @@ int show_protocols(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int show_filters(const char *opt, const char *arg)
+int show_filters(void *optctx, const char *opt, const char *arg)
 {
 {
     AVFilter av_unused(**filter) = NULL;
     AVFilter av_unused(**filter) = NULL;
     char descr[64], *descr_cur;
     char descr[64], *descr_cur;
@@ -1052,7 +1055,7 @@ int show_filters(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int show_pix_fmts(const char *opt, const char *arg)
+int show_pix_fmts(void *optctx, const char *opt, const char *arg)
 {
 {
     enum PixelFormat pix_fmt;
     enum PixelFormat pix_fmt;
 
 
@@ -1087,7 +1090,7 @@ int show_pix_fmts(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int show_layouts(const char *opt, const char *arg)
+int show_layouts(void *optctx, const char *opt, const char *arg)
 {
 {
     int i = 0;
     int i = 0;
     uint64_t layout, j;
     uint64_t layout, j;
@@ -1116,7 +1119,7 @@ int show_layouts(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-int show_sample_fmts(const char *opt, const char *arg)
+int show_sample_fmts(void *optctx, const char *opt, const char *arg)
 {
 {
     int i;
     int i;
     char fmt_str[128];
     char fmt_str[128];
@@ -1211,7 +1214,7 @@ static void show_help_muxer(const char *name)
         show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM);
         show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM);
 }
 }
 
 
-int show_help(const char *opt, const char *arg)
+int show_help(void *optctx, const char *opt, const char *arg)
 {
 {
     char *topic, *par;
     char *topic, *par;
     av_log_set_callback(log_callback_help);
     av_log_set_callback(log_callback_help);

+ 22 - 22
cmdutils.h

@@ -75,25 +75,25 @@ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
  * Fallback for options that are not explicitly handled, these will be
  * Fallback for options that are not explicitly handled, these will be
  * parsed through AVOptions.
  * parsed through AVOptions.
  */
  */
-int opt_default(const char *opt, const char *arg);
+int opt_default(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Set the libav* libraries log level.
  * Set the libav* libraries log level.
  */
  */
-int opt_loglevel(const char *opt, const char *arg);
+int opt_loglevel(void *optctx, const char *opt, const char *arg);
 
 
 int opt_report(const char *opt);
 int opt_report(const char *opt);
 
 
-int opt_max_alloc(const char *opt, const char *arg);
+int opt_max_alloc(void *optctx, const char *opt, const char *arg);
 
 
-int opt_cpuflags(const char *opt, const char *arg);
+int opt_cpuflags(void *optctx, const char *opt, const char *arg);
 
 
-int opt_codec_debug(const char *opt, const char *arg);
+int opt_codec_debug(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Limit the execution time.
  * Limit the execution time.
  */
  */
-int opt_timelimit(const char *opt, const char *arg);
+int opt_timelimit(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Parse a string and return its corresponding value as a double.
  * Parse a string and return its corresponding value as a double.
@@ -154,7 +154,8 @@ typedef struct {
 #define OPT_INT64  0x0400
 #define OPT_INT64  0x0400
 #define OPT_EXIT   0x0800
 #define OPT_EXIT   0x0800
 #define OPT_DATA   0x1000
 #define OPT_DATA   0x1000
-#define OPT_FUNC2  0x2000
+#define OPT_PERFILE  0x2000     /* the option is per-file (currently ffmpeg-only).
+                                   implied by OPT_OFFSET or OPT_SPEC */
 #define OPT_OFFSET 0x4000       /* option is specified as an offset in a passed optctx */
 #define OPT_OFFSET 0x4000       /* option is specified as an offset in a passed optctx */
 #define OPT_SPEC   0x8000       /* option is to be stored in an array of SpecifierOpt.
 #define OPT_SPEC   0x8000       /* option is to be stored in an array of SpecifierOpt.
                                    Implies OPT_OFFSET. Next element after the offset is
                                    Implies OPT_OFFSET. Next element after the offset is
@@ -163,8 +164,7 @@ typedef struct {
 #define OPT_DOUBLE 0x20000
 #define OPT_DOUBLE 0x20000
      union {
      union {
         void *dst_ptr;
         void *dst_ptr;
-        int (*func_arg)(const char *, const char *);
-        int (*func2_arg)(void *, const char *, const char *);
+        int (*func_arg)(void *, const char *, const char *);
         size_t off;
         size_t off;
     } u;
     } u;
     const char *help;
     const char *help;
@@ -198,7 +198,7 @@ void show_help_default(const char *opt, const char *arg);
 /**
 /**
  * Generic -h handler common to all avtools.
  * Generic -h handler common to all avtools.
  */
  */
-int show_help(const char *opt, const char *arg);
+int show_help(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Parse the command line arguments.
  * Parse the command line arguments.
@@ -296,81 +296,81 @@ void show_banner(int argc, char **argv, const OptionDef *options);
  * libraries.
  * libraries.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_version(const char *opt, const char *arg);
+int show_version(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print the license of the program to stdout. The license depends on
  * Print the license of the program to stdout. The license depends on
  * the license of the libraries compiled into the program.
  * the license of the libraries compiled into the program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_license(const char *opt, const char *arg);
+int show_license(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the formats supported by the
  * Print a listing containing all the formats supported by the
  * program.
  * program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_formats(const char *opt, const char *arg);
+int show_formats(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the codecs supported by the
  * Print a listing containing all the codecs supported by the
  * program.
  * program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_codecs(const char *opt, const char *arg);
+int show_codecs(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the decoders supported by the
  * Print a listing containing all the decoders supported by the
  * program.
  * program.
  */
  */
-int show_decoders(const char *opt, const char *arg);
+int show_decoders(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the encoders supported by the
  * Print a listing containing all the encoders supported by the
  * program.
  * program.
  */
  */
-int show_encoders(const char *opt, const char *arg);
+int show_encoders(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the filters supported by the
  * Print a listing containing all the filters supported by the
  * program.
  * program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_filters(const char *opt, const char *arg);
+int show_filters(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the bit stream filters supported by the
  * Print a listing containing all the bit stream filters supported by the
  * program.
  * program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_bsfs(const char *opt, const char *arg);
+int show_bsfs(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the protocols supported by the
  * Print a listing containing all the protocols supported by the
  * program.
  * program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_protocols(const char *opt, const char *arg);
+int show_protocols(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the pixel formats supported by the
  * Print a listing containing all the pixel formats supported by the
  * program.
  * program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_pix_fmts(const char *opt, const char *arg);
+int show_pix_fmts(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the standard channel layouts supported by
  * Print a listing containing all the standard channel layouts supported by
  * the program.
  * the program.
  * This option processing function does not utilize the arguments.
  * This option processing function does not utilize the arguments.
  */
  */
-int show_layouts(const char *opt, const char *arg);
+int show_layouts(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Print a listing containing all the sample formats supported by the
  * Print a listing containing all the sample formats supported by the
  * program.
  * program.
  */
  */
-int show_sample_fmts(const char *opt, const char *arg);
+int show_sample_fmts(void *optctx, const char *opt, const char *arg);
 
 
 /**
 /**
  * Return a positive value if a line read from standard input
  * Return a positive value if a line read from standard input

+ 29 - 12
configure

@@ -276,7 +276,11 @@ Optimization options (experts only):
   --disable-mmx            disable MMX optimizations
   --disable-mmx            disable MMX optimizations
   --disable-mmxext         disable MMXEXT optimizations
   --disable-mmxext         disable MMXEXT optimizations
   --disable-sse            disable SSE optimizations
   --disable-sse            disable SSE optimizations
+  --disable-sse2           disable SSE2 optimizations
+  --disable-sse3           disable SSE3 optimizations
   --disable-ssse3          disable SSSE3 optimizations
   --disable-ssse3          disable SSSE3 optimizations
+  --disable-sse4           disable SSE4 optimizations
+  --disable-sse42          disable SSE4.2 optimizations
   --disable-avx            disable AVX optimizations
   --disable-avx            disable AVX optimizations
   --disable-fma4           disable FMA4 optimizations
   --disable-fma4           disable FMA4 optimizations
   --disable-armv5te        disable armv5te optimizations
   --disable-armv5te        disable armv5te optimizations
@@ -1202,30 +1206,38 @@ ARCH_LIST='
     x86_64
     x86_64
 '
 '
 
 
-ARCH_EXT_LIST='
-    altivec
+ARCH_EXT_LIST_X86='
     amd3dnow
     amd3dnow
     amd3dnowext
     amd3dnowext
+    avx
+    fma4
+    mmx
+    mmxext
+    sse
+    sse2
+    sse3
+    sse4
+    sse42
+    ssse3
+'
+
+ARCH_EXT_LIST="
+    $ARCH_EXT_LIST_X86
+    altivec
     armv5te
     armv5te
     armv6
     armv6
     armv6t2
     armv6t2
     armvfp
     armvfp
-    avx
-    fma4
     mmi
     mmi
-    mmx
-    mmxext
     neon
     neon
     ppc4xx
     ppc4xx
-    sse
-    ssse3
     vfpv3
     vfpv3
     vis
     vis
     mipsfpu
     mipsfpu
     mips32r2
     mips32r2
     mipsdspr1
     mipsdspr1
     mipsdspr2
     mipsdspr2
-'
+"
 
 
 HAVE_LIST_PUB='
 HAVE_LIST_PUB='
     bigendian
     bigendian
@@ -1498,13 +1510,18 @@ ppc4xx_deps="ppc"
 vis_deps="sparc"
 vis_deps="sparc"
 
 
 x86_64_suggest="cmov fast_cmov"
 x86_64_suggest="cmov fast_cmov"
+
 amd3dnow_deps="mmx"
 amd3dnow_deps="mmx"
 amd3dnowext_deps="amd3dnow"
 amd3dnowext_deps="amd3dnow"
 mmx_deps="x86"
 mmx_deps="x86"
 mmxext_deps="mmx"
 mmxext_deps="mmx"
-sse_deps="mmx"
-ssse3_deps="sse"
-avx_deps="ssse3"
+sse_deps="mmxext"
+sse2_deps="sse"
+sse3_deps="sse2"
+ssse3_deps="sse3"
+sse4_deps="ssse3"
+sse42_deps="sse4"
+avx_deps="sse42"
 fma4_deps="avx"
 fma4_deps="avx"
 
 
 aligned_stack_if_any="ppc x86"
 aligned_stack_if_any="ppc x86"

+ 4 - 0
doc/APIchanges

@@ -77,6 +77,10 @@ API changes, most recent first:
 2012-03-26 - a67d9cf - lavfi 2.66.100
 2012-03-26 - a67d9cf - lavfi 2.66.100
   Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
   Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
 
 
+2012-xx-xx - xxxxxxx - lavc 54.26.1 - avcodec.h
+  Add codec descriptor properties AV_CODEC_PROP_LOSSY and
+  AV_CODEC_PROP_LOSSLESS.
+
 2012-08-18 - lavc 54.26 - avcodec.h
 2012-08-18 - lavc 54.26 - avcodec.h
   Add codec descriptors for accessing codec properties without having
   Add codec descriptors for accessing codec properties without having
   to refer to a specific decoder or encoder.
   to refer to a specific decoder or encoder.

+ 2 - 2
doc/ffmpeg.texi

@@ -476,7 +476,7 @@ Use same quantizer as source (implies VBR).
 Note that this is NOT SAME QUALITY. Do not use this option unless you know you
 Note that this is NOT SAME QUALITY. Do not use this option unless you know you
 need it.
 need it.
 
 
-@item -pass @var{n}
+@item -pass[:@var{stream_specifier}] @var{n} (@emph{output,per-stream})
 Select the pass number (1 or 2). It is used to do two-pass
 Select the pass number (1 or 2). It is used to do two-pass
 video encoding. The statistics of the video are recorded in the first
 video encoding. The statistics of the video are recorded in the first
 pass into a log file (see also the option -passlogfile),
 pass into a log file (see also the option -passlogfile),
@@ -489,7 +489,7 @@ ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL
 ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
 ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
 @end example
 @end example
 
 
-@item -passlogfile @var{prefix} (@emph{global})
+@item -passlogfile[:@var{stream_specifier}] @var{prefix} (@emph{output,per-stream})
 Set two-pass log file name prefix to @var{prefix}, the default file name
 Set two-pass log file name prefix to @var{prefix}, the default file name
 prefix is ``ffmpeg2pass''. The complete file name will be
 prefix is ``ffmpeg2pass''. The complete file name will be
 @file{PREFIX-N.log}, where N is a number specific to the output
 @file{PREFIX-N.log}, where N is a number specific to the output

+ 4 - 2
ffmpeg.c

@@ -414,6 +414,7 @@ void av_noreturn exit_program(int ret)
 
 
         av_freep(&output_streams[i]->forced_keyframes);
         av_freep(&output_streams[i]->forced_keyframes);
         av_freep(&output_streams[i]->avfilter);
         av_freep(&output_streams[i]->avfilter);
+        av_freep(&output_streams[i]->logfile_prefix);
         av_freep(&output_streams[i]->filtered_frame);
         av_freep(&output_streams[i]->filtered_frame);
         av_freep(&output_streams[i]);
         av_freep(&output_streams[i]);
     }
     }
@@ -2207,7 +2208,8 @@ static int transcode_init(void)
                 FILE *f;
                 FILE *f;
 
 
                 snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
                 snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
-                         pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
+                         ost->logfile_prefix ? ost->logfile_prefix :
+                                               DEFAULT_PASS_LOGFILENAME_PREFIX,
                          i);
                          i);
                 if (!strcmp(ost->enc->name, "libx264")) {
                 if (!strcmp(ost->enc->name, "libx264")) {
                     av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
                     av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
@@ -3089,7 +3091,7 @@ static void parse_cpuflags(int argc, char **argv, const OptionDef *options)
 {
 {
     int idx = locate_option(argc, argv, options, "cpuflags");
     int idx = locate_option(argc, argv, options, "cpuflags");
     if (idx && argv[idx + 1])
     if (idx && argv[idx + 1])
-        opt_cpuflags("cpuflags", argv[idx + 1]);
+        opt_cpuflags(NULL, "cpuflags", argv[idx + 1]);
 }
 }
 
 
 int main(int argc, char **argv)
 int main(int argc, char **argv)

+ 5 - 1
ffmpeg.h

@@ -161,6 +161,10 @@ typedef struct OptionsContext {
     int        nb_filters;
     int        nb_filters;
     SpecifierOpt *fix_sub_duration;
     SpecifierOpt *fix_sub_duration;
     int        nb_fix_sub_duration;
     int        nb_fix_sub_duration;
+    SpecifierOpt *pass;
+    int        nb_pass;
+    SpecifierOpt *passlogfiles;
+    int        nb_passlogfiles;
 } OptionsContext;
 } OptionsContext;
 
 
 typedef struct InputFilter {
 typedef struct InputFilter {
@@ -308,6 +312,7 @@ typedef struct OutputStream {
     int audio_channels_map[SWR_CH_MAX];  /* list of the channels id to pick from the source stream */
     int audio_channels_map[SWR_CH_MAX];  /* list of the channels id to pick from the source stream */
     int audio_channels_mapped;           /* number of channels in audio_channels_map */
     int audio_channels_mapped;           /* number of channels in audio_channels_map */
 
 
+    char *logfile_prefix;
     FILE *logfile;
     FILE *logfile;
 
 
     OutputFilter *filter;
     OutputFilter *filter;
@@ -350,7 +355,6 @@ extern int         nb_output_files;
 extern FilterGraph **filtergraphs;
 extern FilterGraph **filtergraphs;
 extern int        nb_filtergraphs;
 extern int        nb_filtergraphs;
 
 
-extern const char *pass_logfilename_prefix;
 extern char *vstats_filename;
 extern char *vstats_filename;
 
 
 extern float audio_drift_threshold;
 extern float audio_drift_threshold;

+ 85 - 99
ffmpeg_opt.c

@@ -54,7 +54,6 @@
     }\
     }\
 }
 }
 
 
-const char *pass_logfilename_prefix;
 char *vstats_filename;
 char *vstats_filename;
 
 
 float audio_drift_threshold = 0.1;
 float audio_drift_threshold = 0.1;
@@ -89,7 +88,6 @@ static int no_file_overwrite  = 0;
 static int video_discard      = 0;
 static int video_discard      = 0;
 static int intra_dc_precision = 8;
 static int intra_dc_precision = 8;
 static int do_psnr            = 0;
 static int do_psnr            = 0;
-static int do_pass            = 0;
 static int input_sync;
 static int input_sync;
 
 
 void reset_options(OptionsContext *o, int is_input)
 void reset_options(OptionsContext *o, int is_input)
@@ -142,28 +140,28 @@ void reset_options(OptionsContext *o, int is_input)
 }
 }
 
 
 
 
-static int opt_frame_crop(const char *opt, const char *arg)
+static int opt_frame_crop(void *optctx, const char *opt, const char *arg)
 {
 {
     av_log(NULL, AV_LOG_FATAL, "Option '%s' has been removed, use the crop filter instead\n", opt);
     av_log(NULL, AV_LOG_FATAL, "Option '%s' has been removed, use the crop filter instead\n", opt);
     return AVERROR(EINVAL);
     return AVERROR(EINVAL);
 }
 }
 
 
-static int opt_pad(const char *opt, const char *arg)
+static int opt_pad(void *optctx, const char *opt, const char *arg)
 {
 {
     av_log(NULL, AV_LOG_FATAL, "Option '%s' has been removed, use the pad filter instead\n", opt);
     av_log(NULL, AV_LOG_FATAL, "Option '%s' has been removed, use the pad filter instead\n", opt);
     return -1;
     return -1;
 }
 }
 
 
-static int opt_video_channel(const char *opt, const char *arg)
+static int opt_video_channel(void *optctx, const char *opt, const char *arg)
 {
 {
     av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -channel.\n");
     av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -channel.\n");
-    return opt_default("channel", arg);
+    return opt_default(optctx, "channel", arg);
     }
     }
 
 
-static int opt_video_standard(const char *opt, const char *arg)
+static int opt_video_standard(void *optctx, const char *opt, const char *arg)
 {
 {
     av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -standard.\n");
     av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -standard.\n");
-    return opt_default("standard", arg);
+    return opt_default(optctx, "standard", arg);
 }
 }
 
 
 static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
 static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
@@ -1040,6 +1038,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
         char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
         char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
         char *intra_matrix = NULL, *inter_matrix = NULL;
         char *intra_matrix = NULL, *inter_matrix = NULL;
         const char *filters = "null";
         const char *filters = "null";
+        int do_pass = 0;
         int i;
         int i;
 
 
         MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
         MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
@@ -1125,6 +1124,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
             video_enc->flags|= CODEC_FLAG_PSNR;
             video_enc->flags|= CODEC_FLAG_PSNR;
 
 
         /* two pass mode */
         /* two pass mode */
+        MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
         if (do_pass) {
         if (do_pass) {
             if (do_pass & 1) {
             if (do_pass & 1) {
                 video_enc->flags |= CODEC_FLAG_PASS1;
                 video_enc->flags |= CODEC_FLAG_PASS1;
@@ -1134,6 +1134,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
             }
             }
         }
         }
 
 
+        MATCH_PER_STREAM_OPT(passlogfiles, str, ost->logfile_prefix, oc, st);
+        if (ost->logfile_prefix &&
+            !(ost->logfile_prefix = av_strdup(ost->logfile_prefix)))
+            exit_program(1);
+
         MATCH_PER_STREAM_OPT(forced_key_frames, str, ost->forced_keyframes, oc, st);
         MATCH_PER_STREAM_OPT(forced_key_frames, str, ost->forced_keyframes, oc, st);
         if (ost->forced_keyframes)
         if (ost->forced_keyframes)
             ost->forced_keyframes = av_strdup(ost->forced_keyframes);
             ost->forced_keyframes = av_strdup(ost->forced_keyframes);
@@ -1758,14 +1763,6 @@ loop_end:
     reset_options(o, 0);
     reset_options(o, 0);
 }
 }
 
 
-/* same option as mencoder */
-static int opt_pass(const char *opt, const char *arg)
-{
-    do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 3);
-    return 0;
-}
-
-
 static int opt_target(void *optctx, const char *opt, const char *arg)
 static int opt_target(void *optctx, const char *opt, const char *arg)
 {
 {
     OptionsContext *o = optctx;
     OptionsContext *o = optctx;
@@ -1821,19 +1818,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
 
 
         parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
         parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
         parse_option(o, "r", frame_rates[norm], options);
         parse_option(o, "r", frame_rates[norm], options);
-        opt_default("g", norm == PAL ? "15" : "18");
+        opt_default(NULL, "g", norm == PAL ? "15" : "18");
 
 
-        opt_default("b:v", "1150000");
-        opt_default("maxrate", "1150000");
-        opt_default("minrate", "1150000");
-        opt_default("bufsize", "327680"); // 40*1024*8;
+        opt_default(NULL, "b:v", "1150000");
+        opt_default(NULL, "maxrate", "1150000");
+        opt_default(NULL, "minrate", "1150000");
+        opt_default(NULL, "bufsize", "327680"); // 40*1024*8;
 
 
-        opt_default("b:a", "224000");
+        opt_default(NULL, "b:a", "224000");
         parse_option(o, "ar", "44100", options);
         parse_option(o, "ar", "44100", options);
         parse_option(o, "ac", "2", options);
         parse_option(o, "ac", "2", options);
 
 
-        opt_default("packetsize", "2324");
-        opt_default("muxrate", "1411200"); // 2352 * 75 * 8;
+        opt_default(NULL, "packetsize", "2324");
+        opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8;
 
 
         /* We have to offset the PTS, so that it is consistent with the SCR.
         /* We have to offset the PTS, so that it is consistent with the SCR.
            SCR starts at 36000, but the first two packs contain only padding
            SCR starts at 36000, but the first two packs contain only padding
@@ -1850,19 +1847,18 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
         parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
         parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
         parse_option(o, "r", frame_rates[norm], options);
         parse_option(o, "r", frame_rates[norm], options);
         parse_option(o, "pix_fmt", "yuv420p", options);
         parse_option(o, "pix_fmt", "yuv420p", options);
-        opt_default("g", norm == PAL ? "15" : "18");
-
-        opt_default("b:v", "2040000");
-        opt_default("maxrate", "2516000");
-        opt_default("minrate", "0"); // 1145000;
-        opt_default("bufsize", "1835008"); // 224*1024*8;
-        opt_default("scan_offset", "1");
+        opt_default(NULL, "g", norm == PAL ? "15" : "18");
 
 
+        opt_default(NULL, "b:v", "2040000");
+        opt_default(NULL, "maxrate", "2516000");
+        opt_default(NULL, "minrate", "0"); // 1145000;
+        opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
+        opt_default(NULL, "scan_offset", "1");
 
 
-        opt_default("b:a", "224000");
+        opt_default(NULL, "b:a", "224000");
         parse_option(o, "ar", "44100", options);
         parse_option(o, "ar", "44100", options);
 
 
-        opt_default("packetsize", "2324");
+        opt_default(NULL, "packetsize", "2324");
 
 
     } else if (!strcmp(arg, "dvd")) {
     } else if (!strcmp(arg, "dvd")) {
 
 
@@ -1873,17 +1869,17 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
         parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
         parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
         parse_option(o, "r", frame_rates[norm], options);
         parse_option(o, "r", frame_rates[norm], options);
         parse_option(o, "pix_fmt", "yuv420p", options);
         parse_option(o, "pix_fmt", "yuv420p", options);
-        opt_default("g", norm == PAL ? "15" : "18");
+        opt_default(NULL, "g", norm == PAL ? "15" : "18");
 
 
-        opt_default("b:v", "6000000");
-        opt_default("maxrate", "9000000");
-        opt_default("minrate", "0"); // 1500000;
-        opt_default("bufsize", "1835008"); // 224*1024*8;
+        opt_default(NULL, "b:v", "6000000");
+        opt_default(NULL, "maxrate", "9000000");
+        opt_default(NULL, "minrate", "0"); // 1500000;
+        opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
 
 
-        opt_default("packetsize", "2048");  // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
-        opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
+        opt_default(NULL, "packetsize", "2048");  // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
+        opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
 
 
-        opt_default("b:a", "448000");
+        opt_default(NULL, "b:a", "448000");
         parse_option(o, "ar", "48000", options);
         parse_option(o, "ar", "48000", options);
 
 
     } else if (!strncmp(arg, "dv", 2)) {
     } else if (!strncmp(arg, "dv", 2)) {
@@ -1905,14 +1901,14 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-static int opt_vstats_file(const char *opt, const char *arg)
+static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
 {
 {
     av_free (vstats_filename);
     av_free (vstats_filename);
     vstats_filename = av_strdup (arg);
     vstats_filename = av_strdup (arg);
     return 0;
     return 0;
 }
 }
 
 
-static int opt_vstats(const char *opt, const char *arg)
+static int opt_vstats(void *optctx, const char *opt, const char *arg)
 {
 {
     char filename[40];
     char filename[40];
     time_t today2 = time(NULL);
     time_t today2 = time(NULL);
@@ -1920,7 +1916,7 @@ static int opt_vstats(const char *opt, const char *arg)
 
 
     snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
     snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
              today->tm_sec);
              today->tm_sec);
-    return opt_vstats_file(opt, filename);
+    return opt_vstats_file(NULL, opt, filename);
 }
 }
 
 
 static int opt_video_frames(void *optctx, const char *opt, const char *arg)
 static int opt_video_frames(void *optctx, const char *opt, const char *arg)
@@ -1975,7 +1971,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
         else if (!strcmp(key, "vcodec")) opt_video_codec   (o, key, value);
         else if (!strcmp(key, "vcodec")) opt_video_codec   (o, key, value);
         else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value);
         else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value);
         else if (!strcmp(key, "dcodec")) opt_data_codec    (o, key, value);
         else if (!strcmp(key, "dcodec")) opt_data_codec    (o, key, value);
-        else if (opt_default(key, value) < 0) {
+        else if (opt_default(NULL, key, value) < 0) {
             av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n",
             av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n",
                    filename, line, key, value);
                    filename, line, key, value);
             exit_program(1);
             exit_program(1);
@@ -1987,16 +1983,6 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-static int opt_passlogfile(const char *opt, const char *arg)
-{
-    pass_logfilename_prefix = arg;
-#if CONFIG_LIBX264_ENCODER
-    return opt_default(opt, arg);
-#else
-    return 0;
-#endif
-}
-
 static int opt_old2new(void *optctx, const char *opt, const char *arg)
 static int opt_old2new(void *optctx, const char *opt, const char *arg)
 {
 {
     OptionsContext *o = optctx;
     OptionsContext *o = optctx;
@@ -2013,7 +1999,7 @@ static int opt_bitrate(void *optctx, const char *opt, const char *arg)
         av_log(NULL, AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambiguous\n");
         av_log(NULL, AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambiguous\n");
         return parse_option(o, "b:v", arg, options);
         return parse_option(o, "b:v", arg, options);
     }
     }
-    return opt_default(opt, arg);
+    return opt_default(optctx, opt, arg);
 }
 }
 
 
 static int opt_qscale(void *optctx, const char *opt, const char *arg)
 static int opt_qscale(void *optctx, const char *opt, const char *arg)
@@ -2038,7 +2024,7 @@ static int opt_profile(void *optctx, const char *opt, const char *arg)
         av_log(NULL, AV_LOG_WARNING, "Please use -profile:a or -profile:v, -profile is ambiguous\n");
         av_log(NULL, AV_LOG_WARNING, "Please use -profile:a or -profile:v, -profile is ambiguous\n");
         return parse_option(o, "profile:v", arg, options);
         return parse_option(o, "profile:v", arg, options);
     }
     }
-    return opt_default(opt, arg);
+    return opt_default(optctx, opt, arg);
 
 
 }
 }
 
 
@@ -2054,7 +2040,7 @@ static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
     return parse_option(o, "filter:a", arg, options);
     return parse_option(o, "filter:a", arg, options);
 }
 }
 
 
-static int opt_vsync(const char *opt, const char *arg)
+static int opt_vsync(void *optctx, const char *opt, const char *arg)
 {
 {
     if      (!av_strcasecmp(arg, "cfr"))         video_sync_method = VSYNC_CFR;
     if      (!av_strcasecmp(arg, "cfr"))         video_sync_method = VSYNC_CFR;
     else if (!av_strcasecmp(arg, "vfr"))         video_sync_method = VSYNC_VFR;
     else if (!av_strcasecmp(arg, "vfr"))         video_sync_method = VSYNC_VFR;
@@ -2066,7 +2052,7 @@ static int opt_vsync(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-static int opt_deinterlace(const char *opt, const char *arg)
+static int opt_deinterlace(void *optctx, const char *opt, const char *arg)
 {
 {
     av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt);
     av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt);
     do_deinterlace = 1;
     do_deinterlace = 1;
@@ -2079,7 +2065,7 @@ static int opt_timecode(void *optctx, const char *opt, const char *arg)
     char *tcr = av_asprintf("timecode=%s", arg);
     char *tcr = av_asprintf("timecode=%s", arg);
     int ret = parse_option(o, "metadata:g", tcr, options);
     int ret = parse_option(o, "metadata:g", tcr, options);
     if (ret >= 0)
     if (ret >= 0)
-        ret = opt_default("gop_timecode", arg);
+        ret = opt_default(optctx, "gop_timecode", arg);
     av_free(tcr);
     av_free(tcr);
     return ret;
     return ret;
 }
 }
@@ -2099,7 +2085,7 @@ static int opt_channel_layout(void *optctx, const char *opt, const char *arg)
         return AVERROR(EINVAL);
         return AVERROR(EINVAL);
     }
     }
     snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout);
     snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout);
-    ret = opt_default(opt, layout_str);
+    ret = opt_default(NULL, opt, layout_str);
     if (ret < 0)
     if (ret < 0)
         return ret;
         return ret;
 
 
@@ -2126,7 +2112,7 @@ static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
     return parse_option(o, "q:a", arg, options);
     return parse_option(o, "q:a", arg, options);
 }
 }
 
 
-static int opt_filter_complex(const char *opt, const char *arg)
+static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
 {
 {
     filtergraphs = grow_array(filtergraphs, sizeof(*filtergraphs),
     filtergraphs = grow_array(filtergraphs, sizeof(*filtergraphs),
                               &nb_filtergraphs, nb_filtergraphs + 1);
                               &nb_filtergraphs, nb_filtergraphs + 1);
@@ -2140,7 +2126,7 @@ static int opt_filter_complex(const char *opt, const char *arg)
 void show_help_default(const char *opt, const char *arg)
 void show_help_default(const char *opt, const char *arg)
 {
 {
     /* per-file options have at least one of those set */
     /* per-file options have at least one of those set */
-    const int per_file = OPT_SPEC | OPT_OFFSET | OPT_FUNC2;
+    const int per_file = OPT_SPEC | OPT_OFFSET | OPT_PERFILE;
     int show_advanced = 0, show_avoptions = 0;
     int show_advanced = 0, show_avoptions = 0;
 
 
     if (opt) {
     if (opt) {
@@ -2211,7 +2197,7 @@ void show_usage(void)
 }
 }
 
 
 
 
-static int opt_progress(const char *opt, const char *arg)
+static int opt_progress(void *optctx, const char *opt, const char *arg)
 {
 {
     AVIOContext *avio = NULL;
     AVIOContext *avio = NULL;
     int ret;
     int ret;
@@ -2234,7 +2220,7 @@ const OptionDef options[] = {
 #include "cmdutils_common_opts.h"
 #include "cmdutils_common_opts.h"
     { "f",              HAS_ARG | OPT_STRING | OPT_OFFSET,           { .off       = OFFSET(format) },
     { "f",              HAS_ARG | OPT_STRING | OPT_OFFSET,           { .off       = OFFSET(format) },
         "force format", "fmt" },
         "force format", "fmt" },
-    { "i",              HAS_ARG | OPT_FUNC2,                         { .func2_arg = opt_input_file },
+    { "i",              HAS_ARG | OPT_PERFILE,                       { .func_arg = opt_input_file },
         "input file name", "filename" },
         "input file name", "filename" },
     { "y",              OPT_BOOL,                                    {              &file_overwrite },
     { "y",              OPT_BOOL,                                    {              &file_overwrite },
         "overwrite output files" },
         "overwrite output files" },
@@ -2246,10 +2232,10 @@ const OptionDef options[] = {
         "codec name", "codec" },
         "codec name", "codec" },
     { "pre",            HAS_ARG | OPT_STRING | OPT_SPEC,             { .off       = OFFSET(presets) },
     { "pre",            HAS_ARG | OPT_STRING | OPT_SPEC,             { .off       = OFFSET(presets) },
         "preset name", "preset" },
         "preset name", "preset" },
-    { "map",            HAS_ARG | OPT_EXPERT | OPT_FUNC2,            { .func2_arg = opt_map },
+    { "map",            HAS_ARG | OPT_EXPERT | OPT_PERFILE,          { .func_arg = opt_map },
         "set input stream mapping",
         "set input stream mapping",
         "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
         "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
-    { "map_channel",    HAS_ARG | OPT_EXPERT | OPT_FUNC2,            { .func2_arg = opt_map_channel },
+    { "map_channel",    HAS_ARG | OPT_EXPERT | OPT_PERFILE,          { .func_arg = opt_map_channel },
         "map an audio channel from one stream to another", "file.stream.channel[:syncfile.syncstream]" },
         "map an audio channel from one stream to another", "file.stream.channel[:syncfile.syncstream]" },
     { "map_metadata",   HAS_ARG | OPT_STRING | OPT_SPEC,             { .off       = OFFSET(metadata_map) },
     { "map_metadata",   HAS_ARG | OPT_STRING | OPT_SPEC,             { .off       = OFFSET(metadata_map) },
         "set metadata information of outfile from infile",
         "set metadata information of outfile from infile",
@@ -2267,11 +2253,11 @@ const OptionDef options[] = {
         "set the input ts offset", "time_off" },
         "set the input ts offset", "time_off" },
     { "itsscale",       HAS_ARG | OPT_DOUBLE | OPT_SPEC | OPT_EXPERT,{ .off = OFFSET(ts_scale) },
     { "itsscale",       HAS_ARG | OPT_DOUBLE | OPT_SPEC | OPT_EXPERT,{ .off = OFFSET(ts_scale) },
         "set the input ts scale", "scale" },
         "set the input ts scale", "scale" },
-    { "timestamp",      HAS_ARG | OPT_FUNC2,                         { .func2_arg = opt_recording_timestamp },
+    { "timestamp",      HAS_ARG | OPT_PERFILE,                       { .func_arg = opt_recording_timestamp },
         "set the recording timestamp ('now' to set the current time)", "time" },
         "set the recording timestamp ('now' to set the current time)", "time" },
     { "metadata",       HAS_ARG | OPT_STRING | OPT_SPEC,             { .off = OFFSET(metadata) },
     { "metadata",       HAS_ARG | OPT_STRING | OPT_SPEC,             { .off = OFFSET(metadata) },
         "add metadata", "string=string" },
         "add metadata", "string=string" },
-    { "dframes",        HAS_ARG | OPT_FUNC2 | OPT_EXPERT,            { .func2_arg = opt_data_frames },
+    { "dframes",        HAS_ARG | OPT_PERFILE | OPT_EXPERT,          { .func_arg = opt_data_frames },
         "set the number of data frames to record", "number" },
         "set the number of data frames to record", "number" },
     { "benchmark",      OPT_BOOL | OPT_EXPERT,                       { &do_benchmark },
     { "benchmark",      OPT_BOOL | OPT_EXPERT,                       { &do_benchmark },
         "add timings for benchmarking" },
         "add timings for benchmarking" },
@@ -2289,7 +2275,7 @@ const OptionDef options[] = {
         "when dumping packets, also dump the payload" },
         "when dumping packets, also dump the payload" },
     { "re",             OPT_BOOL | OPT_EXPERT | OPT_OFFSET,          { .off = OFFSET(rate_emu) },
     { "re",             OPT_BOOL | OPT_EXPERT | OPT_OFFSET,          { .off = OFFSET(rate_emu) },
         "read input at native frame rate", "" },
         "read input at native frame rate", "" },
-    { "target",         HAS_ARG | OPT_FUNC2,                         { .func2_arg = opt_target },
+    { "target",         HAS_ARG | OPT_PERFILE,                       { .func_arg = opt_target },
         "specify target file type (\"vcd\", \"svcd\", \"dvd\","
         "specify target file type (\"vcd\", \"svcd\", \"dvd\","
         " \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
         " \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
     { "vsync",          HAS_ARG | OPT_EXPERT,                        { opt_vsync },
     { "vsync",          HAS_ARG | OPT_EXPERT,                        { opt_vsync },
@@ -2318,9 +2304,9 @@ const OptionDef options[] = {
         "force codec tag/fourcc", "fourcc/tag" },
         "force codec tag/fourcc", "fourcc/tag" },
     { "q",              HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC,{ .off = OFFSET(qscale) },
     { "q",              HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC,{ .off = OFFSET(qscale) },
         "use fixed quality scale (VBR)", "q" },
         "use fixed quality scale (VBR)", "q" },
-    { "qscale",         HAS_ARG | OPT_EXPERT | OPT_FUNC2,            { .func2_arg = opt_qscale },
+    { "qscale",         HAS_ARG | OPT_EXPERT | OPT_PERFILE,          { .func_arg = opt_qscale },
         "use fixed quality scale (VBR)", "q" },
         "use fixed quality scale (VBR)", "q" },
-    { "profile",        HAS_ARG | OPT_EXPERT | OPT_FUNC2,            { .func2_arg = opt_profile },
+    { "profile",        HAS_ARG | OPT_EXPERT | OPT_PERFILE,          { .func_arg = opt_profile },
         "set profile", "profile" },
         "set profile", "profile" },
     { "filter",         HAS_ARG | OPT_STRING | OPT_SPEC,             { .off = OFFSET(filters) },
     { "filter",         HAS_ARG | OPT_STRING | OPT_SPEC,             { .off = OFFSET(filters) },
         "set stream filterchain", "filter_list" },
         "set stream filterchain", "filter_list" },
@@ -2328,7 +2314,7 @@ const OptionDef options[] = {
         "create a complex filtergraph", "graph_description" },
         "create a complex filtergraph", "graph_description" },
     { "stats",          OPT_BOOL,                                    { &print_stats },
     { "stats",          OPT_BOOL,                                    { &print_stats },
         "print progress report during encoding", },
         "print progress report during encoding", },
-    { "attach",         HAS_ARG | OPT_FUNC2 | OPT_EXPERT,            { .func2_arg = opt_attach },
+    { "attach",         HAS_ARG | OPT_PERFILE | OPT_EXPERT,          { .func_arg = opt_attach },
         "add an attachment to the output file", "filename" },
         "add an attachment to the output file", "filename" },
     { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |OPT_EXPERT,{ .off = OFFSET(dump_attachment) },
     { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |OPT_EXPERT,{ .off = OFFSET(dump_attachment) },
         "extract an attachment into a file", "filename" },
         "extract an attachment into a file", "filename" },
@@ -2336,7 +2322,7 @@ const OptionDef options[] = {
         "print timestamp debugging info" },
         "print timestamp debugging info" },
 
 
     /* video options */
     /* video options */
-    { "vframes",      OPT_VIDEO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_video_frames },
+    { "vframes",      OPT_VIDEO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_video_frames },
         "set the number of video frames to record", "number" },
         "set the number of video frames to record", "number" },
     { "r",            OPT_VIDEO | HAS_ARG  | OPT_STRING | OPT_SPEC,              { .off = OFFSET(frame_rates) },
     { "r",            OPT_VIDEO | HAS_ARG  | OPT_STRING | OPT_SPEC,              { .off = OFFSET(frame_rates) },
         "set frame rate (Hz value, fraction or abbreviation)", "rate" },
         "set frame rate (Hz value, fraction or abbreviation)", "rate" },
@@ -2374,17 +2360,17 @@ const OptionDef options[] = {
         "discard threshold", "n" },
         "discard threshold", "n" },
     { "rc_override",  OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_STRING | OPT_SPEC, { .off = OFFSET(rc_overrides) },
     { "rc_override",  OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_STRING | OPT_SPEC, { .off = OFFSET(rc_overrides) },
         "rate control override for specific intervals", "override" },
         "rate control override for specific intervals", "override" },
-    { "vcodec",       OPT_VIDEO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_video_codec },
+    { "vcodec",       OPT_VIDEO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_video_codec },
         "force video codec ('copy' to copy stream)", "codec" },
         "force video codec ('copy' to copy stream)", "codec" },
     { "sameq",        OPT_VIDEO | OPT_BOOL | OPT_EXPERT ,                        { &same_quant },
     { "sameq",        OPT_VIDEO | OPT_BOOL | OPT_EXPERT ,                        { &same_quant },
         "use same quantizer as source (implies VBR)" },
         "use same quantizer as source (implies VBR)" },
     { "same_quant",   OPT_VIDEO | OPT_BOOL | OPT_EXPERT,                         { &same_quant },
     { "same_quant",   OPT_VIDEO | OPT_BOOL | OPT_EXPERT,                         { &same_quant },
         "use same quantizer as source (implies VBR)" },
         "use same quantizer as source (implies VBR)" },
-    { "timecode",     OPT_VIDEO | HAS_ARG | OPT_FUNC2,                           { .func2_arg = opt_timecode },
+    { "timecode",     OPT_VIDEO | HAS_ARG | OPT_PERFILE,                         { .func_arg = opt_timecode },
         "set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
         "set initial TimeCode value.", "hh:mm:ss[:;.]ff" },
-    { "pass",         OPT_VIDEO | HAS_ARG ,                                      { opt_pass },
-        "select the pass number (1 or 2)", "n" },
-    { "passlogfile",  OPT_VIDEO | HAS_ARG,                                       { .func_arg = &opt_passlogfile },
+    { "pass",         OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT,                  { .off = OFFSET(pass) },
+        "select the pass number (1 to 3)", "n" },
+    { "passlogfile",  OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC,  { .off = OFFSET(passlogfiles) },
         "select two pass log file name prefix", "prefix" },
         "select two pass log file name prefix", "prefix" },
     { "deinterlace",  OPT_VIDEO | OPT_EXPERT ,                                   { .func_arg = opt_deinterlace },
     { "deinterlace",  OPT_VIDEO | OPT_EXPERT ,                                   { .func_arg = opt_deinterlace },
         "this option is deprecated, use the yadif filter instead" },
         "this option is deprecated, use the yadif filter instead" },
@@ -2394,7 +2380,7 @@ const OptionDef options[] = {
         "dump video coding statistics to file" },
         "dump video coding statistics to file" },
     { "vstats_file",  OPT_VIDEO | HAS_ARG | OPT_EXPERT ,                         { opt_vstats_file },
     { "vstats_file",  OPT_VIDEO | HAS_ARG | OPT_EXPERT ,                         { opt_vstats_file },
         "dump video coding statistics to file", "file" },
         "dump video coding statistics to file", "file" },
-    { "vf",           OPT_VIDEO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_video_filters },
+    { "vf",           OPT_VIDEO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_video_filters },
         "video filters", "filter list" },
         "video filters", "filter list" },
     { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_STRING | OPT_SPEC, { .off = OFFSET(intra_matrices) },
     { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_STRING | OPT_SPEC, { .off = OFFSET(intra_matrices) },
         "specify intra matrix coeffs", "matrix" },
         "specify intra matrix coeffs", "matrix" },
@@ -2404,24 +2390,24 @@ const OptionDef options[] = {
         "top=1/bottom=0/auto=-1 field first", "" },
         "top=1/bottom=0/auto=-1 field first", "" },
     { "dc",           OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT ,               { &intra_dc_precision },
     { "dc",           OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT ,               { &intra_dc_precision },
         "intra_dc_precision", "precision" },
         "intra_dc_precision", "precision" },
-    { "vtag",         OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_FUNC2,             { .func2_arg = opt_old2new },
+    { "vtag",         OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_PERFILE,           { .func_arg = opt_old2new },
         "force video tag/fourcc", "fourcc/tag" },
         "force video tag/fourcc", "fourcc/tag" },
     { "qphist",       OPT_VIDEO | OPT_BOOL | OPT_EXPERT ,                        { &qp_hist },
     { "qphist",       OPT_VIDEO | OPT_BOOL | OPT_EXPERT ,                        { &qp_hist },
         "show QP histogram" },
         "show QP histogram" },
     { "force_fps",    OPT_VIDEO | OPT_BOOL | OPT_EXPERT  | OPT_SPEC,             { .off = OFFSET(force_fps) },
     { "force_fps",    OPT_VIDEO | OPT_BOOL | OPT_EXPERT  | OPT_SPEC,             { .off = OFFSET(force_fps) },
         "force the selected framerate, disable the best supported framerate selection" },
         "force the selected framerate, disable the best supported framerate selection" },
-    { "streamid",     OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_FUNC2,              { .func2_arg = opt_streamid },
+    { "streamid",     OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE,            { .func_arg = opt_streamid },
         "set the value of an outfile streamid", "streamIndex:value" },
         "set the value of an outfile streamid", "streamIndex:value" },
     { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT  | OPT_SPEC,
     { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT  | OPT_SPEC,
         { .off = OFFSET(forced_key_frames) },
         { .off = OFFSET(forced_key_frames) },
         "force key frames at specified timestamps", "timestamps" },
         "force key frames at specified timestamps", "timestamps" },
-    { "b",            OPT_VIDEO | HAS_ARG | OPT_FUNC2,                           { .func2_arg = opt_bitrate },
+    { "b",            OPT_VIDEO | HAS_ARG | OPT_PERFILE,                         { .func_arg = opt_bitrate },
         "video bitrate (please use -b:v)", "bitrate" },
         "video bitrate (please use -b:v)", "bitrate" },
 
 
     /* audio options */
     /* audio options */
-    { "aframes",        OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_frames },
+    { "aframes",        OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_frames },
         "set the number of audio frames to record", "number" },
         "set the number of audio frames to record", "number" },
-    { "aq",             OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_qscale },
+    { "aq",             OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_qscale },
         "set audio quality (codec-specific)", "quality", },
         "set audio quality (codec-specific)", "quality", },
     { "ar",             OPT_AUDIO | HAS_ARG  | OPT_INT | OPT_SPEC,                 { .off = OFFSET(audio_sample_rate) },
     { "ar",             OPT_AUDIO | HAS_ARG  | OPT_INT | OPT_SPEC,                 { .off = OFFSET(audio_sample_rate) },
         "set audio sampling rate (in Hz)", "rate" },
         "set audio sampling rate (in Hz)", "rate" },
@@ -2429,26 +2415,26 @@ const OptionDef options[] = {
         "set number of audio channels", "channels" },
         "set number of audio channels", "channels" },
     { "an",             OPT_AUDIO | OPT_BOOL | OPT_OFFSET,                         { .off = OFFSET(audio_disable) },
     { "an",             OPT_AUDIO | OPT_BOOL | OPT_OFFSET,                         { .off = OFFSET(audio_disable) },
         "disable audio" },
         "disable audio" },
-    { "acodec",         OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_codec },
+    { "acodec",         OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_codec },
         "force audio codec ('copy' to copy stream)", "codec" },
         "force audio codec ('copy' to copy stream)", "codec" },
-    { "atag",           OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_FUNC2,             { .func2_arg = opt_old2new },
+    { "atag",           OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE,           { .func_arg = opt_old2new },
         "force audio tag/fourcc", "fourcc/tag" },
         "force audio tag/fourcc", "fourcc/tag" },
     { "vol",            OPT_AUDIO | HAS_ARG  | OPT_INT,                            { &audio_volume },
     { "vol",            OPT_AUDIO | HAS_ARG  | OPT_INT,                            { &audio_volume },
         "change audio volume (256=normal)" , "volume" },
         "change audio volume (256=normal)" , "volume" },
     { "sample_fmt",     OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_SPEC | OPT_STRING, { .off = OFFSET(sample_fmts) },
     { "sample_fmt",     OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_SPEC | OPT_STRING, { .off = OFFSET(sample_fmts) },
         "set sample format", "format" },
         "set sample format", "format" },
-    { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_FUNC2,             { .func2_arg = opt_channel_layout },
+    { "channel_layout", OPT_AUDIO | HAS_ARG  | OPT_EXPERT | OPT_PERFILE,           { .func_arg = opt_channel_layout },
         "set channel layout", "layout" },
         "set channel layout", "layout" },
-    { "af",             OPT_AUDIO | HAS_ARG  | OPT_FUNC2,                          { .func2_arg = opt_audio_filters },
+    { "af",             OPT_AUDIO | HAS_ARG  | OPT_PERFILE,                        { .func_arg = opt_audio_filters },
         "audio filters", "filter list" },
         "audio filters", "filter list" },
 
 
     /* subtitle options */
     /* subtitle options */
     { "sn",     OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) },
     { "sn",     OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) },
         "disable subtitle" },
         "disable subtitle" },
-    { "scodec", OPT_SUBTITLE | HAS_ARG  | OPT_FUNC2,  { .func2_arg = opt_subtitle_codec },
+    { "scodec", OPT_SUBTITLE | HAS_ARG  | OPT_PERFILE, { .func_arg = opt_subtitle_codec },
         "force subtitle codec ('copy' to copy stream)", "codec" },
         "force subtitle codec ('copy' to copy stream)", "codec" },
-    { "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE | OPT_FUNC2, { .func2_arg = opt_old2new },
-        "force subtitle tag/fourcc", "fourcc/tag" },
+    { "stag",   OPT_SUBTITLE | HAS_ARG  | OPT_EXPERT  | OPT_PERFILE, { .func_arg = opt_old2new }
+        , "force subtitle tag/fourcc", "fourcc/tag" },
     { "fix_sub_duration", OPT_BOOL | OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC, { .off = OFFSET(fix_sub_duration) },
     { "fix_sub_duration", OPT_BOOL | OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC, { .off = OFFSET(fix_sub_duration) },
         "fix subtitles duration" },
         "fix subtitles duration" },
 
 
@@ -2467,21 +2453,21 @@ const OptionDef options[] = {
 
 
     { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT, { .off = OFFSET(bitstream_filters) },
     { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT, { .off = OFFSET(bitstream_filters) },
         "A comma-separated list of bitstream filters", "bitstream_filters" },
         "A comma-separated list of bitstream filters", "bitstream_filters" },
-    { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_FUNC2, { .func2_arg = opt_old2new },
+    { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE, { .func_arg = opt_old2new },
         "deprecated", "audio bitstream_filters" },
         "deprecated", "audio bitstream_filters" },
-    { "vbsf", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_FUNC2, { .func2_arg = opt_old2new },
+    { "vbsf", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE, { .func_arg = opt_old2new },
         "deprecated", "video bitstream_filters" },
         "deprecated", "video bitstream_filters" },
 
 
-    { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_FUNC2, { .func2_arg = opt_preset },
+    { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE,    { .func_arg = opt_preset },
         "set the audio options to the indicated preset", "preset" },
         "set the audio options to the indicated preset", "preset" },
-    { "vpre", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_FUNC2, { .func2_arg = opt_preset },
+    { "vpre", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE,    { .func_arg = opt_preset },
         "set the video options to the indicated preset", "preset" },
         "set the video options to the indicated preset", "preset" },
-    { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_FUNC2, { .func2_arg = opt_preset },
+    { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE, { .func_arg = opt_preset },
         "set the subtitle options to the indicated preset", "preset" },
         "set the subtitle options to the indicated preset", "preset" },
-    { "fpre", HAS_ARG | OPT_EXPERT| OPT_FUNC2, { .func2_arg = opt_preset },
+    { "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE,                { .func_arg = opt_preset },
         "set options from indicated preset file", "filename" },
         "set options from indicated preset file", "filename" },
     /* data codec support */
     /* data codec support */
-    { "dcodec", HAS_ARG | OPT_DATA | OPT_FUNC2 | OPT_EXPERT, { .func2_arg = opt_data_codec },
+    { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_data_codec },
         "force data codec ('copy' to copy stream)", "codec" },
         "force data codec ('copy' to copy stream)", "codec" },
     { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET, { .off = OFFSET(data_disable) },
     { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET, { .off = OFFSET(data_disable) },
         "disable data" },
         "disable data" },

+ 4 - 4
ffplay.c

@@ -2884,7 +2884,7 @@ static void event_loop(VideoState *cur_stream)
 static int opt_frame_size(const char *opt, const char *arg)
 static int opt_frame_size(const char *opt, const char *arg)
 {
 {
     av_log(NULL, AV_LOG_WARNING, "Option -s is deprecated, use -video_size.\n");
     av_log(NULL, AV_LOG_WARNING, "Option -s is deprecated, use -video_size.\n");
-    return opt_default("video_size", arg);
+    return opt_default(NULL, "video_size", arg);
 }
 }
 
 
 static int opt_width(const char *opt, const char *arg)
 static int opt_width(const char *opt, const char *arg)
@@ -2912,7 +2912,7 @@ static int opt_format(const char *opt, const char *arg)
 static int opt_frame_pix_fmt(const char *opt, const char *arg)
 static int opt_frame_pix_fmt(const char *opt, const char *arg)
 {
 {
     av_log(NULL, AV_LOG_WARNING, "Option -pix_fmt is deprecated, use -pixel_format.\n");
     av_log(NULL, AV_LOG_WARNING, "Option -pix_fmt is deprecated, use -pixel_format.\n");
-    return opt_default("pixel_format", arg);
+    return opt_default(NULL, "pixel_format", arg);
 }
 }
 
 
 static int opt_sync(const char *opt, const char *arg)
 static int opt_sync(const char *opt, const char *arg)
@@ -2936,7 +2936,7 @@ static int opt_seek(const char *opt, const char *arg)
     return 0;
     return 0;
 }
 }
 
 
-static int opt_duration(const char *opt, const char *arg)
+static int opt_duration(void *optctx, const char *opt, const char *arg)
 {
 {
     duration = parse_time_or_die(opt, arg, 1);
     duration = parse_time_or_die(opt, arg, 1);
     return 0;
     return 0;
@@ -3018,7 +3018,7 @@ static const OptionDef options[] = {
     { "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
     { "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
     { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { (void*)opt_default }, "generic catch all option", "" },
     { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { (void*)opt_default }, "generic catch all option", "" },
     { "i", OPT_BOOL, {(void *)&dummy}, "read specified file", "input_file"},
     { "i", OPT_BOOL, {(void *)&dummy}, "read specified file", "input_file"},
-    { "codec", HAS_ARG | OPT_FUNC2, {(void*)opt_codec}, "force decoder", "decoder" },
+    { "codec", HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder" },
     { NULL, },
     { NULL, },
 };
 };
 
 

Some files were not shown because too many files changed in this diff