Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7a6cd995
Commit
7a6cd995
authored
Oct 04, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmdutils/avtools: simplify show_help() by using av_opt_child_class_next()
parent
145f741e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
55 deletions
+24
-55
avconv.c
avconv.c
+4
-40
avplay.c
avplay.c
+3
-12
avprobe.c
avprobe.c
+1
-3
cmdutils.c
cmdutils.c
+10
-0
cmdutils.h
cmdutils.h
+6
-0
No files found.
avconv.c
View file @
7a6cd995
...
@@ -3676,11 +3676,7 @@ static void show_usage(void)
...
@@ -3676,11 +3676,7 @@ static void show_usage(void)
static
void
show_help
(
void
)
static
void
show_help
(
void
)
{
{
AVCodec
*
c
;
int
flags
=
AV_OPT_FLAG_DECODING_PARAM
|
AV_OPT_FLAG_ENCODING_PARAM
;
AVOutputFormat
*
oformat
=
NULL
;
AVInputFormat
*
iformat
=
NULL
;
const
AVClass
*
class
;
av_log_set_callback
(
log_callback_help
);
av_log_set_callback
(
log_callback_help
);
show_usage
();
show_usage
();
show_help_options
(
options
,
"Main options:
\n
"
,
show_help_options
(
options
,
"Main options:
\n
"
,
...
@@ -3707,41 +3703,9 @@ static void show_help(void)
...
@@ -3707,41 +3703,9 @@ static void show_help(void)
OPT_GRAB
,
OPT_GRAB
,
OPT_GRAB
);
OPT_GRAB
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
class
=
avcodec_get_class
();
show_help_children
(
avcodec_get_class
(),
flags
);
av_opt_show2
(
&
class
,
NULL
,
AV_OPT_FLAG_ENCODING_PARAM
|
AV_OPT_FLAG_DECODING_PARAM
,
0
);
show_help_children
(
avformat_get_class
(),
flags
);
printf
(
"
\n
"
);
show_help_children
(
sws_get_class
(),
flags
);
/* individual codec options */
c
=
NULL
;
while
((
c
=
av_codec_next
(
c
)))
{
if
(
c
->
priv_class
)
{
av_opt_show2
(
&
c
->
priv_class
,
NULL
,
AV_OPT_FLAG_ENCODING_PARAM
|
AV_OPT_FLAG_DECODING_PARAM
,
0
);
printf
(
"
\n
"
);
}
}
class
=
avformat_get_class
();
av_opt_show2
(
&
class
,
NULL
,
AV_OPT_FLAG_ENCODING_PARAM
|
AV_OPT_FLAG_DECODING_PARAM
,
0
);
printf
(
"
\n
"
);
/* individual muxer options */
while
((
oformat
=
av_oformat_next
(
oformat
)))
{
if
(
oformat
->
priv_class
)
{
av_opt_show2
(
&
oformat
->
priv_class
,
NULL
,
AV_OPT_FLAG_ENCODING_PARAM
,
0
);
printf
(
"
\n
"
);
}
}
/* individual demuxer options */
while
((
iformat
=
av_iformat_next
(
iformat
)))
{
if
(
iformat
->
priv_class
)
{
av_opt_show2
(
&
iformat
->
priv_class
,
NULL
,
AV_OPT_FLAG_DECODING_PARAM
,
0
);
printf
(
"
\n
"
);
}
}
class
=
sws_get_class
();
av_opt_show2
(
&
class
,
NULL
,
AV_OPT_FLAG_ENCODING_PARAM
|
AV_OPT_FLAG_DECODING_PARAM
,
0
);
}
}
static
int
opt_target
(
OptionsContext
*
o
,
const
char
*
opt
,
const
char
*
arg
)
static
int
opt_target
(
OptionsContext
*
o
,
const
char
*
opt
,
const
char
*
arg
)
...
...
avplay.c
View file @
7a6cd995
...
@@ -2996,7 +2996,6 @@ static void show_usage(void)
...
@@ -2996,7 +2996,6 @@ static void show_usage(void)
static
void
show_help
(
void
)
static
void
show_help
(
void
)
{
{
const
AVClass
*
class
;
av_log_set_callback
(
log_callback_help
);
av_log_set_callback
(
log_callback_help
);
show_usage
();
show_usage
();
show_help_options
(
options
,
"Main options:
\n
"
,
show_help_options
(
options
,
"Main options:
\n
"
,
...
@@ -3004,18 +3003,10 @@ static void show_help(void)
...
@@ -3004,18 +3003,10 @@ static void show_help(void)
show_help_options
(
options
,
"
\n
Advanced options:
\n
"
,
show_help_options
(
options
,
"
\n
Advanced options:
\n
"
,
OPT_EXPERT
,
OPT_EXPERT
);
OPT_EXPERT
,
OPT_EXPERT
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
class
=
avcodec_get_class
();
show_help_children
(
avcodec_get_class
(),
AV_OPT_FLAG_DECODING_PARAM
);
av_opt_show2
(
&
class
,
NULL
,
show_help_children
(
avformat_get_class
(),
AV_OPT_FLAG_DECODING_PARAM
);
AV_OPT_FLAG_DECODING_PARAM
,
0
);
printf
(
"
\n
"
);
class
=
avformat_get_class
();
av_opt_show2
(
&
class
,
NULL
,
AV_OPT_FLAG_DECODING_PARAM
,
0
);
#if !CONFIG_AVFILTER
#if !CONFIG_AVFILTER
printf
(
"
\n
"
);
show_help_children
(
sws_get_class
(),
AV_OPT_FLAG_ENCODING_PARAM
);
class
=
sws_get_class
();
av_opt_show2
(
&
class
,
NULL
,
AV_OPT_FLAG_ENCODING_PARAM
,
0
);
#endif
#endif
printf
(
"
\n
While playing:
\n
"
printf
(
"
\n
While playing:
\n
"
"q, ESC quit
\n
"
"q, ESC quit
\n
"
...
...
avprobe.c
View file @
7a6cd995
...
@@ -360,13 +360,11 @@ static void opt_input_file(void *optctx, const char *arg)
...
@@ -360,13 +360,11 @@ static void opt_input_file(void *optctx, const char *arg)
static
void
show_help
(
void
)
static
void
show_help
(
void
)
{
{
const
AVClass
*
class
=
avformat_get_class
();
av_log_set_callback
(
log_callback_help
);
av_log_set_callback
(
log_callback_help
);
show_usage
();
show_usage
();
show_help_options
(
options
,
"Main options:
\n
"
,
0
,
0
);
show_help_options
(
options
,
"Main options:
\n
"
,
0
,
0
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
av_opt_show2
(
&
class
,
NULL
,
show_help_children
(
avformat_get_class
(),
AV_OPT_FLAG_DECODING_PARAM
);
AV_OPT_FLAG_DECODING_PARAM
,
0
);
}
}
static
void
opt_pretty
(
void
)
static
void
opt_pretty
(
void
)
...
...
cmdutils.c
View file @
7a6cd995
...
@@ -130,6 +130,16 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
...
@@ -130,6 +130,16 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
}
}
}
}
void
show_help_children
(
const
AVClass
*
class
,
int
flags
)
{
const
AVClass
*
child
=
NULL
;
av_opt_show2
(
&
class
,
NULL
,
flags
,
0
);
printf
(
"
\n
"
);
while
(
child
=
av_opt_child_class_next
(
class
,
child
))
show_help_children
(
child
,
flags
);
}
static
const
OptionDef
*
find_option
(
const
OptionDef
*
po
,
const
char
*
name
){
static
const
OptionDef
*
find_option
(
const
OptionDef
*
po
,
const
char
*
name
){
const
char
*
p
=
strchr
(
name
,
':'
);
const
char
*
p
=
strchr
(
name
,
':'
);
int
len
=
p
?
p
-
name
:
strlen
(
name
);
int
len
=
p
?
p
-
name
:
strlen
(
name
);
...
...
cmdutils.h
View file @
7a6cd995
...
@@ -154,6 +154,12 @@ typedef struct {
...
@@ -154,6 +154,12 @@ typedef struct {
void
show_help_options
(
const
OptionDef
*
options
,
const
char
*
msg
,
int
mask
,
int
value
);
void
show_help_options
(
const
OptionDef
*
options
,
const
char
*
msg
,
int
mask
,
int
value
);
/**
* Show help for all options with given flags in class and all its
* children.
*/
void
show_help_children
(
const
AVClass
*
class
,
int
flags
);
/**
/**
* Parse the command line arguments.
* Parse the command line arguments.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment