56 static const uint8_t bits_per_samples[4] = { 0, 16, 20, 24 };
64 0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8, 0, 0, 0, 0
66 uint8_t channel_layout = header[2] >> 4;
69 ff_dlog(avctx,
"pcm_bluray_parse_header: header = %02x%02x%02x%02x\n",
70 header[0], header[1], header[2], header[3]);
84 switch (header[2] & 0x0f) {
108 avctx->
channels = channels[channel_layout];
120 "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %"PRId64
" bit/s\n",
127 int *got_frame_ptr,
AVPacket *avpkt)
131 int buf_size = avpkt->
size;
133 int num_source_channels,
channel, retval;
134 int sample_size, samples;
152 sample_size = (num_source_channels *
154 samples = buf_size / sample_size;
160 dst16 = (int16_t *)frame->
data[0];
169 samples *= num_source_channels;
175 *dst16++ = bytestream2_get_be16u(&gb);
180 *dst32++ = bytestream2_get_be24u(&gb) << 8;
197 *dst16++ = bytestream2_get_be16u(&gb);
206 *dst32++ = bytestream2_get_be24u(&gb) << 8;
216 dst16[0] = bytestream2_get_be16u(&gb);
217 dst16[1] = bytestream2_get_be16u(&gb);
218 dst16[2] = bytestream2_get_be16u(&gb);
219 dst16[4] = bytestream2_get_be16u(&gb);
220 dst16[5] = bytestream2_get_be16u(&gb);
221 dst16[3] = bytestream2_get_be16u(&gb);
226 dst32[0] = bytestream2_get_be24u(&gb) << 8;
227 dst32[1] = bytestream2_get_be24u(&gb) << 8;
228 dst32[2] = bytestream2_get_be24u(&gb) << 8;
229 dst32[4] = bytestream2_get_be24u(&gb) << 8;
230 dst32[5] = bytestream2_get_be24u(&gb) << 8;
231 dst32[3] = bytestream2_get_be24u(&gb) << 8;
240 dst16[0] = bytestream2_get_be16u(&gb);
241 dst16[1] = bytestream2_get_be16u(&gb);
242 dst16[2] = bytestream2_get_be16u(&gb);
243 dst16[5] = bytestream2_get_be16u(&gb);
244 dst16[3] = bytestream2_get_be16u(&gb);
245 dst16[4] = bytestream2_get_be16u(&gb);
246 dst16[6] = bytestream2_get_be16u(&gb);
252 dst32[0] = bytestream2_get_be24u(&gb) << 8;
253 dst32[1] = bytestream2_get_be24u(&gb) << 8;
254 dst32[2] = bytestream2_get_be24u(&gb) << 8;
255 dst32[5] = bytestream2_get_be24u(&gb) << 8;
256 dst32[3] = bytestream2_get_be24u(&gb) << 8;
257 dst32[4] = bytestream2_get_be24u(&gb) << 8;
258 dst32[6] = bytestream2_get_be24u(&gb) << 8;
268 dst16[0] = bytestream2_get_be16u(&gb);
269 dst16[1] = bytestream2_get_be16u(&gb);
270 dst16[2] = bytestream2_get_be16u(&gb);
271 dst16[6] = bytestream2_get_be16u(&gb);
272 dst16[4] = bytestream2_get_be16u(&gb);
273 dst16[5] = bytestream2_get_be16u(&gb);
274 dst16[7] = bytestream2_get_be16u(&gb);
275 dst16[3] = bytestream2_get_be16u(&gb);
280 dst32[0] = bytestream2_get_be24u(&gb) << 8;
281 dst32[1] = bytestream2_get_be24u(&gb) << 8;
282 dst32[2] = bytestream2_get_be24u(&gb) << 8;
283 dst32[6] = bytestream2_get_be24u(&gb) << 8;
284 dst32[4] = bytestream2_get_be24u(&gb) << 8;
285 dst32[5] = bytestream2_get_be24u(&gb) << 8;
286 dst32[7] = bytestream2_get_be24u(&gb) << 8;
287 dst32[3] = bytestream2_get_be24u(&gb) << 8;
299 ff_dlog(avctx,
"pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
305 .
name =
"pcm_bluray",
#define AV_CH_LAYOUT_7POINT1
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
AVCodec ff_pcm_bluray_decoder
ptrdiff_t const GLvoid * data
int64_t bit_rate
the average bitrate
#define AV_CH_LAYOUT_SURROUND
#define FF_DEBUG_BITSTREAM
static int pcm_bluray_parse_header(AVCodecContext *avctx, const uint8_t *header)
Parse the header of a LPCM frame read from a Blu-ray MPEG-TS stream.
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
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 FF_DEBUG_PICT_INFO
static const uint8_t header[24]
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define AV_CH_LAYOUT_5POINT1
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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)
const char * name
Name of the codec implementation.
uint64_t channel_layout
Audio channel layout.
audio channel layout utility functions
static av_always_inline int bytestream2_tell(GetByteContext *g)
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.
static const uint16_t channel_layouts[7]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
channel
Use these values when setting the channel map with ebur128_set_channel().
static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
int channels
number of audio channels
#define AV_CH_LAYOUT_MONO
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.