2 * Copyright (c) 2012 Anton Khirnov
4 * This file is part of Libav.
6 * Libav is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libav is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with Libav; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 * generate texinfo manpages for avoptions
30 #include "libavutil/attributes.h"
31 #include "libavutil/opt.h"
33 /* Forcibly turn off deprecation warnings, which just add noise here. */
34 #undef attribute_deprecated
35 #define attribute_deprecated
37 #include "libavcodec/options_table.h"
39 #include "libavformat/options_table.h"
41 static void print_usage(void)
43 fprintf(stderr
, "Usage: enum_options type\n"
44 "type: format codec\n");
48 static void print_option(const AVOption
*opts
, const AVOption
*o
, int per_stream
)
50 if (!(o
->flags
& (AV_OPT_FLAG_DECODING_PARAM
| AV_OPT_FLAG_ENCODING_PARAM
)))
53 printf("@item -%s%s @var{", o
->name
, per_stream
? "[:stream_specifier]" : "");
55 case AV_OPT_TYPE_BINARY
: printf("hexadecimal string"); break;
56 case AV_OPT_TYPE_STRING
: printf("string"); break;
58 case AV_OPT_TYPE_INT64
: printf("integer"); break;
59 case AV_OPT_TYPE_FLOAT
:
60 case AV_OPT_TYPE_DOUBLE
: printf("float"); break;
61 case AV_OPT_TYPE_RATIONAL
: printf("rational number"); break;
62 case AV_OPT_TYPE_FLAGS
: printf("flags"); break;
63 default: printf("value"); break;
67 if (o
->flags
& AV_OPT_FLAG_DECODING_PARAM
) {
69 if (o
->flags
& AV_OPT_FLAG_ENCODING_PARAM
)
72 if (o
->flags
& AV_OPT_FLAG_ENCODING_PARAM
) printf("output");
73 if (o
->flags
& AV_OPT_FLAG_AUDIO_PARAM
) printf(",audio");
74 if (o
->flags
& AV_OPT_FLAG_VIDEO_PARAM
) printf(",video");
75 if (o
->flags
& AV_OPT_FLAG_SUBTITLE_PARAM
) printf(",subtitles");
79 printf("%s\n", o
->help
);
83 printf("\nPossible values:\n@table @samp\n");
85 for (u
= opts
; u
->name
; u
++) {
86 if (u
->type
== AV_OPT_TYPE_CONST
&& u
->unit
&& !strcmp(u
->unit
, o
->unit
))
87 printf("@item %s\n%s\n", u
->name
, u
->help
? u
->help
: "");
89 printf("@end table\n");
93 static void show_opts(const AVOption
*opts
, int per_stream
)
97 printf("@table @option\n");
98 for (o
= opts
; o
->name
; o
++) {
99 if (o
->type
!= AV_OPT_TYPE_CONST
)
100 print_option(opts
, o
, per_stream
);
102 printf("@end table\n");
105 static void show_format_opts(void)
107 printf("@section Format AVOptions\n");
108 show_opts(avformat_options
, 0);
111 static void show_codec_opts(void)
113 printf("@section Codec AVOptions\n");
114 show_opts(avcodec_options
, 1);
117 int main(int argc
, char **argv
)
122 if (!strcmp(argv
[1], "format"))
124 else if (!strcmp(argv
[1], "codec"))