FFmpeg
opt_common.h
Go to the documentation of this file.
1 /*
2  * Option handlers shared between the tools.
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 #ifndef FFTOOLS_OPT_COMMON_H
22 #define FFTOOLS_OPT_COMMON_H
23 
24 #include "config.h"
25 
26 #include "cmdutils.h"
27 
28 #if CONFIG_AVDEVICE
29 /**
30  * Print a listing containing autodetected sinks of the output device.
31  * Device name with options may be passed as an argument to limit results.
32  */
33 int show_sinks(void *optctx, const char *opt, const char *arg);
34 
35 /**
36  * Print a listing containing autodetected sources of the input device.
37  * Device name with options may be passed as an argument to limit results.
38  */
39 int show_sources(void *optctx, const char *opt, const char *arg);
40 #endif
41 
42 #if CONFIG_AVDEVICE
43 #define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
44  { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
45  "list sources of the input device", "device" }, \
46  { "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
47  "list sinks of the output device", "device" }, \
48 
49 #else
50 #define CMDUTILS_COMMON_OPTIONS_AVDEVICE
51 #endif
52 
53 /**
54  * Print the license of the program to stdout. The license depends on
55  * the license of the libraries compiled into the program.
56  * This option processing function does not utilize the arguments.
57  */
58 int show_license(void *optctx, const char *opt, const char *arg);
59 
60 /**
61  * Generic -h handler common to all fftools.
62  */
63 int show_help(void *optctx, const char *opt, const char *arg);
64 
65 /**
66  * Print the version of the program to stdout. The version message
67  * depends on the current versions of the repository and of the libav*
68  * libraries.
69  * This option processing function does not utilize the arguments.
70  */
71 int show_version(void *optctx, const char *opt, const char *arg);
72 
73 /**
74  * Print the build configuration of the program to stdout. The contents
75  * depend on the definition of FFMPEG_CONFIGURATION.
76  * This option processing function does not utilize the arguments.
77  */
78 int show_buildconf(void *optctx, const char *opt, const char *arg);
79 
80 /**
81  * Print a listing containing all the formats supported by the
82  * program (including devices).
83  * This option processing function does not utilize the arguments.
84  */
85 int show_formats(void *optctx, const char *opt, const char *arg);
86 
87 /**
88  * Print a listing containing all the muxers supported by the
89  * program (including devices).
90  * This option processing function does not utilize the arguments.
91  */
92 int show_muxers(void *optctx, const char *opt, const char *arg);
93 
94 /**
95  * Print a listing containing all the demuxer supported by the
96  * program (including devices).
97  * This option processing function does not utilize the arguments.
98  */
99 int show_demuxers(void *optctx, const char *opt, const char *arg);
100 
101 /**
102  * Print a listing containing all the devices supported by the
103  * program.
104  * This option processing function does not utilize the arguments.
105  */
106 int show_devices(void *optctx, const char *opt, const char *arg);
107 
108 /**
109  * Print a listing containing all the codecs supported by the
110  * program.
111  * This option processing function does not utilize the arguments.
112  */
113 int show_codecs(void *optctx, const char *opt, const char *arg);
114 
115 /**
116  * Print a listing containing all the decoders supported by the
117  * program.
118  */
119 int show_decoders(void *optctx, const char *opt, const char *arg);
120 
121 /**
122  * Print a listing containing all the encoders supported by the
123  * program.
124  */
125 int show_encoders(void *optctx, const char *opt, const char *arg);
126 
127 /**
128  * Print a listing containing all the bit stream filters supported by the
129  * program.
130  * This option processing function does not utilize the arguments.
131  */
132 int show_bsfs(void *optctx, const char *opt, const char *arg);
133 
134 /**
135  * Print a listing containing all the protocols supported by the
136  * program.
137  * This option processing function does not utilize the arguments.
138  */
139 int show_protocols(void *optctx, const char *opt, const char *arg);
140 
141 /**
142  * Print a listing containing all the filters supported by the
143  * program.
144  * This option processing function does not utilize the arguments.
145  */
146 int show_filters(void *optctx, const char *opt, const char *arg);
147 
148 /**
149  * Print a listing containing all the pixel formats supported by the
150  * program.
151  * This option processing function does not utilize the arguments.
152  */
153 int show_pix_fmts(void *optctx, const char *opt, const char *arg);
154 
155 /**
156  * Print a listing containing all the standard channel layouts supported by
157  * the program.
158  * This option processing function does not utilize the arguments.
159  */
160 int show_layouts(void *optctx, const char *opt, const char *arg);
161 
162 /**
163  * Print a listing containing all the sample formats supported by the
164  * program.
165  */
166 int show_sample_fmts(void *optctx, const char *opt, const char *arg);
167 
168 /**
169  * Print a listing containing all supported stream dispositions.
170  */
171 int show_dispositions(void *optctx, const char *opt, const char *arg);
172 
173 /**
174  * Print a listing containing all the color names and values recognized
175  * by the program.
176  */
177 int show_colors(void *optctx, const char *opt, const char *arg);
178 
179 /**
180  * Set the libav* libraries log level.
181  */
182 int opt_loglevel(void *optctx, const char *opt, const char *arg);
183 
184 int opt_report(void *optctx, const char *opt, const char *arg);
185 int init_report(const char *env, FILE **file);
186 
187 int opt_max_alloc(void *optctx, const char *opt, const char *arg);
188 
189 /**
190  * Override the cpuflags.
191  */
192 int opt_cpuflags(void *optctx, const char *opt, const char *arg);
193 
194 /**
195  * Override the cpucount.
196  */
197 int opt_cpucount(void *optctx, const char *opt, const char *arg);
198 
199 #define CMDUTILS_COMMON_OPTIONS \
200  { "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
201  { "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
202  { "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
203  { "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
204  { "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
205  { "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
206  { "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
207  { "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
208  { "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
209  { "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
210  { "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
211  { "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
212  { "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
213  { "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
214  { "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
215  { "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
216  { "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
217  { "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
218  { "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
219  { "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
220  { "dispositions", OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
221  { "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
222  { "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
223  { "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
224  { "report", 0, { .func_arg = opt_report }, "generate a report" }, \
225  { "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
226  { "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
227  { "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
228  { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
229  CMDUTILS_COMMON_OPTIONS_AVDEVICE \
230 
231 #endif /* FFTOOLS_OPT_COMMON_H */
show_buildconf
int show_buildconf(void *optctx, const char *opt, const char *arg)
Print the build configuration of the program to stdout.
Definition: opt_common.c:257
show_demuxers
int show_demuxers(void *optctx, const char *opt, const char *arg)
Print a listing containing all the demuxer supported by the program (including devices).
Definition: opt_common.c:917
show_version
int show_version(void *optctx, const char *opt, const char *arg)
Print the version of the program to stdout.
Definition: opt_common.c:248
show_bsfs
int show_bsfs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the bit stream filters supported by the program.
Definition: opt_common.c:776
opt_cpucount
int opt_cpucount(void *optctx, const char *opt, const char *arg)
Override the cpucount.
Definition: opt_common.c:1058
show_protocols
int show_protocols(void *optctx, const char *opt, const char *arg)
Print a listing containing all the protocols supported by the program.
Definition: opt_common.c:927
show_dispositions
int show_dispositions(void *optctx, const char *opt, const char *arg)
Print a listing containing all supported stream dispositions.
Definition: opt_common.c:1036
init_report
int init_report(const char *env, FILE **file)
Definition: opt_common.c:1128
show_license
int show_license(void *optctx, const char *opt, const char *arg)
Print the license of the program to stdout.
Definition: opt_common.c:75
show_encoders
int show_encoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the encoders supported by the program.
Definition: opt_common.c:770
arg
const char * arg
Definition: jacosubdec.c:67
opt_loglevel
int opt_loglevel(void *optctx, const char *opt, const char *arg)
Set the libav* libraries log level.
Definition: opt_common.c:1229
show_colors
int show_colors(void *optctx, const char *opt, const char *arg)
Print a listing containing all the color names and values recognized by the program.
Definition: opt_common.c:942
show_decoders
int show_decoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the decoders supported by the program.
Definition: opt_common.c:764
opt_max_alloc
int opt_max_alloc(void *optctx, const char *opt, const char *arg)
Definition: opt_common.c:1215
show_codecs
int show_codecs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the codecs supported by the program.
Definition: opt_common.c:667
opt_report
int opt_report(void *optctx, const char *opt, const char *arg)
Definition: opt_common.c:1210
show_pix_fmts
int show_pix_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the pixel formats supported by the program.
Definition: opt_common.c:956
show_sample_fmts
int show_sample_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the sample formats supported by the program.
Definition: opt_common.c:1027
show_layouts
int show_layouts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the standard channel layouts supported by the program.
Definition: opt_common.c:994
show_formats
int show_formats(void *optctx, const char *opt, const char *arg)
Print a listing containing all the formats supported by the program (including devices).
Definition: opt_common.c:907
opt_cpuflags
int opt_cpuflags(void *optctx, const char *opt, const char *arg)
Override the cpuflags.
Definition: opt_common.c:1046
show_muxers
int show_muxers(void *optctx, const char *opt, const char *arg)
Print a listing containing all the muxers supported by the program (including devices).
Definition: opt_common.c:912
show_filters
int show_filters(void *optctx, const char *opt, const char *arg)
Print a listing containing all the filters supported by the program.
Definition: opt_common.c:788
show_devices
int show_devices(void *optctx, const char *opt, const char *arg)
Print a listing containing all the devices supported by the program.
Definition: opt_common.c:922
cmdutils.h
show_help
int show_help(void *optctx, const char *opt, const char *arg)
Generic -h handler common to all fftools.
Definition: opt_common.c:574