Commit f825d42b authored by Luca Barbato's avatar Luca Barbato

avplay: Accept cpuflags option

Quite useful for debugging.
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent ea71aafd
...@@ -356,8 +356,6 @@ extern const OptionDef options[]; ...@@ -356,8 +356,6 @@ extern const OptionDef options[];
void reset_options(OptionsContext *o); void reset_options(OptionsContext *o);
void show_usage(void); void show_usage(void);
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
void opt_output_file(void *optctx, const char *filename); void opt_output_file(void *optctx, const char *filename);
void assert_avoptions(AVDictionary *m); void assert_avoptions(AVDictionary *m);
......
...@@ -1876,17 +1876,6 @@ static int opt_vsync(void *optctx, const char *opt, const char *arg) ...@@ -1876,17 +1876,6 @@ static int opt_vsync(void *optctx, const char *opt, const char *arg)
return 0; return 0;
} }
int opt_cpuflags(void *optctx, const char *opt, const char *arg)
{
int flags = av_parse_cpu_flags(arg);
if (flags < 0)
return flags;
av_set_cpu_flags_mask(flags);
return 0;
}
static int opt_channel_layout(void *optctx, const char *opt, const char *arg) static int opt_channel_layout(void *optctx, const char *opt, const char *arg)
{ {
OptionsContext *o = optctx; OptionsContext *o = optctx;
...@@ -2231,8 +2220,6 @@ const OptionDef options[] = { ...@@ -2231,8 +2220,6 @@ const OptionDef options[] = {
{ "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC | { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) }, OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) },
"extract an attachment into a file", "filename" }, "extract an attachment into a file", "filename" },
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags },
"set CPU flags mask", "mask" },
/* video options */ /* video options */
{ "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames }, { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames },
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "libavutil/eval.h" #include "libavutil/eval.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/cpu.h"
#include "cmdutils.h" #include "cmdutils.h"
#include "version.h" #include "version.h"
#if CONFIG_NETWORK #if CONFIG_NETWORK
...@@ -694,6 +695,17 @@ do { \ ...@@ -694,6 +695,17 @@ do { \
return 0; return 0;
} }
int opt_cpuflags(void *optctx, const char *opt, const char *arg)
{
int flags = av_parse_cpu_flags(arg);
if (flags < 0)
return flags;
av_set_cpu_flags_mask(flags);
return 0;
}
int opt_loglevel(void *optctx, 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[] = {
......
...@@ -71,6 +71,11 @@ void uninit_opts(void); ...@@ -71,6 +71,11 @@ void uninit_opts(void);
*/ */
void log_callback_help(void* ptr, int level, const char* fmt, va_list vl); void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
/**
* Override the cpuflags mask.
*/
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
/** /**
* 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.
......
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
{ "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" }, { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
{ "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" }, { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" },
{ "v", HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" }, { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" },
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "set CPU flags mask", "mask" },
...@@ -788,10 +788,6 @@ avconv -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt ...@@ -788,10 +788,6 @@ avconv -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt
@item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{output,per-stream}) @item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{output,per-stream})
Force a tag/fourcc for matching streams. Force a tag/fourcc for matching streams.
@item -cpuflags mask (@emph{global})
Set a mask that's applied to autodetected CPU flags. This option is intended
for testing. Do not use it unless you know what you're doing.
@item -filter_complex @var{filtergraph} (@emph{global}) @item -filter_complex @var{filtergraph} (@emph{global})
Define a complex filter graph, i.e. one with arbitrary number of inputs and/or Define a complex filter graph, i.e. one with arbitrary number of inputs and/or
outputs. For simple graphs -- those with one input and one output of the same outputs. For simple graphs -- those with one input and one output of the same
......
...@@ -143,6 +143,10 @@ the environment variable @env{AV_LOG_FORCE_COLOR}. ...@@ -143,6 +143,10 @@ the environment variable @env{AV_LOG_FORCE_COLOR}.
The use of the environment variable @env{NO_COLOR} is deprecated and The use of the environment variable @env{NO_COLOR} is deprecated and
will be dropped in a following Libav version. will be dropped in a following Libav version.
@item -cpuflags mask (@emph{global})
Set a mask that's applied to autodetected CPU flags. This option is intended
for testing. Do not use it unless you know what you're doing.
@end table @end table
@section AVOptions @section AVOptions
......
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