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]);
82 switch (header[2] & 0x0f) {
106 avctx->
channels = channels[channel_layout];
118 "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n",
139 int *got_frame_ptr,
AVPacket *avpkt)
142 int buf_size = avpkt->
size;
145 int num_source_channels, channel, retval;
165 samples = buf_size / sample_size;
182 samples *= num_source_channels;
188 *dst16++ = bytestream2_get_be16u(&gb);
193 *dst32++ = bytestream2_get_be24u(&gb) << 8;
210 *dst16++ = bytestream2_get_be16u(&gb);
219 *dst32++ = bytestream2_get_be24u(&gb) << 8;
229 dst16[0] = bytestream2_get_be16u(&gb);
230 dst16[1] = bytestream2_get_be16u(&gb);
231 dst16[2] = bytestream2_get_be16u(&gb);
232 dst16[4] = bytestream2_get_be16u(&gb);
233 dst16[5] = bytestream2_get_be16u(&gb);
234 dst16[3] = bytestream2_get_be16u(&gb);
239 dst32[0] = bytestream2_get_be24u(&gb) << 8;
240 dst32[1] = bytestream2_get_be24u(&gb) << 8;
241 dst32[2] = bytestream2_get_be24u(&gb) << 8;
242 dst32[4] = bytestream2_get_be24u(&gb) << 8;
243 dst32[5] = bytestream2_get_be24u(&gb) << 8;
244 dst32[3] = bytestream2_get_be24u(&gb) << 8;
253 dst16[0] = bytestream2_get_be16u(&gb);
254 dst16[1] = bytestream2_get_be16u(&gb);
255 dst16[2] = bytestream2_get_be16u(&gb);
256 dst16[5] = bytestream2_get_be16u(&gb);
257 dst16[3] = bytestream2_get_be16u(&gb);
258 dst16[4] = bytestream2_get_be16u(&gb);
259 dst16[6] = bytestream2_get_be16u(&gb);
265 dst32[0] = bytestream2_get_be24u(&gb) << 8;
266 dst32[1] = bytestream2_get_be24u(&gb) << 8;
267 dst32[2] = bytestream2_get_be24u(&gb) << 8;
268 dst32[5] = bytestream2_get_be24u(&gb) << 8;
269 dst32[3] = bytestream2_get_be24u(&gb) << 8;
270 dst32[4] = bytestream2_get_be24u(&gb) << 8;
271 dst32[6] = bytestream2_get_be24u(&gb) << 8;
281 dst16[0] = bytestream2_get_be16u(&gb);
282 dst16[1] = bytestream2_get_be16u(&gb);
283 dst16[2] = bytestream2_get_be16u(&gb);
284 dst16[6] = bytestream2_get_be16u(&gb);
285 dst16[4] = bytestream2_get_be16u(&gb);
286 dst16[5] = bytestream2_get_be16u(&gb);
287 dst16[7] = bytestream2_get_be16u(&gb);
288 dst16[3] = bytestream2_get_be16u(&gb);
293 dst32[0] = bytestream2_get_be24u(&gb) << 8;
294 dst32[1] = bytestream2_get_be24u(&gb) << 8;
295 dst32[2] = bytestream2_get_be24u(&gb) << 8;
296 dst32[6] = bytestream2_get_be24u(&gb) << 8;
297 dst32[4] = bytestream2_get_be24u(&gb) << 8;
298 dst32[5] = bytestream2_get_be24u(&gb) << 8;
299 dst32[7] = bytestream2_get_be24u(&gb) << 8;
300 dst32[3] = bytestream2_get_be24u(&gb) << 8;
313 av_dlog(avctx,
"pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
319 .
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
AVFrame * coded_frame
the picture in the bitstream
static av_cold int pcm_bluray_decode_init(AVCodecContext *avctx)
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
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
enum AVSampleFormat sample_fmt
audio sample format
#define FF_DEBUG_BITSTREAM
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int init(AVCodecParserContext *s)
#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. ...
#define FF_DEBUG_PICT_INFO
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
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
static av_always_inline int bytestream2_tell(GetByteContext *g)
int sample_rate
samples per second
main external API structure.
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.
struct PCMBRDecode PCMBRDecode
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