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
29 #include "libavformat/avformat.h"
30 #include "libavformat/options_table.h"
31 #include "libavcodec/avcodec.h"
32 #include "libavcodec/options_table.h"
33 #include "libavutil/opt.h"
35 static void print_usage(void)
37 fprintf(stderr, "Usage: enum_options type\n"
38 "type: format codec\n");
42 static void print_option(const AVOption *opts, const AVOption *o, int per_stream)
44 if (!(o->flags & (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM)))
47 printf("@item -%s%s @var{", o->name, per_stream ? "[:stream_specifier]" : "");
49 case AV_OPT_TYPE_BINARY: printf("hexadecimal string"); break;
50 case AV_OPT_TYPE_STRING: printf("string"); break;
52 case AV_OPT_TYPE_INT64: printf("integer"); break;
53 case AV_OPT_TYPE_FLOAT:
54 case AV_OPT_TYPE_DOUBLE: printf("float"); break;
55 case AV_OPT_TYPE_RATIONAL: printf("rational number"); break;
56 case AV_OPT_TYPE_FLAGS: printf("flags"); break;
57 default: printf("value"); break;
61 if (o->flags & AV_OPT_FLAG_DECODING_PARAM) {
63 if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
66 if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) printf("output");
67 if (o->flags & AV_OPT_FLAG_AUDIO_PARAM) printf(",audio");
68 if (o->flags & AV_OPT_FLAG_VIDEO_PARAM) printf(",video");
69 if (o->flags & AV_OPT_FLAG_SUBTITLE_PARAM) printf(",subtitles");
73 printf("%s\n", o->help);
77 printf("\nPossible values:\n@table @samp\n");
79 for (u = opts; u->name; u++) {
80 if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
81 printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
83 printf("@end table\n");
87 static void show_opts(const AVOption *opts, int per_stream)
91 printf("@table @option\n");
92 for (o = opts; o->name; o++) {
93 if (o->type != AV_OPT_TYPE_CONST)
94 print_option(opts, o, per_stream);
96 printf("@end table\n");
99 static void show_format_opts(void)
101 printf("@section Format AVOptions\n");
102 show_opts(avformat_options, 0);
105 static void show_codec_opts(void)
107 printf("@section Codec AVOptions\n");
108 show_opts(avcodec_options, 1);
111 int main(int argc, char **argv)
116 printf("@c DO NOT EDIT THIS FILE!\n"
117 "@c It was generated by print_options.\n\n");
118 if (!strcmp(argv[1], "format"))
120 else if (!strcmp(argv[1], "codec"))