54 const uint8_t *header)
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]);
81 switch (header[2] & 0x0f) {
105 avctx->
channels = channels[channel_layout];
117 "pcm_bluray_parse_header: %d channels, %d bits per sample, %d kHz, %d kbit\n",
138 int *got_frame_ptr,
AVPacket *avpkt)
140 const uint8_t *src = avpkt->
data;
141 int buf_size = avpkt->
size;
143 int num_source_channels, channel, retval;
161 samples = buf_size / sample_size;
178 samples *= num_source_channels;
181 memcpy(dst16, src, buf_size);
184 *dst16++ = bytestream_get_be16(&src);
189 *dst32++ = bytestream_get_be24(&src) << 8;
201 memcpy(dst16, src, avctx->
channels * 2);
207 *dst16++ = bytestream_get_be16(&src);
216 *dst32++ = bytestream_get_be24(&src) << 8;
226 dst16[0] = bytestream_get_be16(&src);
227 dst16[1] = bytestream_get_be16(&src);
228 dst16[2] = bytestream_get_be16(&src);
229 dst16[4] = bytestream_get_be16(&src);
230 dst16[5] = bytestream_get_be16(&src);
231 dst16[3] = bytestream_get_be16(&src);
236 dst32[0] = bytestream_get_be24(&src) << 8;
237 dst32[1] = bytestream_get_be24(&src) << 8;
238 dst32[2] = bytestream_get_be24(&src) << 8;
239 dst32[4] = bytestream_get_be24(&src) << 8;
240 dst32[5] = bytestream_get_be24(&src) << 8;
241 dst32[3] = bytestream_get_be24(&src) << 8;
250 dst16[0] = bytestream_get_be16(&src);
251 dst16[1] = bytestream_get_be16(&src);
252 dst16[2] = bytestream_get_be16(&src);
253 dst16[5] = bytestream_get_be16(&src);
254 dst16[3] = bytestream_get_be16(&src);
255 dst16[4] = bytestream_get_be16(&src);
256 dst16[6] = bytestream_get_be16(&src);
262 dst32[0] = bytestream_get_be24(&src) << 8;
263 dst32[1] = bytestream_get_be24(&src) << 8;
264 dst32[2] = bytestream_get_be24(&src) << 8;
265 dst32[5] = bytestream_get_be24(&src) << 8;
266 dst32[3] = bytestream_get_be24(&src) << 8;
267 dst32[4] = bytestream_get_be24(&src) << 8;
268 dst32[6] = bytestream_get_be24(&src) << 8;
278 dst16[0] = bytestream_get_be16(&src);
279 dst16[1] = bytestream_get_be16(&src);
280 dst16[2] = bytestream_get_be16(&src);
281 dst16[6] = bytestream_get_be16(&src);
282 dst16[4] = bytestream_get_be16(&src);
283 dst16[5] = bytestream_get_be16(&src);
284 dst16[7] = bytestream_get_be16(&src);
285 dst16[3] = bytestream_get_be16(&src);
290 dst32[0] = bytestream_get_be24(&src) << 8;
291 dst32[1] = bytestream_get_be24(&src) << 8;
292 dst32[2] = bytestream_get_be24(&src) << 8;
293 dst32[6] = bytestream_get_be24(&src) << 8;
294 dst32[4] = bytestream_get_be24(&src) << 8;
295 dst32[5] = bytestream_get_be24(&src) << 8;
296 dst32[7] = bytestream_get_be24(&src) << 8;
297 dst32[3] = bytestream_get_be24(&src) << 8;
308 retval = src - avpkt->
data;
310 av_dlog(avctx,
"pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
316 .
name =
"pcm_bluray",
#define AV_CH_LAYOUT_7POINT1
static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
#define AV_CH_LAYOUT_SURROUND
AVFrame * coded_frame
the picture in the bitstream
#define FF_DEBUG_BITSTREAM
static av_cold int pcm_bluray_decode_init(AVCodecContext *avctx)
#define AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_7POINT0
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_5POINT0
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
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 int init(AVCodecParserContext *s)
audio conversion routines
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_CH_LAYOUT_5POINT1
AVCodec ff_pcm_bluray_decoder
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
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
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
#define av_dlog(pctx,...)
av_dlog macros Useful to print debug messages that shouldn't get compiled in normally.
int sample_rate
samples per second
main external API structure.
#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.
struct AVCodecContext * avctx
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
all in native-endian format
struct PCMBRDecode PCMBRDecode
int channels
number of audio channels
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.
#define AV_CH_LAYOUT_MONO
int nb_samples
number of audio samples (per channel) described by this frame