66 static const uint32_t frequencies[4] = { 48000, 96000, 44100, 32000 };
68 int header_int = (header[0] & 0xe0) | (header[1] << 8) | (header[2] << 16);
76 av_dlog(avctx,
"pcm_dvd_parse_header: header = %02x%02x%02x\n",
77 header[0], header[1], header[2]);
91 "PCM DVD unsupported sample depth %i\n",
100 avctx->
sample_rate = frequencies[header[1] >> 4 & 3];
103 avctx->
channels = 1 + (header[1] & 7);
143 "pcm_dvd_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n",
153 void *dst,
int blocks)
156 int16_t *dst16 = dst;
169 int samples = blocks * avctx->
channels;
171 *dst16++ = bytestream2_get_be16u(&gb);
179 for (i = 2; i; i--) {
180 dst32[0] = bytestream2_get_be16u(&gb) << 16;
181 dst32[1] = bytestream2_get_be16u(&gb) << 16;
182 t = bytestream2_get_byteu(&gb);
183 *dst32++ += (t & 0xf0) << 8;
184 *dst32++ += (t & 0x0f) << 12;
190 dst32[0] = bytestream2_get_be16u(&gb) << 16;
191 dst32[1] = bytestream2_get_be16u(&gb) << 16;
192 dst32[2] = bytestream2_get_be16u(&gb) << 16;
193 dst32[3] = bytestream2_get_be16u(&gb) << 16;
194 t = bytestream2_get_byteu(&gb);
195 *dst32++ += (t & 0xf0) << 8;
196 *dst32++ += (t & 0x0f) << 12;
197 t = bytestream2_get_byteu(&gb);
198 *dst32++ += (t & 0xf0) << 8;
199 *dst32++ += (t & 0x0f) << 12;
207 for (i = 2; i; i--) {
208 dst32[0] = bytestream2_get_be16u(&gb) << 16;
209 dst32[1] = bytestream2_get_be16u(&gb) << 16;
210 *dst32++ += bytestream2_get_byteu(&gb) << 8;
211 *dst32++ += bytestream2_get_byteu(&gb) << 8;
217 dst32[0] = bytestream2_get_be16u(&gb) << 16;
218 dst32[1] = bytestream2_get_be16u(&gb) << 16;
219 dst32[2] = bytestream2_get_be16u(&gb) << 16;
220 dst32[3] = bytestream2_get_be16u(&gb) << 16;
221 *dst32++ += bytestream2_get_byteu(&gb) << 8;
222 *dst32++ += bytestream2_get_byteu(&gb) << 8;
223 *dst32++ += bytestream2_get_byteu(&gb) << 8;
224 *dst32++ += bytestream2_get_byteu(&gb) << 8;
235 int *got_frame_ptr,
AVPacket *avpkt)
239 int buf_size = avpkt->
size;
266 dst = frame->
data[0];
271 if (buf_size >= missing_samples) {
275 src += missing_samples;
276 buf_size -= missing_samples;