Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
a3ad68d3
Commit
a3ad68d3
authored
Aug 13, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmdutils: extend -h to allow printing codec details.
parent
7c501212
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
172 additions
and
32 deletions
+172
-32
avconv_filter.c
avconv_filter.c
+0
-14
avconv_opt.c
avconv_opt.c
+2
-3
avplay.c
avplay.c
+1
-5
avprobe.c
avprobe.c
+1
-2
avserver.c
avserver.c
+1
-1
cmdutils.c
cmdutils.c
+119
-1
cmdutils.h
cmdutils.h
+30
-0
cmdutils_common_opts.h
cmdutils_common_opts.h
+4
-4
avtools-common-opts.texi
doc/avtools-common-opts.texi
+14
-2
No files found.
avconv_filter.c
View file @
a3ad68d3
...
@@ -59,29 +59,15 @@ static char *choose_ ## var ## s(OutputStream *ost) \
...
@@ -59,29 +59,15 @@ static char *choose_ ## var ## s(OutputStream *ost) \
return NULL; \
return NULL; \
}
}
#define GET_PIX_FMT_NAME(pix_fmt)\
const char *name = av_get_pix_fmt_name(pix_fmt);
DEF_CHOOSE_FORMAT
(
enum
PixelFormat
,
pix_fmt
,
pix_fmts
,
PIX_FMT_NONE
,
DEF_CHOOSE_FORMAT
(
enum
PixelFormat
,
pix_fmt
,
pix_fmts
,
PIX_FMT_NONE
,
GET_PIX_FMT_NAME
,
":"
)
GET_PIX_FMT_NAME
,
":"
)
#define GET_SAMPLE_FMT_NAME(sample_fmt)\
const char *name = av_get_sample_fmt_name(sample_fmt)
DEF_CHOOSE_FORMAT
(
enum
AVSampleFormat
,
sample_fmt
,
sample_fmts
,
DEF_CHOOSE_FORMAT
(
enum
AVSampleFormat
,
sample_fmt
,
sample_fmts
,
AV_SAMPLE_FMT_NONE
,
GET_SAMPLE_FMT_NAME
,
","
)
AV_SAMPLE_FMT_NONE
,
GET_SAMPLE_FMT_NAME
,
","
)
#define GET_SAMPLE_RATE_NAME(rate)\
char name[16];\
snprintf(name, sizeof(name), "%d", rate);
DEF_CHOOSE_FORMAT
(
int
,
sample_rate
,
supported_samplerates
,
0
,
DEF_CHOOSE_FORMAT
(
int
,
sample_rate
,
supported_samplerates
,
0
,
GET_SAMPLE_RATE_NAME
,
","
)
GET_SAMPLE_RATE_NAME
,
","
)
#define GET_CH_LAYOUT_NAME(ch_layout)\
char name[16];\
snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
DEF_CHOOSE_FORMAT
(
uint64_t
,
channel_layout
,
channel_layouts
,
0
,
DEF_CHOOSE_FORMAT
(
uint64_t
,
channel_layout
,
channel_layouts
,
0
,
GET_CH_LAYOUT_NAME
,
","
)
GET_CH_LAYOUT_NAME
,
","
)
...
...
avconv_opt.c
View file @
a3ad68d3
...
@@ -1789,10 +1789,10 @@ static int opt_filter_complex(const char *opt, const char *arg)
...
@@ -1789,10 +1789,10 @@ static int opt_filter_complex(const char *opt, const char *arg)
return
0
;
return
0
;
}
}
static
int
show_help
(
const
char
*
opt
,
const
char
*
arg
)
void
show_help_default
(
const
char
*
opt
,
const
char
*
arg
)
{
{
int
flags
=
AV_OPT_FLAG_DECODING_PARAM
|
AV_OPT_FLAG_ENCODING_PARAM
;
int
flags
=
AV_OPT_FLAG_DECODING_PARAM
|
AV_OPT_FLAG_ENCODING_PARAM
;
av_log_set_callback
(
log_callback_help
);
show_usage
();
show_usage
();
show_help_options
(
options
,
"Main options:"
,
show_help_options
(
options
,
"Main options:"
,
0
,
OPT_EXPERT
|
OPT_AUDIO
|
OPT_VIDEO
|
OPT_SUBTITLE
);
0
,
OPT_EXPERT
|
OPT_AUDIO
|
OPT_VIDEO
|
OPT_SUBTITLE
);
...
@@ -1812,7 +1812,6 @@ static int show_help(const char *opt, const char *arg)
...
@@ -1812,7 +1812,6 @@ static int show_help(const char *opt, const char *arg)
show_help_children
(
avcodec_get_class
(),
flags
);
show_help_children
(
avcodec_get_class
(),
flags
);
show_help_children
(
avformat_get_class
(),
flags
);
show_help_children
(
avformat_get_class
(),
flags
);
show_help_children
(
sws_get_class
(),
flags
);
show_help_children
(
sws_get_class
(),
flags
);
return
0
;
}
}
void
show_usage
(
void
)
void
show_usage
(
void
)
...
...
avplay.c
View file @
a3ad68d3
...
@@ -224,8 +224,6 @@ typedef struct VideoState {
...
@@ -224,8 +224,6 @@ typedef struct VideoState {
int
refresh
;
int
refresh
;
}
VideoState
;
}
VideoState
;
static
int
show_help
(
const
char
*
opt
,
const
char
*
arg
);
/* options specified by the user */
/* options specified by the user */
static
AVInputFormat
*
file_iformat
;
static
AVInputFormat
*
file_iformat
;
static
const
char
*
input_filename
;
static
const
char
*
input_filename
;
...
@@ -2922,7 +2920,7 @@ static void show_usage(void)
...
@@ -2922,7 +2920,7 @@ static void show_usage(void)
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
static
int
show_help
(
const
char
*
opt
,
const
char
*
arg
)
void
show_help_default
(
const
char
*
opt
,
const
char
*
arg
)
{
{
av_log_set_callback
(
log_callback_help
);
av_log_set_callback
(
log_callback_help
);
show_usage
();
show_usage
();
...
@@ -2947,8 +2945,6 @@ static int show_help(const char *opt, const char *arg)
...
@@ -2947,8 +2945,6 @@ static int show_help(const char *opt, const char *arg)
"down/up seek backward/forward 1 minute
\n
"
"down/up seek backward/forward 1 minute
\n
"
"mouse click seek to percentage in file corresponding to fraction of width
\n
"
"mouse click seek to percentage in file corresponding to fraction of width
\n
"
);
);
return
0
;
}
}
static
void
opt_input_file
(
void
*
optctx
,
const
char
*
filename
)
static
void
opt_input_file
(
void
*
optctx
,
const
char
*
filename
)
...
...
avprobe.c
View file @
a3ad68d3
...
@@ -868,14 +868,13 @@ static void opt_input_file(void *optctx, const char *arg)
...
@@ -868,14 +868,13 @@ static void opt_input_file(void *optctx, const char *arg)
input_filename
=
arg
;
input_filename
=
arg
;
}
}
static
int
show_help
(
const
char
*
opt
,
const
char
*
arg
)
void
show_help_default
(
const
char
*
opt
,
const
char
*
arg
)
{
{
av_log_set_callback
(
log_callback_help
);
av_log_set_callback
(
log_callback_help
);
show_usage
();
show_usage
();
show_help_options
(
options
,
"Main options:"
,
0
,
0
);
show_help_options
(
options
,
"Main options:"
,
0
,
0
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
show_help_children
(
avformat_get_class
(),
AV_OPT_FLAG_DECODING_PARAM
);
show_help_children
(
avformat_get_class
(),
AV_OPT_FLAG_DECODING_PARAM
);
return
0
;
}
}
static
void
opt_pretty
(
void
)
static
void
opt_pretty
(
void
)
...
...
avserver.c
View file @
a3ad68d3
...
@@ -4629,7 +4629,7 @@ static void opt_debug(void)
...
@@ -4629,7 +4629,7 @@ static void opt_debug(void)
logfilename
[
0
]
=
'-'
;
logfilename
[
0
]
=
'-'
;
}
}
static
void
show_help
(
void
)
void
show_help_default
(
const
char
*
opt
,
const
char
*
arg
)
{
{
printf
(
"usage: avserver [options]
\n
"
printf
(
"usage: avserver [options]
\n
"
"Hyper fast multi format Audio/Video streaming server
\n
"
);
"Hyper fast multi format Audio/Video streaming server
\n
"
);
...
...
cmdutils.c
View file @
a3ad68d3
...
@@ -132,7 +132,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
...
@@ -132,7 +132,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
first
=
0
;
first
=
0
;
}
}
av_strlcpy
(
buf
,
po
->
name
,
sizeof
(
buf
));
av_strlcpy
(
buf
,
po
->
name
,
sizeof
(
buf
));
if
(
po
->
flags
&
HAS_ARG
)
{
if
(
po
->
argname
)
{
av_strlcat
(
buf
,
" "
,
sizeof
(
buf
));
av_strlcat
(
buf
,
" "
,
sizeof
(
buf
));
av_strlcat
(
buf
,
po
->
argname
,
sizeof
(
buf
));
av_strlcat
(
buf
,
po
->
argname
,
sizeof
(
buf
));
}
}
...
@@ -642,6 +642,65 @@ int show_formats(const char *opt, const char *arg)
...
@@ -642,6 +642,65 @@ int show_formats(const char *opt, const char *arg)
return
0
;
return
0
;
}
}
#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
if (codec->field) { \
const type *p = c->field; \
\
printf(" Supported " list_name ":"); \
while (*p != term) { \
get_name(*p); \
printf(" %s", name); \
p++; \
} \
printf("\n"); \
} \
static
void
print_codec
(
const
AVCodec
*
c
)
{
int
encoder
=
av_codec_is_encoder
(
c
);
printf
(
"%s %s [%s]:
\n
"
,
encoder
?
"Encoder"
:
"Decoder"
,
c
->
name
,
c
->
long_name
?
c
->
long_name
:
""
);
if
(
c
->
type
==
AVMEDIA_TYPE_VIDEO
)
{
printf
(
" Threading capabilities: "
);
switch
(
c
->
capabilities
&
(
CODEC_CAP_FRAME_THREADS
|
CODEC_CAP_SLICE_THREADS
))
{
case
CODEC_CAP_FRAME_THREADS
|
CODEC_CAP_SLICE_THREADS:
printf
(
"frame and slice"
)
;
break
;
case
CODEC_CAP_FRAME_THREADS
:
printf
(
"frame"
)
;
break
;
case
CODEC_CAP_SLICE_THREADS
:
printf
(
"slice"
)
;
break
;
default:
printf
(
"no"
)
;
break
;
}
printf
(
"
\n
"
)
;
}
if
(
c
->
supported_framerates
)
{
const
AVRational
*
fps
=
c
->
supported_framerates
;
printf
(
" Supported framerates:"
)
;
while
(
fps
->
num
)
{
printf
(
" %d/%d"
,
fps
->
num
,
fps
->
den
)
;
fps
++
;
}
printf
(
"
\n
"
)
;
}
PRINT_CODEC_SUPPORTED
(
c
,
pix_fmts
,
enum
PixelFormat
,
"pixel formats"
,
PIX_FMT_NONE
,
GET_PIX_FMT_NAME
)
;
PRINT_CODEC_SUPPORTED
(
c
,
supported_samplerates
,
int
,
"sample rates"
,
0
,
GET_SAMPLE_RATE_NAME
)
;
PRINT_CODEC_SUPPORTED
(
c
,
sample_fmts
,
enum
AVSampleFormat
,
"sample formats"
,
AV_SAMPLE_FMT_NONE
,
GET_SAMPLE_FMT_NAME
)
;
PRINT_CODEC_SUPPORTED
(
c
,
channel_layouts
,
uint64_t
,
"channel layouts"
,
0
,
GET_CH_LAYOUT_DESC
)
;
if
(
c
->
priv_class
)
{
show_help_children
(
c
->
priv_class
,
AV_OPT_FLAG_ENCODING_PARAM
|
AV_OPT_FLAG_DECODING_PARAM
)
;
}
}
static
char
get_media_type_char
(
enum
AVMediaType
type
)
static
char
get_media_type_char
(
enum
AVMediaType
type
)
{
{
switch
(
type
)
{
switch
(
type
)
{
...
@@ -842,6 +901,65 @@ int show_sample_fmts(const char *opt, const char *arg)
...
@@ -842,6 +901,65 @@ int show_sample_fmts(const char *opt, const char *arg)
return
0
;
return
0
;
}
}
static
void
show_help_codec
(
const
char
*
name
,
int
encoder
)
{
const
AVCodecDescriptor
*
desc
;
const
AVCodec
*
codec
;
if
(
!
name
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"No codec name specified.
\n
"
);
return
;
}
codec
=
encoder
?
avcodec_find_encoder_by_name
(
name
)
:
avcodec_find_decoder_by_name
(
name
);
if
(
codec
)
print_codec
(
codec
);
else
if
((
desc
=
avcodec_descriptor_get_by_name
(
name
)))
{
int
printed
=
0
;
while
((
codec
=
next_codec_for_id
(
desc
->
id
,
codec
,
encoder
)))
{
printed
=
1
;
print_codec
(
codec
);
}
if
(
!
printed
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Codec '%s' is known to Libav, "
"but no %s for it are available. Libav might need to be "
"recompiled with additional external libraries.
\n
"
,
name
,
encoder
?
"encoders"
:
"decoders"
);
}
}
else
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Codec '%s' is not recognized by Libav.
\n
"
,
name
);
}
}
int
show_help
(
const
char
*
opt
,
const
char
*
arg
)
{
char
*
topic
,
*
par
;
av_log_set_callback
(
log_callback_help
);
topic
=
av_strdup
(
arg
?
arg
:
""
);
par
=
strchr
(
topic
,
'='
);
if
(
par
)
*
par
++
=
0
;
if
(
!*
topic
)
{
show_help_default
(
topic
,
par
);
}
else
if
(
!
strcmp
(
topic
,
"decoder"
))
{
show_help_codec
(
par
,
0
);
}
else
if
(
!
strcmp
(
topic
,
"encoder"
))
{
show_help_codec
(
par
,
1
);
}
else
{
show_help_default
(
topic
,
par
);
}
av_freep
(
&
topic
);
return
0
;
}
int
read_yesno
(
void
)
int
read_yesno
(
void
)
{
{
int
c
=
getchar
();
int
c
=
getchar
();
...
...
cmdutils.h
View file @
a3ad68d3
...
@@ -170,6 +170,17 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
...
@@ -170,6 +170,17 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
*/
*/
void
show_help_children
(
const
AVClass
*
class
,
int
flags
);
void
show_help_children
(
const
AVClass
*
class
,
int
flags
);
/**
* Per-avtool specific help handler. Implemented in each
* avtool, called by show_help().
*/
void
show_help_default
(
const
char
*
opt
,
const
char
*
arg
);
/**
* Generic -h handler common to all avtools.
*/
int
show_help
(
const
char
*
opt
,
const
char
*
arg
);
/**
/**
* Parse the command line arguments.
* Parse the command line arguments.
*
*
...
@@ -446,4 +457,23 @@ void filter_release_buffer(AVFilterBuffer *fb);
...
@@ -446,4 +457,23 @@ void filter_release_buffer(AVFilterBuffer *fb);
* buffers have been released.
* buffers have been released.
*/
*/
void
free_buffer_pool
(
FrameBuffer
**
pool
);
void
free_buffer_pool
(
FrameBuffer
**
pool
);
#define GET_PIX_FMT_NAME(pix_fmt)\
const char *name = av_get_pix_fmt_name(pix_fmt);
#define GET_SAMPLE_FMT_NAME(sample_fmt)\
const char *name = av_get_sample_fmt_name(sample_fmt)
#define GET_SAMPLE_RATE_NAME(rate)\
char name[16];\
snprintf(name, sizeof(name), "%d", rate);
#define GET_CH_LAYOUT_NAME(ch_layout)\
char name[16];\
snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
#define GET_CH_LAYOUT_DESC(ch_layout)\
char name[128];\
av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
#endif
/* LIBAV_CMDUTILS_H */
#endif
/* LIBAV_CMDUTILS_H */
cmdutils_common_opts.h
View file @
a3ad68d3
{
"L"
,
OPT_EXIT
,
{.
func_arg
=
show_license
},
"show license"
},
{
"L"
,
OPT_EXIT
,
{.
func_arg
=
show_license
},
"show license"
},
{
"h"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
},
{
"h"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
,
"topic"
},
{
"?"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
},
{
"?"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
,
"topic"
},
{
"help"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
},
{
"help"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
,
"topic"
},
{
"-help"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
},
{
"-help"
,
OPT_EXIT
,
{.
func_arg
=
show_help
},
"show help"
,
"topic"
},
{
"version"
,
OPT_EXIT
,
{.
func_arg
=
show_version
},
"show version"
},
{
"version"
,
OPT_EXIT
,
{.
func_arg
=
show_version
},
"show version"
},
{
"formats"
,
OPT_EXIT
,
{.
func_arg
=
show_formats
},
"show available formats"
},
{
"formats"
,
OPT_EXIT
,
{.
func_arg
=
show_formats
},
"show available formats"
},
{
"codecs"
,
OPT_EXIT
,
{.
func_arg
=
show_codecs
},
"show available codecs"
},
{
"codecs"
,
OPT_EXIT
,
{.
func_arg
=
show_codecs
},
"show available codecs"
},
...
...
doc/avtools-common-opts.texi
View file @
a3ad68d3
...
@@ -51,8 +51,20 @@ These options are shared amongst the av* tools.
...
@@ -51,8 +51,20 @@ These options are shared amongst the av* tools.
@item -L
@item -L
Show license.
Show license.
@item -h, -?, -help, --help
@item -h, -?, -help, --help [@var{arg}]
Show help.
Show help. An optional parameter may be specified to print help about a specific
item.
Possible values of @var{arg} are:
@table @option
@item decoder=@var{decoder_name}
Print detailed information about the decoder named @var{decoder_name}. Use the
@option{-decoders} option to get a list of all decoders.
@item encoder=@var{encoder_name}
Print detailed information about the encoder named @var{encoder_name}. Use the
@option{-encoders} option to get a list of all encoders.
@end table
@item -version
@item -version
Show version.
Show version.
...
...
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