yading@10: /* yading@10: * Copyright (c) 2012 Anton Khirnov yading@10: * yading@10: * This file is part of Libav. yading@10: * yading@10: * Libav is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * Libav is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with Libav; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: /* yading@10: * generate texinfo manpages for avoptions yading@10: */ yading@10: yading@10: #include yading@10: #include yading@10: #include yading@10: yading@10: #include "libavformat/avformat.h" yading@10: #include "libavcodec/avcodec.h" yading@10: #include "libavutil/opt.h" yading@10: yading@10: static void print_usage(void) yading@10: { yading@10: fprintf(stderr, "Usage: enum_options type\n" yading@10: "type: format codec\n"); yading@10: exit(1); yading@10: } yading@10: yading@10: static void print_option(const AVOption *opts, const AVOption *o, int per_stream) yading@10: { yading@10: if (!(o->flags & (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM))) yading@10: return; yading@10: yading@10: printf("@item -%s%s @var{", o->name, per_stream ? "[:stream_specifier]" : ""); yading@10: switch (o->type) { yading@10: case AV_OPT_TYPE_BINARY: printf("hexadecimal string"); break; yading@10: case AV_OPT_TYPE_STRING: printf("string"); break; yading@10: case AV_OPT_TYPE_INT: yading@10: case AV_OPT_TYPE_INT64: printf("integer"); break; yading@10: case AV_OPT_TYPE_FLOAT: yading@10: case AV_OPT_TYPE_DOUBLE: printf("float"); break; yading@10: case AV_OPT_TYPE_RATIONAL: printf("rational number"); break; yading@10: case AV_OPT_TYPE_FLAGS: printf("flags"); break; yading@10: default: printf("value"); break; yading@10: } yading@10: printf("} (@emph{"); yading@10: yading@10: if (o->flags & AV_OPT_FLAG_DECODING_PARAM) { yading@10: printf("input"); yading@10: if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) yading@10: printf("/"); yading@10: } yading@10: if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) printf("output"); yading@10: if (o->flags & AV_OPT_FLAG_AUDIO_PARAM) printf(",audio"); yading@10: if (o->flags & AV_OPT_FLAG_VIDEO_PARAM) printf(",video"); yading@10: if (o->flags & AV_OPT_FLAG_SUBTITLE_PARAM) printf(",subtitles"); yading@10: yading@10: printf("})\n"); yading@10: if (o->help) yading@10: printf("%s\n", o->help); yading@10: yading@10: if (o->unit) { yading@10: const AVOption *u; yading@10: printf("\nPossible values:\n@table @samp\n"); yading@10: yading@10: for (u = opts; u->name; u++) { yading@10: if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit)) yading@10: printf("@item %s\n%s\n", u->name, u->help ? u->help : ""); yading@10: } yading@10: printf("@end table\n"); yading@10: } yading@10: } yading@10: yading@10: static void show_opts(const AVOption *opts, int per_stream) yading@10: { yading@10: const AVOption *o; yading@10: yading@10: printf("@table @option\n"); yading@10: for (o = opts; o->name; o++) { yading@10: if (o->type != AV_OPT_TYPE_CONST) yading@10: print_option(opts, o, per_stream); yading@10: } yading@10: printf("@end table\n"); yading@10: } yading@10: yading@10: static void show_format_opts(void) yading@10: { yading@10: #include "libavformat/options_table.h" yading@10: yading@10: printf("@section Format AVOptions\n"); yading@10: show_opts(options, 0); yading@10: } yading@10: yading@10: static void show_codec_opts(void) yading@10: { yading@10: #include "libavcodec/options_table.h" yading@10: yading@10: printf("@section Codec AVOptions\n"); yading@10: show_opts(options, 1); yading@10: } yading@10: yading@10: int main(int argc, char **argv) yading@10: { yading@10: if (argc < 2) yading@10: print_usage(); yading@10: yading@10: printf("@c DO NOT EDIT THIS FILE!\n" yading@10: "@c It was generated by print_options.\n\n"); yading@10: if (!strcmp(argv[1], "format")) yading@10: show_format_opts(); yading@10: else if (!strcmp(argv[1], "codec")) yading@10: show_codec_opts(); yading@10: else yading@10: print_usage(); yading@10: yading@10: return 0; yading@10: }