MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / tak_parse_streaminfo

Function tak_parse_streaminfo

libavcodec/tak.c:95–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95static int tak_parse_streaminfo(TAKStreamInfo *s, GetBitContext *gb)
96{
97 uint64_t channel_mask = 0;
98 int frame_type, i, ret;
99
100 s->codec = get_bits(gb, TAK_ENCODER_CODEC_BITS);
101 skip_bits(gb, TAK_ENCODER_PROFILE_BITS);
102
103 frame_type = get_bits(gb, TAK_SIZE_FRAME_DURATION_BITS);
104 s->samples = get_bits64(gb, TAK_SIZE_SAMPLES_NUM_BITS);
105
106 s->data_type = get_bits(gb, TAK_FORMAT_DATA_TYPE_BITS);
107 s->sample_rate = get_bits(gb, TAK_FORMAT_SAMPLE_RATE_BITS) +
108 TAK_SAMPLE_RATE_MIN;
109 s->bps = get_bits(gb, TAK_FORMAT_BPS_BITS) +
110 TAK_BPS_MIN;
111 s->channels = get_bits(gb, TAK_FORMAT_CHANNEL_BITS) +
112 TAK_CHANNELS_MIN;
113
114 if (get_bits1(gb)) {
115 skip_bits(gb, TAK_FORMAT_VALID_BITS);
116 if (get_bits1(gb)) {
117 for (i = 0; i < s->channels; i++) {
118 int value = get_bits(gb, TAK_FORMAT_CH_LAYOUT_BITS);
119
120 if (value < FF_ARRAY_ELEMS(tak_channel_layouts))
121 channel_mask |= tak_channel_layouts[value];
122 }
123 }
124 }
125
126 s->ch_layout = channel_mask;
127
128 ret = tak_get_nb_samples(s->sample_rate, frame_type);
129 if (ret < 0)
130 return ret;
131 s->frame_samples = ret;
132
133 return 0;
134}
135
136int avpriv_tak_parse_streaminfo(TAKStreamInfo *s, const uint8_t *buf, int size)
137{

Callers 2

Calls 5

skip_bitsFunction · 0.85
get_bits64Function · 0.85
get_bits1Function · 0.85
tak_get_nb_samplesFunction · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected