38 16, 20, 24, 0, 0, 0, 0, 0,
39 0, 0, 0, 0, 0, 0, 0, 0,
43 1, 2, 3, 4, 3, 4, 5, 3, 4, 5, 4, 5, 6, 4, 5, 4,
44 5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
69 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
74 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1
98 return (in & 8 ? 44100 : 48000) << (in & 7) ;
105 for (i = 0; i < 13; i++)
116 for (i = 0; i < 13; i++)
117 layout |=
thd_layout[i] * ((chanmap >> i) & 1);
124 int has_extension, extensions = 0;
129 if (
AV_RB32(buf) == 0xf8726fba) {
130 has_extension = buf[25] & 1;
132 extensions = buf[26] >> 4;
133 size += 2 + extensions * 2;
147 int ratebits, channel_arrangement, header_size;
153 if (header_size < 0 || gb->size_in_bits < header_size << 3) {
181 channel_arrangement =
get_bits(gb, 5);
198 channel_arrangement =
get_bits(gb, 5);
204 channel_arrangement =
get_bits(gb, 13);
245 const uint8_t **poutbuf,
int *poutbuf_size,
262 for (i = 0; i < buf_size; i++) {
264 if ((mp->
pc.
state & 0xfffffffe) == 0xf8726fba &&
295 if (mp->
pc.
index + buf_size < 2) {
319 sync_present = (
AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba;
328 parity_bits ^= buf[p++];
329 parity_bits ^= buf[p++];
331 if (i < 0 || buf[p-2] & 0x80) {
332 parity_bits ^= buf[p++];
333 parity_bits ^= buf[p++];
337 if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
398 *poutbuf_size = buf_size;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_CH_TOP_FRONT_RIGHT
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
#define AV_CH_LAYOUT_SURROUND
uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size)
static void skip_bits_long(GetBitContext *s, int n)
#define AV_CH_TOP_FRONT_LEFT
#define AV_CH_TOP_FRONT_CENTER
#define AV_CH_LOW_FREQUENCY_2
#define AV_CH_LAYOUT_4POINT0
int duration
Duration of the current frame.
#define AV_CH_SURROUND_DIRECT_RIGHT
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define AV_CH_LAYOUT_STEREO
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
enum AVSampleFormat sample_fmt
audio sample format
static const uint64_t thd_layout[13]
#define AV_CH_LOW_FREQUENCY
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
static int mlp_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
static int get_bits_count(const GetBitContext *s)
uint64_t ff_truehd_layout(int chanmap)
bitstream reader API header.
static const uint8_t mlp_channels[32]
AVCodecParser ff_mlp_parser
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
static int truehd_channels(int chanmap)
#define AV_CH_LAYOUT_QUAD
int overread_index
the index into ParseContext.buffer of the overread bytes
uint64_t channel_layout
Audio channel layout.
void ff_parse_close(AVCodecParserContext *s)
common internal API header
audio channel layout utility functions
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
int overread
the number of bytes which where irreversibly read from the next frame
#define AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_FRONT_CENTER
#define AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_FRONT_RIGHT_OF_CENTER
#define AV_LOG_INFO
Standard information.
static const uint8_t mlp_quants[16]
int sample_rate
samples per second
static int mlp_samplerate(int in)
main external API structure.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
uint32_t state
contains the last few bytes in MSB order
static unsigned int get_bits1(GetBitContext *s)
const uint64_t ff_mlp_layout[32]
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CH_LAYOUT_5POINT0_BACK
static int ff_mlp_get_major_sync_size(const uint8_t *buf, int bufsize)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
#define AV_CH_BACK_CENTER
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
Read a major sync info header - contains high level information about the stream - sample rate...
int channels
number of audio channels
av_cold void ff_mlp_init_crc(void)
#define AV_CH_SURROUND_DIRECT_LEFT
#define AV_CH_FRONT_RIGHT
static const uint8_t thd_chancount[13]
#define AV_CH_LAYOUT_MONO
uint64_t request_channel_layout
Request decoder to use this channel layout if it can (0 for default)
static av_cold int mlp_init(AVCodecParserContext *s)