FFmpeg
Loading...
Searching...
No Matches
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
94 -1
95};
96
97int main(void)
98{
99 AVChannelLayout layout = { 0 };
100 const int64_t *cl;
101 char buf[512];
102 int i;
103 const char *teststrings[] ={
104 "blah",
105 "1",
106 "2",
107 "-1",
108 "60",
109 "65",
110 "1c",
111 "2c",
112 "-1c",
113 "60c",
114 "65c",
115 "2C",
116 "60C",
117 "65C",
118 "5.1",
119 "stereo",
120 "0x3",
121 };
122
123 for (cl = avfilter_all_channel_layouts; *cl != -1; cl++) {
125 av_channel_layout_describe(&layout, buf, sizeof(buf));
126 printf("%s\n", buf);
128 }
129
130 for ( i = 0; i<FF_ARRAY_ELEMS(teststrings); i++) {
131 int count = -1;
132 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.order == AV_CHANNEL_ORDER_NATIVE ? layout.u.mask : 0, count, teststrings[i]);
137 }
138
139 return 0;
140}
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:99
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
Public libavutil channel layout APIs header.
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
__device__ int printf(const char *,...)
#define AV_CH_SIDE_LEFT
#define AV_CH_FRONT_RIGHT
#define AV_CH_BACK_CENTER
#define AV_CH_BACK_RIGHT
#define AV_CH_FRONT_CENTER
#define AV_CH_SIDE_RIGHT
#define AV_CH_BACK_LEFT
#define AV_CH_LOW_FREQUENCY
#define AV_CH_STEREO_RIGHT
#define AV_CH_STEREO_LEFT
#define AV_CH_FRONT_LEFT
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
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.
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.
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
uint64_t layout
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
int main(void)
Definition formats.c:97
const int64_t avfilter_all_channel_layouts[]
Definition formats.c:25