if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
/* handle 'no' bool option */
po = find_option(options, opt + 2);
- if (!(po->name && (po->flags & OPT_BOOL)))
- goto unknown_opt;
- bool_val = 0;
+ if ((po->name && (po->flags & OPT_BOOL)))
+ bool_val = 0;
}
if (!po->name)
po = find_option(options, "default");
if (!po->name) {
-unknown_opt:
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR(EINVAL);
}
return 0;
}
+static char get_media_type_char(enum AVMediaType type)
+{
+ static const char map[AVMEDIA_TYPE_NB] = {
+ [AVMEDIA_TYPE_VIDEO] = 'V',
+ [AVMEDIA_TYPE_AUDIO] = 'A',
+ [AVMEDIA_TYPE_DATA] = 'D',
+ [AVMEDIA_TYPE_SUBTITLE] = 'S',
+ [AVMEDIA_TYPE_ATTACHMENT] = 'T',
+ };
+ return type >= 0 && type < AVMEDIA_TYPE_NB && map[type] ? map[type] : '?';
+}
+
int opt_codecs(const char *opt, const char *arg)
{
AVCodec *p = NULL, *p2;
int decode = 0;
int encode = 0;
int cap = 0;
- const char *type_str;
p2 = NULL;
while ((p = av_codec_next(p))) {
break;
last_name = p2->name;
- switch (p2->type) {
- case AVMEDIA_TYPE_VIDEO:
- type_str = "V";
- break;
- case AVMEDIA_TYPE_AUDIO:
- type_str = "A";
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- type_str = "S";
- break;
- default:
- type_str = "?";
- break;
- }
- printf(" %s%s%s%s%s%s %-15s %s",
+ printf(" %s%s%c%s%s%s %-15s %s",
decode ? "D" : (/* p2->decoder ? "d" : */ " "),
encode ? "E" : " ",
- type_str,
+ get_media_type_char(p2->type),
cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ",
cap & CODEC_CAP_DR1 ? "D" : " ",
cap & CODEC_CAP_TRUNCATED ? "T" : " ",
int opt_protocols(const char *opt, const char *arg)
{
- URLProtocol *up=NULL;
+ void *opaque = NULL;
+ const char *name;
printf("Supported file protocols:\n"
- "I.. = Input supported\n"
- ".O. = Output supported\n"
- "..S = Seek supported\n"
- "FLAGS NAME\n"
- "----- \n");
- while((up = av_protocol_next(up)))
- printf("%c%c%c %s\n",
- up->url_read ? 'I' : '.',
- up->url_write ? 'O' : '.',
- up->url_seek ? 'S' : '.',
- up->name);
+ "Input:\n");
+ while ((name = avio_enum_protocols(&opaque, 0)))
+ printf("%s\n", name);
+ printf("Output:\n");
+ while ((name = avio_enum_protocols(&opaque, 1)))
+ printf("%s\n", name);
return 0;
}
int opt_filters(const char *opt, const char *arg)
{
AVFilter av_unused(**filter) = NULL;
+ char descr[64], *descr_cur;
+ int i, j;
+ const AVFilterPad *pad;
printf("Filters:\n");
#if CONFIG_AVFILTER
- while ((filter = av_filter_next(filter)) && *filter)
- printf("%-16s %s\n", (*filter)->name, (*filter)->description);
+ while ((filter = av_filter_next(filter)) && *filter) {
+ descr_cur = descr;
+ for (i = 0; i < 2; i++) {
+ if (i) {
+ *(descr_cur++) = '-';
+ *(descr_cur++) = '>';
+ }
+ pad = i ? (*filter)->outputs : (*filter)->inputs;
+ for (j = 0; pad[j].name; j++) {
+ if (descr_cur >= descr + sizeof(descr) - 4)
+ break;
+ *(descr_cur++) = get_media_type_char(pad[j].type);
+ }
+ if (!j)
+ *(descr_cur++) = '|';
+ }
+ *descr_cur = 0;
+ printf("%-16s %-10s %s\n", (*filter)->name, descr, (*filter)->description);
+ }
#endif
return 0;
}