[FFmpeg-devel] [PATCH 3/3] cmdutils: add -channel_layouts option.
Nicolas George
nicolas.george at normalesup.org
Mon Jul 30 00:40:09 CEST 2012
Extract of the output:
Channel layouts:
NAME DESCRIPTION
FL front left
<snip>
SDR surround direct right
mono FC
stereo FL+FR
<snip>
octagonal FL+FR+FC+BL+BR+BC+SL+SR
downmix DL+DR
Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
cmdutils.c | 28 ++++++++++++++++++++++++++++
cmdutils.h | 7 +++++++
cmdutils_common_opts.h | 1 +
doc/avtools-common-opts.texi | 3 +++
4 files changed, 39 insertions(+)
diff --git a/cmdutils.c b/cmdutils.c
index edeab93..9f00429 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -979,6 +979,34 @@ int opt_pix_fmts(const char *opt, const char *arg)
return 0;
}
+int opt_channel_layouts(const char *opt, const char *arg)
+{
+ int i = 0;
+ uint64_t layout, j;
+ const char *name, *descr;
+
+ printf("Channel layouts:\n"
+ "NAME DESCRIPTION\n");
+ while (!av_get_standard_channel_layout(i++, &layout, &name, &descr)) {
+ if (name) {
+ printf("%-12s", name);
+ if (descr) {
+ printf("%s", descr);
+ } else {
+ const char *sep = "";
+ for (j = 1; j; j <<= 1) {
+ if ((layout & j)) {
+ printf("%s%s", sep, av_get_channel_name(j));
+ sep = "+";
+ }
+ }
+ }
+ printf("\n");
+ }
+ }
+ return 0;
+}
+
int show_sample_fmts(const char *opt, const char *arg)
{
int i;
diff --git a/cmdutils.h b/cmdutils.h
index 925df50..95339b2 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -329,6 +329,13 @@ int opt_protocols(const char *opt, const char *arg);
int opt_pix_fmts(const char *opt, const char *arg);
/**
+ * Print a listing containing all the standard channel layouts supported by
+ * the program.
+ * This option processing function does not utilize the arguments.
+ */
+int opt_channel_layouts(const char *opt, const char *arg);
+
+/**
* Print a listing containing all the sample formats supported by the
* program.
*/
diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h
index 855cb88..314855b 100644
--- a/cmdutils_common_opts.h
+++ b/cmdutils_common_opts.h
@@ -10,6 +10,7 @@
{ "protocols", OPT_EXIT, {(void*)opt_protocols}, "show available protocols" },
{ "filters", OPT_EXIT, {(void*)opt_filters }, "show available filters" },
{ "pix_fmts" , OPT_EXIT, {(void*)opt_pix_fmts }, "show available pixel formats" },
+ { "channel_layouts", OPT_EXIT, {(void*)opt_channel_layouts }, "show standard channel layouts" },
{ "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
{ "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
{ "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi
index b05b5fa..3259ced 100644
--- a/doc/avtools-common-opts.texi
+++ b/doc/avtools-common-opts.texi
@@ -105,6 +105,9 @@ Show available pixel formats.
@item -sample_fmts
Show available sample formats.
+ at item -channel_layouts
+Show standard channel layouts.
+
@item -loglevel @var{loglevel} | -v @var{loglevel}
Set the logging level used by the library.
@var{loglevel} is a number or a string containing one of the following values:
--
1.7.10.4
More information about the ffmpeg-devel
mailing list