55 static const uint32_t frequencies[4] = { 48000, 96000, 44100, 32000 };
57 int header_int = (header[0] & 0xe0) | (header[1] << 8) | (header[2] << 16);
66 header[0], header[1], header[2]);
80 "PCM DVD unsupported sample depth %i\n",
89 avctx->
sample_rate = frequencies[header[1] >> 4 & 3];
92 avctx->
channels = 1 + (header[1] & 7);
132 "pcm_dvd_parse_header: %d channels, %d bits per sample, %d Hz, %"PRId64
" bit/s\n",
142 void *dst,
int blocks)
145 int16_t *dst16 = dst;
160 *dst16++ = bytestream2_get_be16u(&gb);
168 for (i = 2;
i; i--) {
169 dst32[0] = bytestream2_get_be16u(&gb) << 16;
170 dst32[1] = bytestream2_get_be16u(&gb) << 16;
171 t = bytestream2_get_byteu(&gb);
172 *dst32++ += (t & 0xf0) << 8;
173 *dst32++ += (t & 0x0f) << 12;
179 dst32[0] = bytestream2_get_be16u(&gb) << 16;
180 dst32[1] = bytestream2_get_be16u(&gb) << 16;
181 dst32[2] = bytestream2_get_be16u(&gb) << 16;
182 dst32[3] = bytestream2_get_be16u(&gb) << 16;
183 t = bytestream2_get_byteu(&gb);
184 *dst32++ += (t & 0xf0) << 8;
185 *dst32++ += (t & 0x0f) << 12;
186 t = bytestream2_get_byteu(&gb);
187 *dst32++ += (t & 0xf0) << 8;
188 *dst32++ += (t & 0x0f) << 12;
196 for (i = 2;
i; i--) {
197 dst32[0] = bytestream2_get_be16u(&gb) << 16;
198 dst32[1] = bytestream2_get_be16u(&gb) << 16;
199 *dst32++ += bytestream2_get_byteu(&gb) << 8;
200 *dst32++ += bytestream2_get_byteu(&gb) << 8;
206 dst32[0] = bytestream2_get_be16u(&gb) << 16;
207 dst32[1] = bytestream2_get_be16u(&gb) << 16;
208 dst32[2] = bytestream2_get_be16u(&gb) << 16;
209 dst32[3] = bytestream2_get_be16u(&gb) << 16;
210 *dst32++ += bytestream2_get_byteu(&gb) << 8;
211 *dst32++ += bytestream2_get_byteu(&gb) << 8;
212 *dst32++ += bytestream2_get_byteu(&gb) << 8;
213 *dst32++ += bytestream2_get_byteu(&gb) << 8;
224 int *got_frame_ptr,
AVPacket *avpkt)
228 int buf_size = avpkt->
size;
255 dst = frame->
data[0];
260 if (buf_size >= missing_samples) {
264 src += missing_samples;
265 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
uint8_t extra_samples[8 *3 *4]
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
static av_cold int init(AVCodecContext *avctx)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
enum AVSampleFormat sample_fmt
audio sample format
#define FF_DEBUG_PICT_INFO
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)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * name
Name of the codec implementation.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Libavcodec external API header.
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.
static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx)
common internal api header.
int channels
number of audio channels
static enum AVSampleFormat sample_fmts[]
Filter the word “frame” indicates either a video frame or a group of audio samples
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int pcm_dvd_parse_header(AVCodecContext *avctx, const uint8_t *header)
AVCodec ff_pcm_dvd_decoder