print (en/de)coders

This commit is contained in:
mrbesen 2020-03-16 13:43:22 +01:00
parent a1b65bf80a
commit 1db161ec93
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
3 changed files with 32 additions and 2 deletions

View File

@ -1608,7 +1608,7 @@ int show_codecs(void *optctx, const char *opt, const char *arg)
return 0;
}
static void print_codecs(int encoder)
void print_codecs(int encoder)
{
const AVCodecDescriptor **codecs;
unsigned i, nb_codecs = get_codecs_sorted(&codecs);
@ -1646,6 +1646,22 @@ static void print_codecs(int encoder)
av_free(codecs);
}
void print_codecs_short(int encoder) {
const AVCodecDescriptor **codecs;
unsigned i, nb_codecs = get_codecs_sorted(&codecs);
for (i = 0; i < nb_codecs; i++) {
const AVCodecDescriptor *desc = codecs[i];
const AVCodec *codec = NULL;
while ((codec = next_codec_for_id(desc->id, codec, encoder))) {
printf(" %s", codec->name);
}
}
printf("\n");
av_free(codecs);
}
int show_decoders(void *optctx, const char *opt, const char *arg)
{
print_codecs(0);

View File

@ -51,6 +51,9 @@ extern AVDictionary *swr_opts;
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
extern int hide_banner;
void print_codecs(int encoder);
void print_codecs_short(int encoder);
/**
* Register a program-specific cleanup routine.
*/

View File

@ -683,7 +683,18 @@ static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int e
}
if (!codec) {
av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
int c;
av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
av_log(NULL, AV_LOG_INFO, "Print %ss? [y/n]", codec_string);
c = getchar();
if(c == 'y' || c == 'Y') {
printf("\n");
print_codecs_short(encoder);
}
exit_program(1);
}
if (codec->type != type) {