FFmpeg
2.1.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
doc
print_options.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 Anton Khirnov
3
*
4
* This file is part of FFmpeg.
5
*
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.
10
*
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.
15
*
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
19
*/
20
21
/*
22
* generate texinfo manpages for avoptions
23
*/
24
25
#include <stddef.h>
26
#include <string.h>
27
#include <float.h>
28
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"
34
35
static
void
print_usage
(
void
)
36
{
37
fprintf(stderr,
"Usage: enum_options type\n"
38
"type: format codec\n"
);
39
exit(1);
40
}
41
42
static
void
print_option
(
const
AVOption
*opts,
const
AVOption
*o,
int
per_stream)
43
{
44
if
(!(o->
flags
& (
AV_OPT_FLAG_DECODING_PARAM
|
AV_OPT_FLAG_ENCODING_PARAM
)))
45
return
;
46
47
printf(
"@item -%s%s @var{"
, o->
name
, per_stream ?
"[:stream_specifier]"
:
""
);
48
switch
(o->
type
) {
49
case
AV_OPT_TYPE_BINARY
: printf(
"hexadecimal string"
);
break
;
50
case
AV_OPT_TYPE_STRING
: printf(
"string"
);
break
;
51
case
AV_OPT_TYPE_INT
:
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
;
58
}
59
printf(
"} (@emph{"
);
60
61
if
(o->
flags
&
AV_OPT_FLAG_DECODING_PARAM
) {
62
printf(
"input"
);
63
if
(o->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
)
64
printf(
"/"
);
65
}
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"
);
70
71
printf(
"})\n"
);
72
if
(o->
help
)
73
printf(
"%s\n"
, o->
help
);
74
75
if
(o->
unit
) {
76
const
AVOption
*
u
;
77
printf(
"\nPossible values:\n@table @samp\n"
);
78
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
:
""
);
82
}
83
printf(
"@end table\n"
);
84
}
85
}
86
87
static
void
show_opts
(
const
AVOption
*opts,
int
per_stream)
88
{
89
const
AVOption
*o;
90
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);
95
}
96
printf(
"@end table\n"
);
97
}
98
99
static
void
show_format_opts
(
void
)
100
{
101
printf(
"@section Format AVOptions\n"
);
102
show_opts
(
avformat_options
, 0);
103
}
104
105
static
void
show_codec_opts
(
void
)
106
{
107
printf(
"@section Codec AVOptions\n"
);
108
show_opts
(
avcodec_options
, 1);
109
}
110
111
int
main
(
int
argc,
char
**argv)
112
{
113
if
(argc < 2)
114
print_usage
();
115
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"
))
119
show_format_opts
();
120
else
if
(!strcmp(argv[1],
"codec"
))
121
show_codec_opts
();
122
else
123
print_usage
();
124
125
return
0;
126
}
AV_OPT_TYPE_INT64
Definition:
opt.h:223
show_codec_opts
static void show_codec_opts(void)
Definition:
print_options.c:105
AVOption
AVOption.
Definition:
opt.h:253
AV_OPT_TYPE_INT
Definition:
opt.h:222
print_usage
static void print_usage(void)
Definition:
print_options.c:35
avcodec_options
static const AVOption avcodec_options[]
Definition:
options_table.h:43
AVOption::name
const char * name
Definition:
opt.h:254
AV_OPT_TYPE_FLAGS
Definition:
opt.h:221
options_table.h
AV_OPT_TYPE_CONST
Definition:
opt.h:229
AV_OPT_FLAG_SUBTITLE_PARAM
#define AV_OPT_FLAG_SUBTITLE_PARAM
Definition:
opt.h:288
AV_OPT_TYPE_STRING
Definition:
opt.h:226
AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_VIDEO_PARAM
Definition:
opt.h:287
AVOption::unit
const char * unit
The logical unit to which the option belongs.
Definition:
opt.h:297
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition:
opt.h:286
AV_OPT_TYPE_FLOAT
Definition:
opt.h:225
avformat_options
static const AVOption avformat_options[]
Definition:
options_table.h:35
AVOption::help
const char * help
short English help text
Definition:
opt.h:260
u
float u
Definition:
avf_showspectrum.c:88
AV_OPT_TYPE_BINARY
offset must point to a pointer immediately followed by an int for the length
Definition:
opt.h:228
AVOption::flags
int flags
Definition:
opt.h:282
AV_OPT_TYPE_DOUBLE
Definition:
opt.h:224
show_format_opts
static void show_format_opts(void)
Definition:
print_options.c:99
show_opts
static void show_opts(const AVOption *opts, int per_stream)
Definition:
print_options.c:87
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition:
opt.h:284
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Definition:
opt.h:283
options_table.h
AVOption::type
enum AVOptionType type
Definition:
opt.h:267
AV_OPT_TYPE_RATIONAL
Definition:
opt.h:227
print_option
static void print_option(const AVOption *opts, const AVOption *o, int per_stream)
Definition:
print_options.c:42
main
int main(int argc, char **argv)
Definition:
main.c:22
Generated on Tue Dec 3 2013 09:58:01 for FFmpeg by
1.8.5