cmdutils: add show_demuxers and show_muxers
add -muxers and -demuxers parameters to list the dexmuers and muxers Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
0cf6853804
commit
acd87dfc05
66
cmdutils.c
66
cmdutils.c
|
@ -75,6 +75,12 @@ static FILE *report_file;
|
||||||
static int report_file_level = AV_LOG_DEBUG;
|
static int report_file_level = AV_LOG_DEBUG;
|
||||||
int hide_banner = 0;
|
int hide_banner = 0;
|
||||||
|
|
||||||
|
enum show_muxdemuxers {
|
||||||
|
SHOW_DEFAULT,
|
||||||
|
SHOW_DEMUXERS,
|
||||||
|
SHOW_MUXERS,
|
||||||
|
};
|
||||||
|
|
||||||
void init_opts(void)
|
void init_opts(void)
|
||||||
{
|
{
|
||||||
av_dict_set(&sws_dict, "flags", "bicubic", 0);
|
av_dict_set(&sws_dict, "flags", "bicubic", 0);
|
||||||
|
@ -1251,7 +1257,7 @@ static int is_device(const AVClass *avclass)
|
||||||
return AV_IS_INPUT_DEVICE(avclass->category) || AV_IS_OUTPUT_DEVICE(avclass->category);
|
return AV_IS_INPUT_DEVICE(avclass->category) || AV_IS_OUTPUT_DEVICE(avclass->category);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_formats_devices(void *optctx, const char *opt, const char *arg, int device_only)
|
static int show_formats_devices(void *optctx, const char *opt, const char *arg, int device_only, int muxdemuxers)
|
||||||
{
|
{
|
||||||
AVInputFormat *ifmt = NULL;
|
AVInputFormat *ifmt = NULL;
|
||||||
AVOutputFormat *ofmt = NULL;
|
AVOutputFormat *ofmt = NULL;
|
||||||
|
@ -1269,29 +1275,33 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
const char *long_name = NULL;
|
const char *long_name = NULL;
|
||||||
|
|
||||||
while ((ofmt = av_oformat_next(ofmt))) {
|
if (muxdemuxers !=SHOW_DEMUXERS) {
|
||||||
is_dev = is_device(ofmt->priv_class);
|
while ((ofmt = av_oformat_next(ofmt))) {
|
||||||
if (!is_dev && device_only)
|
is_dev = is_device(ofmt->priv_class);
|
||||||
continue;
|
if (!is_dev && device_only)
|
||||||
if ((!name || strcmp(ofmt->name, name) < 0) &&
|
continue;
|
||||||
strcmp(ofmt->name, last_name) > 0) {
|
if ((!name || strcmp(ofmt->name, name) < 0) &&
|
||||||
name = ofmt->name;
|
strcmp(ofmt->name, last_name) > 0) {
|
||||||
long_name = ofmt->long_name;
|
name = ofmt->name;
|
||||||
encode = 1;
|
long_name = ofmt->long_name;
|
||||||
|
encode = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ((ifmt = av_iformat_next(ifmt))) {
|
if (muxdemuxers != SHOW_MUXERS) {
|
||||||
is_dev = is_device(ifmt->priv_class);
|
while ((ifmt = av_iformat_next(ifmt))) {
|
||||||
if (!is_dev && device_only)
|
is_dev = is_device(ifmt->priv_class);
|
||||||
continue;
|
if (!is_dev && device_only)
|
||||||
if ((!name || strcmp(ifmt->name, name) < 0) &&
|
continue;
|
||||||
strcmp(ifmt->name, last_name) > 0) {
|
if ((!name || strcmp(ifmt->name, name) < 0) &&
|
||||||
name = ifmt->name;
|
strcmp(ifmt->name, last_name) > 0) {
|
||||||
long_name = ifmt->long_name;
|
name = ifmt->name;
|
||||||
encode = 0;
|
long_name = ifmt->long_name;
|
||||||
|
encode = 0;
|
||||||
|
}
|
||||||
|
if (name && strcmp(ifmt->name, name) == 0)
|
||||||
|
decode = 1;
|
||||||
}
|
}
|
||||||
if (name && strcmp(ifmt->name, name) == 0)
|
|
||||||
decode = 1;
|
|
||||||
}
|
}
|
||||||
if (!name)
|
if (!name)
|
||||||
break;
|
break;
|
||||||
|
@ -1308,12 +1318,22 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
|
||||||
|
|
||||||
int show_formats(void *optctx, const char *opt, const char *arg)
|
int show_formats(void *optctx, const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
return show_formats_devices(optctx, opt, arg, 0);
|
return show_formats_devices(optctx, opt, arg, 0, SHOW_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
int show_muxers(void *optctx, const char *opt, const char *arg)
|
||||||
|
{
|
||||||
|
return show_formats_devices(optctx, opt, arg, 0, SHOW_MUXERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
int show_demuxers(void *optctx, const char *opt, const char *arg)
|
||||||
|
{
|
||||||
|
return show_formats_devices(optctx, opt, arg, 0, SHOW_DEMUXERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int show_devices(void *optctx, const char *opt, const char *arg)
|
int show_devices(void *optctx, const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
return show_formats_devices(optctx, opt, arg, 1);
|
return show_formats_devices(optctx, opt, arg, 1, SHOW_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
|
#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
|
||||||
|
|
14
cmdutils.h
14
cmdutils.h
|
@ -441,6 +441,20 @@ int show_license(void *optctx, const char *opt, const char *arg);
|
||||||
*/
|
*/
|
||||||
int show_formats(void *optctx, const char *opt, const char *arg);
|
int show_formats(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print a listing containing all the muxers supported by the
|
||||||
|
* program (including devices).
|
||||||
|
* This option processing function does not utilize the arguments.
|
||||||
|
*/
|
||||||
|
int show_muxers(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print a listing containing all the demuxer supported by the
|
||||||
|
* program (including devices).
|
||||||
|
* This option processing function does not utilize the arguments.
|
||||||
|
*/
|
||||||
|
int show_demuxers(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a listing containing all the devices supported by the
|
* Print a listing containing all the devices supported by the
|
||||||
* program.
|
* program.
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
{ "version" , OPT_EXIT, {.func_arg = show_version}, "show version" },
|
{ "version" , OPT_EXIT, {.func_arg = show_version}, "show version" },
|
||||||
{ "buildconf" , OPT_EXIT, {.func_arg = show_buildconf}, "show build configuration" },
|
{ "buildconf" , OPT_EXIT, {.func_arg = show_buildconf}, "show build configuration" },
|
||||||
{ "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" },
|
{ "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" },
|
||||||
|
{ "muxers" , OPT_EXIT, {.func_arg = show_muxers }, "show available muxers" },
|
||||||
|
{ "demuxers" , OPT_EXIT, {.func_arg = show_demuxers }, "show available demuxers" },
|
||||||
{ "devices" , OPT_EXIT, {.func_arg = show_devices }, "show available devices" },
|
{ "devices" , OPT_EXIT, {.func_arg = show_devices }, "show available devices" },
|
||||||
{ "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" },
|
{ "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" },
|
||||||
{ "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" },
|
{ "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user