FFmpeg  4.3
formats.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Bobby Bingham
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 #include "libavfilter/formats.c"
22 
23 #undef printf
24 
25 const int64_t avfilter_all_channel_layouts[] = {
94  -1
95 };
96 
97 int main(void)
98 {
99  const int64_t *cl;
100  char buf[512];
101  int i;
102  const char *teststrings[] ={
103  "blah",
104  "1",
105  "2",
106  "-1",
107  "60",
108  "65",
109  "1c",
110  "2c",
111  "-1c",
112  "60c",
113  "65c",
114  "2C",
115  "60C",
116  "65C",
117  "5.1",
118  "stereo",
119  "1+1+1+1",
120  "1c+1c+1c+1c",
121  "2c+1c",
122  "0x3",
123  };
124 
125  for (cl = avfilter_all_channel_layouts; *cl != -1; cl++) {
126  av_get_channel_layout_string(buf, sizeof(buf), -1, *cl);
127  printf("%s\n", buf);
128  }
129 
130  for ( i = 0; i<FF_ARRAY_ELEMS(teststrings); i++) {
131  int64_t layout = -1;
132  int count = -1;
133  int ret;
134  ret = ff_parse_channel_layout(&layout, &count, teststrings[i], NULL);
135 
136  printf ("%d = ff_parse_channel_layout(%016"PRIX64", %2d, %s);\n", ret ? -1 : 0, layout, count, teststrings[i]);
137  }
138 
139  return 0;
140 }
#define NULL
Definition: coverity.c:32
#define AV_CH_LOW_FREQUENCY
#define AV_CH_BACK_LEFT
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, void *log_ctx)
Parse a channel layout or a corresponding integer representation.
Definition: formats.c:694
#define AV_CH_STEREO_RIGHT
See AV_CH_STEREO_LEFT.
#define AV_CH_FRONT_CENTER
#define FF_ARRAY_ELEMS(a)
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
#define AV_CH_FRONT_LEFT
int main(void)
Definition: formats.c:97
const int64_t avfilter_all_channel_layouts[]
Definition: formats.c:25
#define AV_CH_BACK_CENTER
#define AV_CH_SIDE_RIGHT
uint64_t layout
#define AV_CH_FRONT_RIGHT
#define AV_CH_SIDE_LEFT
#define AV_CH_BACK_RIGHT
#define AV_CH_STEREO_LEFT
Stereo downmix.