1 /*
2 * RAW PCM demuxers
3 * Copyright (c) 2002 Fabrice Bellard
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "config_components.h"
23
34
40
42 {
46 uint8_t *mime_type =
NULL;
48
50 if (!st)
53
60
62 if (mime_type &&
s->iformat->mime_type) {
63 int rate = 0,
channels = 0, little_endian = 0;
68 if (!rate)
69 sscanf(
options,
" rate=%d", &rate);
72 if (!little_endian) {
73 char val[
sizeof(
"little-endian")];
74 if (sscanf(
options,
" endianness=%13s",
val) == 1) {
75 little_endian = strcmp(
val,
"little-endian") == 0;
76 }
77 }
78 }
79 if (rate <= 0) {
81 "Invalid sample_rate found in mime_type \"%s\"\n",
82 mime_type);
85 }
90 }
91 if (little_endian)
93 }
94 }
96
98
100
102
104 return 0;
105 }
106
111 };
117 };
118
119 #define PCMDEF_0(name_, long_name_, ext, codec, ...)
120 #define PCMDEF_1(name_, long_name_, ext, codec, ...) \
121 const FFInputFormat ff_pcm_ ## name_ ## _demuxer = { \
122 .p.name = #name_, \
123 .p.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
124 .p.flags = AVFMT_GENERIC_INDEX, \
125 .p.extensions = ext, \
126 .p.priv_class = &pcm_demuxer_class, \
127 .priv_data_size = sizeof(PCMAudioDemuxerContext), \
128 .read_header = pcm_read_header, \
129 .read_packet = ff_pcm_read_packet, \
130 .read_seek = ff_pcm_read_seek, \
131 .raw_codec_id = codec, \
132 __VA_ARGS__ \
133 };
134 #define PCMDEF_2(name, long_name, ext, codec, enabled, ...) \
135 PCMDEF_ ## enabled(name, long_name, ext, codec, __VA_ARGS__)
136 #define PCMDEF_3(name, long_name, ext, codec, config, ...) \
137 PCMDEF_2(name, long_name, ext, codec, config, __VA_ARGS__)
138 #define PCMDEF_EXT(name, long_name, ext, uppercase, ...) \
139 PCMDEF_3(name, long_name, ext, AV_CODEC_ID_PCM_ ## uppercase, \
140 CONFIG_PCM_ ## uppercase ## _DEMUXER, __VA_ARGS__)
141 #define PCMDEF(name, long_name, ext, uppercase) \
142 PCMDEF_EXT(name, long_name, ext, uppercase, )
143
144 PCMDEF(f64be,
"PCM 64-bit floating-point big-endian",
NULL, F64BE)
145 PCMDEF(f64le,
"PCM 64-bit floating-point little-endian",
NULL, F64LE)
146 PCMDEF(f32be,
"PCM 32-bit floating-point big-endian",
NULL, F32BE)
147 PCMDEF(f32le,
"PCM 32-bit floating-point little-endian",
NULL, F32LE)
148 PCMDEF(s32be,
"PCM signed 32-bit big-endian",
NULL, S32BE)
149 PCMDEF(s32le,
"PCM signed 32-bit little-endian",
NULL, S32LE)
150 PCMDEF(s24be,
"PCM signed 24-bit big-endian",
NULL, S24BE)
151 PCMDEF(s24le,
"PCM signed 24-bit little-endian",
NULL, S24LE)
152 PCMDEF_EXT(s16be,
"PCM signed 16-bit big-endian",
153 AV_NE(
"sw",
NULL), S16BE, .p.mime_type =
"audio/L16")
166
167 #if CONFIG_SLN_DEMUXER
168 static const AVOption sln_options[] = {
172 };
173
174 static const AVClass sln_demuxer_class = {
177 .option = sln_options,
179 };
180
185 .p.extensions = "sln",
186 .p.priv_class = &sln_demuxer_class,
192 };
193 #endif