Go to the documentation of this file.
56 static const uint32_t frequencies[4] = { 48000, 96000, 44100, 32000 };
62 if (
s->last_header == header_int)
76 s->extra_sample_count = 0;
82 "PCM DVD unsupported sample depth %i\n",
107 s->samples_per_block = 1;
117 s->groups_per_block = 1;
122 s->samples_per_block = 1;
123 s->groups_per_block = 2;
129 s->samples_per_block = 4;
137 "pcm_dvd_parse_header: %d channels, %d bits per sample, %d Hz, %"PRId64
" bit/s\n",
141 s->last_header = header_int;
147 void *dst,
int blocks)
150 int16_t *dst16 = dst;
161 dst16 += blocks *
s->block_size / 2;
165 *dst16++ = bytestream2_get_be16u(&gb);
173 for (
i = 2;
i;
i--) {
174 dst32[0] = bytestream2_get_be16u(&gb) << 16;
175 dst32[1] = bytestream2_get_be16u(&gb) << 16;
176 t = bytestream2_get_byteu(&gb);
177 *dst32++ += (t & 0xf0) << 8;
178 *dst32++ += (t & 0x0f) << 12;
183 for (
i =
s->groups_per_block;
i;
i--) {
184 dst32[0] = bytestream2_get_be16u(&gb) << 16;
185 dst32[1] = bytestream2_get_be16u(&gb) << 16;
186 dst32[2] = bytestream2_get_be16u(&gb) << 16;
187 dst32[3] = bytestream2_get_be16u(&gb) << 16;
188 t = bytestream2_get_byteu(&gb);
189 *dst32++ += (t & 0xf0) << 8;
190 *dst32++ += (t & 0x0f) << 12;
191 t = bytestream2_get_byteu(&gb);
192 *dst32++ += (t & 0xf0) << 8;
193 *dst32++ += (t & 0x0f) << 12;
201 for (
i = 2;
i;
i--) {
202 dst32[0] = bytestream2_get_be16u(&gb) << 16;
203 dst32[1] = bytestream2_get_be16u(&gb) << 16;
204 *dst32++ += bytestream2_get_byteu(&gb) << 8;
205 *dst32++ += bytestream2_get_byteu(&gb) << 8;
210 for (
i =
s->groups_per_block;
i;
i--) {
211 dst32[0] = bytestream2_get_be16u(&gb) << 16;
212 dst32[1] = bytestream2_get_be16u(&gb) << 16;
213 dst32[2] = bytestream2_get_be16u(&gb) << 16;
214 dst32[3] = bytestream2_get_be16u(&gb) << 16;
215 *dst32++ += bytestream2_get_byteu(&gb) << 8;
216 *dst32++ += bytestream2_get_byteu(&gb) << 8;
217 *dst32++ += bytestream2_get_byteu(&gb) << 8;
218 *dst32++ += bytestream2_get_byteu(&gb) << 8;
229 int *got_frame_ptr,
AVPacket *avpkt)
231 const uint8_t *
src = avpkt->
data;
232 int buf_size = avpkt->
size;
245 if (
s->last_block_size &&
s->last_block_size !=
s->block_size) {
247 s->extra_sample_count = 0;
249 s->last_block_size =
s->block_size;
253 blocks = (buf_size +
s->extra_sample_count) /
s->block_size;
256 frame->nb_samples = blocks *
s->samples_per_block;
259 dst =
frame->data[0];
262 if (
s->extra_sample_count) {
263 int missing_samples =
s->block_size -
s->extra_sample_count;
264 if (buf_size >= missing_samples) {
265 memcpy(
s->extra_samples +
s->extra_sample_count,
src,
268 src += missing_samples;
269 buf_size -= missing_samples;
270 s->extra_sample_count = 0;
274 memcpy(
s->extra_samples +
s->extra_sample_count,
src, buf_size);
275 s->extra_sample_count += buf_size;
283 buf_size -= blocks *
s->block_size;
288 src += blocks *
s->block_size;
289 memcpy(
s->extra_samples,
src, buf_size);
290 s->extra_sample_count = buf_size;
#define AV_LOG_WARNING
Something somehow does not look correct.
int sample_rate
samples per second
This structure describes decoded (raw) audio or video data.
int nb_channels
Number of channels in this layout.
uint8_t extra_samples[8 *3 *4]
#define FF_DEBUG_PICT_INFO
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int pcm_dvd_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
#define FF_CODEC_DECODE_CB(func)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int64_t bit_rate
the average bitrate
static void * pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, void *dst, int blocks)
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
const FFCodec ff_pcm_dvd_decoder
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
enum AVSampleFormat sample_fmt
audio sample format
static const uint8_t header[24]
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define i(width, name, range_min, range_max)
AVSampleFormat
Audio sample formats.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
@ AV_SAMPLE_FMT_S16
signed 16 bits
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
main external API structure.
static int pcm_dvd_parse_header(AVCodecContext *avctx, const uint8_t *header)
Filter the word “frame” indicates either a video frame or a group of audio samples
This structure stores compressed data.
static av_cold int pcm_dvd_decode_init(AVCodecContext *avctx)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AV_SAMPLE_FMT_S32
signed 32 bits