56 static const uint8_t bits_per_samples[4] = { 0, 16, 20, 24 };
57 static const uint32_t channel_layouts[16] = {
62 static const uint8_t channels[16] = {
63 0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8, 0, 0, 0, 0
65 uint8_t channel_layout = header[2] >> 4;
68 av_dlog(avctx,
"pcm_bluray_parse_header: header = %02x%02x%02x%02x\n",
69 header[0], header[1], header[2], header[3]);
83 switch (header[2] & 0x0f) {
107 avctx->
channels = channels[channel_layout];
119 "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n",
126 int *got_frame_ptr,
AVPacket *avpkt)
130 int buf_size = avpkt->
size;
132 int num_source_channels, channel, retval;
152 samples = buf_size / sample_size;
158 dst16 = (int16_t *)frame->
data[0];
167 samples *= num_source_channels;
173 *dst16++ = bytestream2_get_be16u(&gb);
178 *dst32++ = bytestream2_get_be24u(&gb) << 8;
195 *dst16++ = bytestream2_get_be16u(&gb);
204 *dst32++ = bytestream2_get_be24u(&gb) << 8;
214 dst16[0] = bytestream2_get_be16u(&gb);
215 dst16[1] = bytestream2_get_be16u(&gb);
216 dst16[2] = bytestream2_get_be16u(&gb);
217 dst16[4] = bytestream2_get_be16u(&gb);
218 dst16[5] = bytestream2_get_be16u(&gb);
219 dst16[3] = bytestream2_get_be16u(&gb);
224 dst32[0] = bytestream2_get_be24u(&gb) << 8;
225 dst32[1] = bytestream2_get_be24u(&gb) << 8;
226 dst32[2] = bytestream2_get_be24u(&gb) << 8;
227 dst32[4] = bytestream2_get_be24u(&gb) << 8;
228 dst32[5] = bytestream2_get_be24u(&gb) << 8;
229 dst32[3] = bytestream2_get_be24u(&gb) << 8;
238 dst16[0] = bytestream2_get_be16u(&gb);
239 dst16[1] = bytestream2_get_be16u(&gb);
240 dst16[2] = bytestream2_get_be16u(&gb);
241 dst16[5] = bytestream2_get_be16u(&gb);
242 dst16[3] = bytestream2_get_be16u(&gb);
243 dst16[4] = bytestream2_get_be16u(&gb);
244 dst16[6] = bytestream2_get_be16u(&gb);
250 dst32[0] = bytestream2_get_be24u(&gb) << 8;
251 dst32[1] = bytestream2_get_be24u(&gb) << 8;
252 dst32[2] = bytestream2_get_be24u(&gb) << 8;
253 dst32[5] = bytestream2_get_be24u(&gb) << 8;
254 dst32[3] = bytestream2_get_be24u(&gb) << 8;
255 dst32[4] = bytestream2_get_be24u(&gb) << 8;
256 dst32[6] = bytestream2_get_be24u(&gb) << 8;
266 dst16[0] = bytestream2_get_be16u(&gb);
267 dst16[1] = bytestream2_get_be16u(&gb);
268 dst16[2] = bytestream2_get_be16u(&gb);
269 dst16[6] = bytestream2_get_be16u(&gb);
270 dst16[4] = bytestream2_get_be16u(&gb);
271 dst16[5] = bytestream2_get_be16u(&gb);
272 dst16[7] = bytestream2_get_be16u(&gb);
273 dst16[3] = bytestream2_get_be16u(&gb);
278 dst32[0] = bytestream2_get_be24u(&gb) << 8;
279 dst32[1] = bytestream2_get_be24u(&gb) << 8;
280 dst32[2] = bytestream2_get_be24u(&gb) << 8;
281 dst32[6] = bytestream2_get_be24u(&gb) << 8;
282 dst32[4] = bytestream2_get_be24u(&gb) << 8;
283 dst32[5] = bytestream2_get_be24u(&gb) << 8;
284 dst32[7] = bytestream2_get_be24u(&gb) << 8;
285 dst32[3] = bytestream2_get_be24u(&gb) << 8;
297 av_dlog(avctx,
"pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
303 .
name =
"pcm_bluray",
#define AV_CH_LAYOUT_7POINT1
static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
This structure describes decoded (raw) audio or video data.
#define AV_CH_LAYOUT_SURROUND
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_7POINT0
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_5POINT0
enum AVSampleFormat sample_fmt
audio sample format
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define AV_CH_LAYOUT_5POINT1
AVCodec ff_pcm_bluray_decoder
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#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)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
uint64_t channel_layout
Audio channel layout.
int bit_rate
the average bitrate
audio channel layout utility functions
static av_always_inline int bytestream2_tell(GetByteContext *g)
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define FF_DEBUG_PICT_INFO
static int pcm_bluray_parse_header(AVCodecContext *avctx, const uint8_t *header)
Parse the header of a LPCM frame read from a MPEG-TS stream.
common internal api header.
AVSampleFormat
Audio Sample Formats.
#define FF_DEBUG_BITSTREAM
int channels
number of audio channels
Filter the word “frame” indicates either a video frame or a group of audio samples
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame