1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * Option handlers shared between the tools.
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * This file is part of FFmpeg.
5cabdff1aSopenharmony_ci *
6cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
7cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
8cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
9cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
10cabdff1aSopenharmony_ci *
11cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
12cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
13cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14cabdff1aSopenharmony_ci * Lesser General Public License for more details.
15cabdff1aSopenharmony_ci *
16cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
17cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
18cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19cabdff1aSopenharmony_ci */
20cabdff1aSopenharmony_ci
21cabdff1aSopenharmony_ci#ifndef FFTOOLS_OPT_COMMON_H
22cabdff1aSopenharmony_ci#define FFTOOLS_OPT_COMMON_H
23cabdff1aSopenharmony_ci
24cabdff1aSopenharmony_ci#include "config.h"
25cabdff1aSopenharmony_ci
26cabdff1aSopenharmony_ci#include "cmdutils.h"
27cabdff1aSopenharmony_ci
28cabdff1aSopenharmony_ci#if CONFIG_AVDEVICE
29cabdff1aSopenharmony_ci/**
30cabdff1aSopenharmony_ci * Print a listing containing autodetected sinks of the output device.
31cabdff1aSopenharmony_ci * Device name with options may be passed as an argument to limit results.
32cabdff1aSopenharmony_ci */
33cabdff1aSopenharmony_ciint show_sinks(void *optctx, const char *opt, const char *arg);
34cabdff1aSopenharmony_ci
35cabdff1aSopenharmony_ci/**
36cabdff1aSopenharmony_ci * Print a listing containing autodetected sources of the input device.
37cabdff1aSopenharmony_ci * Device name with options may be passed as an argument to limit results.
38cabdff1aSopenharmony_ci */
39cabdff1aSopenharmony_ciint show_sources(void *optctx, const char *opt, const char *arg);
40cabdff1aSopenharmony_ci#endif
41cabdff1aSopenharmony_ci
42cabdff1aSopenharmony_ci#if CONFIG_AVDEVICE
43cabdff1aSopenharmony_ci#define CMDUTILS_COMMON_OPTIONS_AVDEVICE                                                                                \
44cabdff1aSopenharmony_ci    { "sources"    , OPT_EXIT | HAS_ARG, { .func_arg = show_sources },                                                  \
45cabdff1aSopenharmony_ci      "list sources of the input device", "device" },                                                                   \
46cabdff1aSopenharmony_ci    { "sinks"      , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks },                                                    \
47cabdff1aSopenharmony_ci      "list sinks of the output device", "device" },                                                                    \
48cabdff1aSopenharmony_ci
49cabdff1aSopenharmony_ci#else
50cabdff1aSopenharmony_ci#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
51cabdff1aSopenharmony_ci#endif
52cabdff1aSopenharmony_ci
53cabdff1aSopenharmony_ci/**
54cabdff1aSopenharmony_ci * Print the license of the program to stdout. The license depends on
55cabdff1aSopenharmony_ci * the license of the libraries compiled into the program.
56cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
57cabdff1aSopenharmony_ci */
58cabdff1aSopenharmony_ciint show_license(void *optctx, const char *opt, const char *arg);
59cabdff1aSopenharmony_ci
60cabdff1aSopenharmony_ci/**
61cabdff1aSopenharmony_ci * Generic -h handler common to all fftools.
62cabdff1aSopenharmony_ci */
63cabdff1aSopenharmony_ciint show_help(void *optctx, const char *opt, const char *arg);
64cabdff1aSopenharmony_ci
65cabdff1aSopenharmony_ci/**
66cabdff1aSopenharmony_ci * Print the version of the program to stdout. The version message
67cabdff1aSopenharmony_ci * depends on the current versions of the repository and of the libav*
68cabdff1aSopenharmony_ci * libraries.
69cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
70cabdff1aSopenharmony_ci */
71cabdff1aSopenharmony_ciint show_version(void *optctx, const char *opt, const char *arg);
72cabdff1aSopenharmony_ci
73cabdff1aSopenharmony_ci/**
74cabdff1aSopenharmony_ci * Print the build configuration of the program to stdout. The contents
75cabdff1aSopenharmony_ci * depend on the definition of FFMPEG_CONFIGURATION.
76cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
77cabdff1aSopenharmony_ci */
78cabdff1aSopenharmony_ciint show_buildconf(void *optctx, const char *opt, const char *arg);
79cabdff1aSopenharmony_ci
80cabdff1aSopenharmony_ci/**
81cabdff1aSopenharmony_ci * Print a listing containing all the formats supported by the
82cabdff1aSopenharmony_ci * program (including devices).
83cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
84cabdff1aSopenharmony_ci */
85cabdff1aSopenharmony_ciint show_formats(void *optctx, const char *opt, const char *arg);
86cabdff1aSopenharmony_ci
87cabdff1aSopenharmony_ci/**
88cabdff1aSopenharmony_ci * Print a listing containing all the muxers supported by the
89cabdff1aSopenharmony_ci * program (including devices).
90cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
91cabdff1aSopenharmony_ci */
92cabdff1aSopenharmony_ciint show_muxers(void *optctx, const char *opt, const char *arg);
93cabdff1aSopenharmony_ci
94cabdff1aSopenharmony_ci/**
95cabdff1aSopenharmony_ci * Print a listing containing all the demuxer supported by the
96cabdff1aSopenharmony_ci * program (including devices).
97cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
98cabdff1aSopenharmony_ci */
99cabdff1aSopenharmony_ciint show_demuxers(void *optctx, const char *opt, const char *arg);
100cabdff1aSopenharmony_ci
101cabdff1aSopenharmony_ci/**
102cabdff1aSopenharmony_ci * Print a listing containing all the devices supported by the
103cabdff1aSopenharmony_ci * program.
104cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
105cabdff1aSopenharmony_ci */
106cabdff1aSopenharmony_ciint show_devices(void *optctx, const char *opt, const char *arg);
107cabdff1aSopenharmony_ci
108cabdff1aSopenharmony_ci/**
109cabdff1aSopenharmony_ci * Print a listing containing all the codecs supported by the
110cabdff1aSopenharmony_ci * program.
111cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
112cabdff1aSopenharmony_ci */
113cabdff1aSopenharmony_ciint show_codecs(void *optctx, const char *opt, const char *arg);
114cabdff1aSopenharmony_ci
115cabdff1aSopenharmony_ci/**
116cabdff1aSopenharmony_ci * Print a listing containing all the decoders supported by the
117cabdff1aSopenharmony_ci * program.
118cabdff1aSopenharmony_ci */
119cabdff1aSopenharmony_ciint show_decoders(void *optctx, const char *opt, const char *arg);
120cabdff1aSopenharmony_ci
121cabdff1aSopenharmony_ci/**
122cabdff1aSopenharmony_ci * Print a listing containing all the encoders supported by the
123cabdff1aSopenharmony_ci * program.
124cabdff1aSopenharmony_ci */
125cabdff1aSopenharmony_ciint show_encoders(void *optctx, const char *opt, const char *arg);
126cabdff1aSopenharmony_ci
127cabdff1aSopenharmony_ci/**
128cabdff1aSopenharmony_ci * Print a listing containing all the bit stream filters supported by the
129cabdff1aSopenharmony_ci * program.
130cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
131cabdff1aSopenharmony_ci */
132cabdff1aSopenharmony_ciint show_bsfs(void *optctx, const char *opt, const char *arg);
133cabdff1aSopenharmony_ci
134cabdff1aSopenharmony_ci/**
135cabdff1aSopenharmony_ci * Print a listing containing all the protocols supported by the
136cabdff1aSopenharmony_ci * program.
137cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
138cabdff1aSopenharmony_ci */
139cabdff1aSopenharmony_ciint show_protocols(void *optctx, const char *opt, const char *arg);
140cabdff1aSopenharmony_ci
141cabdff1aSopenharmony_ci/**
142cabdff1aSopenharmony_ci * Print a listing containing all the filters supported by the
143cabdff1aSopenharmony_ci * program.
144cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
145cabdff1aSopenharmony_ci */
146cabdff1aSopenharmony_ciint show_filters(void *optctx, const char *opt, const char *arg);
147cabdff1aSopenharmony_ci
148cabdff1aSopenharmony_ci/**
149cabdff1aSopenharmony_ci * Print a listing containing all the pixel formats supported by the
150cabdff1aSopenharmony_ci * program.
151cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
152cabdff1aSopenharmony_ci */
153cabdff1aSopenharmony_ciint show_pix_fmts(void *optctx, const char *opt, const char *arg);
154cabdff1aSopenharmony_ci
155cabdff1aSopenharmony_ci/**
156cabdff1aSopenharmony_ci * Print a listing containing all the standard channel layouts supported by
157cabdff1aSopenharmony_ci * the program.
158cabdff1aSopenharmony_ci * This option processing function does not utilize the arguments.
159cabdff1aSopenharmony_ci */
160cabdff1aSopenharmony_ciint show_layouts(void *optctx, const char *opt, const char *arg);
161cabdff1aSopenharmony_ci
162cabdff1aSopenharmony_ci/**
163cabdff1aSopenharmony_ci * Print a listing containing all the sample formats supported by the
164cabdff1aSopenharmony_ci * program.
165cabdff1aSopenharmony_ci */
166cabdff1aSopenharmony_ciint show_sample_fmts(void *optctx, const char *opt, const char *arg);
167cabdff1aSopenharmony_ci
168cabdff1aSopenharmony_ci/**
169cabdff1aSopenharmony_ci * Print a listing containing all supported stream dispositions.
170cabdff1aSopenharmony_ci */
171cabdff1aSopenharmony_ciint show_dispositions(void *optctx, const char *opt, const char *arg);
172cabdff1aSopenharmony_ci
173cabdff1aSopenharmony_ci/**
174cabdff1aSopenharmony_ci * Print a listing containing all the color names and values recognized
175cabdff1aSopenharmony_ci * by the program.
176cabdff1aSopenharmony_ci */
177cabdff1aSopenharmony_ciint show_colors(void *optctx, const char *opt, const char *arg);
178cabdff1aSopenharmony_ci
179cabdff1aSopenharmony_ci/**
180cabdff1aSopenharmony_ci * Set the libav* libraries log level.
181cabdff1aSopenharmony_ci */
182cabdff1aSopenharmony_ciint opt_loglevel(void *optctx, const char *opt, const char *arg);
183cabdff1aSopenharmony_ci
184cabdff1aSopenharmony_ciint opt_report(void *optctx, const char *opt, const char *arg);
185cabdff1aSopenharmony_ciint init_report(const char *env, FILE **file);
186cabdff1aSopenharmony_ci
187cabdff1aSopenharmony_ciint opt_max_alloc(void *optctx, const char *opt, const char *arg);
188cabdff1aSopenharmony_ci
189cabdff1aSopenharmony_ci/**
190cabdff1aSopenharmony_ci * Override the cpuflags.
191cabdff1aSopenharmony_ci */
192cabdff1aSopenharmony_ciint opt_cpuflags(void *optctx, const char *opt, const char *arg);
193cabdff1aSopenharmony_ci
194cabdff1aSopenharmony_ci/**
195cabdff1aSopenharmony_ci * Override the cpucount.
196cabdff1aSopenharmony_ci */
197cabdff1aSopenharmony_ciint opt_cpucount(void *optctx, const char *opt, const char *arg);
198cabdff1aSopenharmony_ci
199cabdff1aSopenharmony_ci#define CMDUTILS_COMMON_OPTIONS                                                                                         \
200cabdff1aSopenharmony_ci    { "L",           OPT_EXIT,             { .func_arg = show_license },     "show license" },                          \
201cabdff1aSopenharmony_ci    { "h",           OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
202cabdff1aSopenharmony_ci    { "?",           OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
203cabdff1aSopenharmony_ci    { "help",        OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
204cabdff1aSopenharmony_ci    { "-help",       OPT_EXIT,             { .func_arg = show_help },        "show help", "topic" },                    \
205cabdff1aSopenharmony_ci    { "version",     OPT_EXIT,             { .func_arg = show_version },     "show version" },                          \
206cabdff1aSopenharmony_ci    { "buildconf",   OPT_EXIT,             { .func_arg = show_buildconf },   "show build configuration" },              \
207cabdff1aSopenharmony_ci    { "formats",     OPT_EXIT,             { .func_arg = show_formats },     "show available formats" },                \
208cabdff1aSopenharmony_ci    { "muxers",      OPT_EXIT,             { .func_arg = show_muxers },      "show available muxers" },                 \
209cabdff1aSopenharmony_ci    { "demuxers",    OPT_EXIT,             { .func_arg = show_demuxers },    "show available demuxers" },               \
210cabdff1aSopenharmony_ci    { "devices",     OPT_EXIT,             { .func_arg = show_devices },     "show available devices" },                \
211cabdff1aSopenharmony_ci    { "codecs",      OPT_EXIT,             { .func_arg = show_codecs },      "show available codecs" },                 \
212cabdff1aSopenharmony_ci    { "decoders",    OPT_EXIT,             { .func_arg = show_decoders },    "show available decoders" },               \
213cabdff1aSopenharmony_ci    { "encoders",    OPT_EXIT,             { .func_arg = show_encoders },    "show available encoders" },               \
214cabdff1aSopenharmony_ci    { "bsfs",        OPT_EXIT,             { .func_arg = show_bsfs },        "show available bit stream filters" },     \
215cabdff1aSopenharmony_ci    { "protocols",   OPT_EXIT,             { .func_arg = show_protocols },   "show available protocols" },              \
216cabdff1aSopenharmony_ci    { "filters",     OPT_EXIT,             { .func_arg = show_filters },     "show available filters" },                \
217cabdff1aSopenharmony_ci    { "pix_fmts",    OPT_EXIT,             { .func_arg = show_pix_fmts },    "show available pixel formats" },          \
218cabdff1aSopenharmony_ci    { "layouts",     OPT_EXIT,             { .func_arg = show_layouts },     "show standard channel layouts" },         \
219cabdff1aSopenharmony_ci    { "sample_fmts", OPT_EXIT,             { .func_arg = show_sample_fmts }, "show available audio sample formats" },   \
220cabdff1aSopenharmony_ci    { "dispositions", OPT_EXIT,            { .func_arg = show_dispositions}, "show available stream dispositions" },    \
221cabdff1aSopenharmony_ci    { "colors",      OPT_EXIT,             { .func_arg = show_colors },      "show available color names" },            \
222cabdff1aSopenharmony_ci    { "loglevel",    HAS_ARG,              { .func_arg = opt_loglevel },     "set logging level", "loglevel" },         \
223cabdff1aSopenharmony_ci    { "v",           HAS_ARG,              { .func_arg = opt_loglevel },     "set logging level", "loglevel" },         \
224cabdff1aSopenharmony_ci    { "report",      0,                    { .func_arg = opt_report },       "generate a report" },                     \
225cabdff1aSopenharmony_ci    { "max_alloc",   HAS_ARG,              { .func_arg = opt_max_alloc },    "set maximum size of a single allocated block", "bytes" }, \
226cabdff1aSopenharmony_ci    { "cpuflags",    HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags },     "force specific cpu flags", "flags" },     \
227cabdff1aSopenharmony_ci    { "cpucount",    HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount },     "force specific cpu count", "count" },     \
228cabdff1aSopenharmony_ci    { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner},     "do not show program banner", "hide_banner" },          \
229cabdff1aSopenharmony_ci    CMDUTILS_COMMON_OPTIONS_AVDEVICE                                                                                    \
230cabdff1aSopenharmony_ci
231cabdff1aSopenharmony_ci#endif /* FFTOOLS_OPT_COMMON_H */
232