2 * Copyright (c) 2012 Anton Khirnov
4 * This file is part of FFmpeg.
6 * FFmpeg 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 * FFmpeg 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 FFmpeg; 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 // print_options is build for the host, os_support.h isn't needed and is setup
31 // for the target. without this build breaks on mingw
32 #define AVFORMAT_OS_SUPPORT_H
34 #include "libavutil/attributes.h"
35 #include "libavutil/opt.h"
37 /* Forcibly turn off deprecation warnings, which just add noise here. */
38 #undef attribute_deprecated
39 #define attribute_deprecated
41 #include "libavcodec/options_table.h"
43 #include "libavformat/options_table.h"
45 static void print_usage(void)
47 fprintf(stderr, "Usage: enum_options type\n"
48 "type: format codec\n");
52 static void print_option(const AVOption *opts, const AVOption *o, int per_stream)
54 if (!(o->flags & (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM)))
57 printf("@item -%s%s @var{", o->name, per_stream ? "[:stream_specifier]" : "");
59 case AV_OPT_TYPE_BINARY: printf("hexadecimal string"); break;
60 case AV_OPT_TYPE_STRING: printf("string"); break;
62 case AV_OPT_TYPE_INT64: printf("integer"); break;
63 case AV_OPT_TYPE_FLOAT:
64 case AV_OPT_TYPE_DOUBLE: printf("float"); break;
65 case AV_OPT_TYPE_RATIONAL: printf("rational number"); break;
66 case AV_OPT_TYPE_FLAGS: printf("flags"); break;
67 default: printf("value"); break;
71 if (o->flags & AV_OPT_FLAG_DECODING_PARAM) {
73 if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
76 if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) printf("output");
77 if (o->flags & AV_OPT_FLAG_AUDIO_PARAM) printf(",audio");
78 if (o->flags & AV_OPT_FLAG_VIDEO_PARAM) printf(",video");
79 if (o->flags & AV_OPT_FLAG_SUBTITLE_PARAM) printf(",subtitles");
83 printf("%s\n", o->help);
87 printf("\nPossible values:\n@table @samp\n");
89 for (u = opts; u->name; u++) {
90 if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
91 printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
93 printf("@end table\n");
97 static void show_opts(const AVOption *opts, int per_stream)
101 printf("@table @option\n");
102 for (o = opts; o->name; o++) {
103 if (o->type != AV_OPT_TYPE_CONST)
104 print_option(opts, o, per_stream);
106 printf("@end table\n");
109 static void show_format_opts(void)
111 printf("@section Format AVOptions\n");
112 show_opts(avformat_options, 0);
115 static void show_codec_opts(void)
117 printf("@section Codec AVOptions\n");
118 show_opts(avcodec_options, 1);
121 int main(int argc, char **argv)
126 printf("@c DO NOT EDIT THIS FILE!\n"
127 "@c It was generated by print_options.\n\n");
128 if (!strcmp(argv[1], "format"))
130 else if (!strcmp(argv[1], "codec"))