diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-03-21 00:15:18 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-21 01:33:53 +0100 |
commit | 0ebd83617fe008b7e9766f659cc3d9618b2d80d2 (patch) | |
tree | 23bc388bf6b66cf58d7a90c0d2529e53ed984561 /doc/print_options.c | |
parent | 745a33a44318ad6d6f74835a417397cdd9dda9a9 (diff) | |
parent | c9594fe0fb6dd123fa25cb27fe5bc976ff3a9051 (diff) | |
download | ffmpeg-0ebd83617fe008b7e9766f659cc3d9618b2d80d2.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (27 commits)
avconv: free packet in write_frame() when discarding due to frame number limit
FATE: use +/- flag option syntax for vp8 emu-edge tests
lavf: make av_interleave_packet_per_dts() private.
lavf: deprecate av_read_packet().
oggdec: output correct timestamps for Vorbis
avconv: pass input stream timestamps to audio encoders
lavc: shrink encoded audio packet size after encoding.
xa: set correct bit rate
xa: do not set bit_rate, block_align, or bits_per_coded_sample
xa: fix end-of-file handling
xa: fix timestamp calculation
bink: fix typo in FFALIGN() argument
bink: align plane width to 8 when calculating bundle sizes
doc: pass -Idoc texi2html and texi2pod
doc: texi2pod: add -I flag
movenc: Add a min_frag_duration option
rtsp: Set the default delay to 0.1 s for the RTSP/SDP/RTP demuxers
libavformat: Set the default for the max_delay option to -1
Generate manpages for AV{Format,Codec}Context AVOptions.
doc/avconv: remove entries for AVOptions.
...
Conflicts:
doc/Makefile
doc/ffmpeg.texi
doc/muxers.texi
ffmpeg.c
libavcodec/Makefile
libavcodec/options.c
libavcodec/vp8.c
libavformat/options.c
tests/fate/demux.mak
tests/ref/fate/truemotion1-15
tests/ref/fate/truemotion1-24
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc/print_options.c')
-rw-r--r-- | doc/print_options.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/doc/print_options.c b/doc/print_options.c new file mode 100644 index 0000000000..4283e6a86d --- /dev/null +++ b/doc/print_options.c @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2012 Anton Khirnov + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * generate texinfo manpages for avoptions + */ + +#include <stddef.h> +#include <string.h> +#include <float.h> + +#include "libavformat/avformat.h" +#include "libavcodec/avcodec.h" +#include "libavutil/opt.h" + +static void print_usage(void) +{ + fprintf(stderr, "Usage: enum_options type\n" + "type: format codec\n"); + exit(1); +} + +static void print_option(const AVOption *opts, const AVOption *o, int per_stream) +{ + printf("@item -%s%s @var{", o->name, per_stream ? "[:stream_specifier]" : ""); + switch (o->type) { + case AV_OPT_TYPE_BINARY: printf("hexadecimal string"); break; + case AV_OPT_TYPE_STRING: printf("string"); break; + case AV_OPT_TYPE_INT: + case AV_OPT_TYPE_INT64: printf("integer"); break; + case AV_OPT_TYPE_FLOAT: + case AV_OPT_TYPE_DOUBLE: printf("float"); break; + case AV_OPT_TYPE_RATIONAL: printf("rational number"); break; + case AV_OPT_TYPE_FLAGS: printf("flags"); break; + default: printf("value"); break; + } + printf("} (@emph{"); + + if (o->flags & AV_OPT_FLAG_DECODING_PARAM) { + printf("input"); + if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) + printf("/"); + } + if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) printf("output"); + if (o->flags & AV_OPT_FLAG_AUDIO_PARAM) printf(",audio"); + if (o->flags & AV_OPT_FLAG_VIDEO_PARAM) printf(",video"); + if (o->flags & AV_OPT_FLAG_SUBTITLE_PARAM) printf(",subtitles"); + + printf("})\n"); + if (o->help) + printf("%s\n", o->help); + + if (o->unit) { + const AVOption *u; + printf("\nPossible values:\n@table @samp\n"); + + for (u = opts; u->name; u++) { + if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit)) + printf("@item %s\n%s\n", u->name, u->help ? u->help : ""); + } + printf("@end table\n"); + } +} + +static void show_opts(const AVOption *opts, int per_stream) +{ + const AVOption *o; + + printf("@table @option\n"); + for (o = opts; o->name; o++) { + if (o->type != AV_OPT_TYPE_CONST) + print_option(opts, o, per_stream); + } + printf("@end table\n"); +} + +static void show_format_opts(void) +{ +#include "libavformat/options_table.h" + + printf("@section Format AVOptions\n"); + show_opts(options, 0); +} + +static void show_codec_opts(void) +{ +#include "libavcodec/options_table.h" + + printf("@section Codec AVOptions\n"); + show_opts(options, 1); +} + +int main(int argc, char **argv) +{ + if (argc < 2) + print_usage(); + + if (!strcmp(argv[1], "format")) + show_format_opts(); + else if (!strcmp(argv[1], "codec")) + show_codec_opts(); + else + print_usage(); + + return 0; +} |