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 ff_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;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_cold int init(AVCodecContext *avctx)
static av_cold int pcm_dvd_decode_uninit(AVCodecContext *avctx)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
enum AVSampleFormat sample_fmt
audio sample format
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static const uint8_t header[24]
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static void * pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, void *dst, int blocks)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int pcm_dvd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
const char * name
Name of the codec implementation.
Libavcodec external API header.
int bit_rate
the average bitrate
AVSampleFormat
Audio sample formats.
int sample_rate
samples per second
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define FF_DEBUG_PICT_INFO
static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx)
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
common internal api header.
int channels
number of audio channels
static enum AVSampleFormat sample_fmts[]
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
static int pcm_dvd_parse_header(AVCodecContext *avctx, const uint8_t *header)
AVCodec ff_pcm_dvd_decoder