FFmpeg
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 
22 #include "libavfilter/audio.h"
23 #include "libavfilter/formats.c"
24 
25 #undef printf
26 
96  -1
97 };
98 
99 int main(void)
100 {
101  AVChannelLayout layout = { 0 };
102  const int64_t *cl;
103  char buf[512];
104  int i;
105  const char *teststrings[] ={
106  "blah",
107  "1",
108  "2",
109  "-1",
110  "60",
111  "65",
112  "1c",
113  "2c",
114  "-1c",
115  "60c",
116  "65c",
117  "2C",
118  "60C",
119  "65C",
120  "5.1",
121  "stereo",
122  "0x3",
123  };
124 
125  for (cl = avfilter_all_channel_layouts; *cl != -1; cl++) {
127  av_channel_layout_describe(&layout, buf, sizeof(buf));
128  printf("%s\n", buf);
130  }
131 
132  for ( i = 0; i<FF_ARRAY_ELEMS(teststrings); i++) {
133  int count = -1;
134  int ret;
136  ret = ff_parse_channel_layout(&layout, &count, teststrings[i], NULL);
137 
138  printf ("%d = ff_parse_channel_layout(%016"PRIX64", %2d, %s);\n", ret ? -1 : 0, layout.order == AV_CHANNEL_ORDER_NATIVE ? layout.u.mask : 0, count, teststrings[i]);
139  }
140 
141  return 0;
142 }
int64_t
long long int64_t
Definition: coverity.c:34
AV_CH_BACK_LEFT
#define AV_CH_BACK_LEFT
Definition: channel_layout.h:179
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
AV_CH_LOW_FREQUENCY
#define AV_CH_LOW_FREQUENCY
Definition: channel_layout.h:178
av_channel_layout_describe
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
Definition: channel_layout.c:653
av_channel_layout_from_mask
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
Definition: channel_layout.c:252
avfilter_all_channel_layouts
const int64_t avfilter_all_channel_layouts[]
Definition: formats.c:27
ff_parse_channel_layout
int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg, void *log_ctx)
Parse a channel layout or a corresponding integer representation.
Definition: audio.c:123
AV_CH_STEREO_RIGHT
#define AV_CH_STEREO_RIGHT
Definition: channel_layout.h:194
NULL
#define NULL
Definition: coverity.c:32
main
int main(void)
Definition: formats.c:99
AV_CH_FRONT_CENTER
#define AV_CH_FRONT_CENTER
Definition: channel_layout.h:177
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:319
printf
printf("static const uint8_t my_array[100] = {\n")
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:125
layout
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
Definition: filter_design.txt:18
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:183
AV_CH_FRONT_LEFT
#define AV_CH_FRONT_LEFT
Definition: channel_layout.h:175
AV_CH_SIDE_RIGHT
#define AV_CH_SIDE_RIGHT
Definition: channel_layout.h:185
ret
ret
Definition: filter_design.txt:187
channel_layout.h
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:442
AV_CH_FRONT_RIGHT
#define AV_CH_FRONT_RIGHT
Definition: channel_layout.h:176
formats.c
audio.h
AV_CH_BACK_RIGHT
#define AV_CH_BACK_RIGHT
Definition: channel_layout.h:180
AV_CH_STEREO_LEFT
#define AV_CH_STEREO_LEFT
Definition: channel_layout.h:193
AV_CH_SIDE_LEFT
#define AV_CH_SIDE_LEFT
Definition: channel_layout.h:184