Commit af4b1c02 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '77bd1bc7'

* commit '77bd1bc7':
  avconv: use new options parser.

Conflicts:
	ffmpeg.c
	ffmpeg.h
	ffmpeg_opt.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 52b86647 77bd1bc7
...@@ -568,6 +568,7 @@ static void finish_group(OptionParseContext *octx, int group_idx, ...@@ -568,6 +568,7 @@ static void finish_group(OptionParseContext *octx, int group_idx,
#if CONFIG_SWSCALE #if CONFIG_SWSCALE
g->sws_opts = sws_opts; g->sws_opts = sws_opts;
#endif #endif
g->swr_opts = swr_opts;
g->codec_opts = codec_opts; g->codec_opts = codec_opts;
g->format_opts = format_opts; g->format_opts = format_opts;
...@@ -576,6 +577,7 @@ static void finish_group(OptionParseContext *octx, int group_idx, ...@@ -576,6 +577,7 @@ static void finish_group(OptionParseContext *octx, int group_idx,
#if CONFIG_SWSCALE #if CONFIG_SWSCALE
sws_opts = NULL; sws_opts = NULL;
#endif #endif
swr_opts = NULL;
init_opts(); init_opts();
memset(&octx->cur_group, 0, sizeof(octx->cur_group)); memset(&octx->cur_group, 0, sizeof(octx->cur_group));
...@@ -635,6 +637,8 @@ void uninit_parse_context(OptionParseContext *octx) ...@@ -635,6 +637,8 @@ void uninit_parse_context(OptionParseContext *octx)
#if CONFIG_SWSCALE #if CONFIG_SWSCALE
sws_freeContext(l->groups[j].sws_opts); sws_freeContext(l->groups[j].sws_opts);
#endif #endif
if(CONFIG_SWRESAMPLE)
swr_free(&l->groups[j].swr_opts);
} }
av_freep(&l->groups); av_freep(&l->groups);
} }
......
...@@ -254,6 +254,7 @@ typedef struct OptionGroup { ...@@ -254,6 +254,7 @@ typedef struct OptionGroup {
AVDictionary *codec_opts; AVDictionary *codec_opts;
AVDictionary *format_opts; AVDictionary *format_opts;
struct SwsContext *sws_opts; struct SwsContext *sws_opts;
struct SwrContext *swr_opts;
} OptionGroup; } OptionGroup;
/** /**
......
...@@ -3152,22 +3152,13 @@ static void log_callback_null(void *ptr, int level, const char *fmt, va_list vl) ...@@ -3152,22 +3152,13 @@ static void log_callback_null(void *ptr, int level, const char *fmt, va_list vl)
{ {
} }
static void parse_cpuflags(int argc, char **argv, const OptionDef *options)
{
int idx = locate_option(argc, argv, options, "cpuflags");
if (idx && argv[idx + 1])
opt_cpuflags(NULL, "cpuflags", argv[idx + 1]);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
OptionsContext o = { 0 }; int ret;
int64_t ti; int64_t ti;
atexit(exit_program); atexit(exit_program);
reset_options(&o, 0);
setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */ setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */
av_log_set_flags(AV_LOG_SKIP_REPEATED); av_log_set_flags(AV_LOG_SKIP_REPEATED);
...@@ -3192,10 +3183,10 @@ int main(int argc, char **argv) ...@@ -3192,10 +3183,10 @@ int main(int argc, char **argv)
term_init(); term_init();
parse_cpuflags(argc, argv, options); /* parse options and open all input/output files */
ret = ffmpeg_parse_options(argc, argv);
/* parse options */ if (ret < 0)
parse_options(&o, argc, argv, options, opt_output_file); exit(1);
if (nb_output_files <= 0 && nb_input_files == 0) { if (nb_output_files <= 0 && nb_input_files == 0) {
show_usage(); show_usage();
......
...@@ -71,6 +71,8 @@ typedef struct { ...@@ -71,6 +71,8 @@ typedef struct {
} AudioChannelMap; } AudioChannelMap;
typedef struct OptionsContext { typedef struct OptionsContext {
OptionGroup *g;
/* input/output options */ /* input/output options */
int64_t start_time; int64_t start_time;
const char *format; const char *format;
...@@ -413,4 +415,6 @@ int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOu ...@@ -413,4 +415,6 @@ int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOu
int ist_in_filtergraph(FilterGraph *fg, InputStream *ist); int ist_in_filtergraph(FilterGraph *fg, InputStream *ist);
FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost); FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost);
int ffmpeg_parse_options(int argc, char **argv);
#endif /* FFMPEG_H */ #endif /* FFMPEG_H */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment