Lines Matching refs:hdr

57 int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
61 memset(hdr, 0, sizeof(*hdr));
63 hdr->sync_word = get_bits(gbc, 16);
64 if(hdr->sync_word != 0x0B77)
68 hdr->bitstream_id = show_bits_long(gbc, 29) & 0x1F;
69 if(hdr->bitstream_id > 16)
72 hdr->num_blocks = 6;
73 hdr->ac3_bit_rate_code = -1;
76 hdr->center_mix_level = 5; // -4.5dB
77 hdr->surround_mix_level = 6; // -6.0dB
80 hdr->dolby_surround_mode = AC3_DSURMOD_NOTINDICATED;
82 if(hdr->bitstream_id <= 10) {
84 hdr->crc1 = get_bits(gbc, 16);
85 hdr->sr_code = get_bits(gbc, 2);
86 if(hdr->sr_code == 3)
93 hdr->ac3_bit_rate_code = (frame_size_code >> 1);
97 hdr->bitstream_mode = get_bits(gbc, 3);
98 hdr->channel_mode = get_bits(gbc, 3);
100 if(hdr->channel_mode == AC3_CHMODE_STEREO) {
101 hdr->dolby_surround_mode = get_bits(gbc, 2);
103 if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO)
104 hdr-> center_mix_level = center_levels[get_bits(gbc, 2)];
105 if(hdr->channel_mode & 4)
106 hdr->surround_mix_level = surround_levels[get_bits(gbc, 2)];
108 hdr->lfe_on = get_bits1(gbc);
110 hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
111 hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
112 hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->ac3_bit_rate_code] * 1000) >> hdr->sr_shift;
113 hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
114 hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
115 hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
116 hdr->substreamid = 0;
119 hdr->crc1 = 0;
120 hdr->frame_type = get_bits(gbc, 2);
121 if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED)
124 hdr->substreamid = get_bits(gbc, 3);
126 hdr->frame_size = (get_bits(gbc, 11) + 1) << 1;
127 if(hdr->frame_size < AC3_HEADER_SIZE)
130 hdr->sr_code = get_bits(gbc, 2);
131 if (hdr->sr_code == 3) {
135 hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
136 hdr->sr_shift = 1;
138 hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
139 hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
140 hdr->sr_shift = 0;
143 hdr->channel_mode = get_bits(gbc, 3);
144 hdr->lfe_on = get_bits1(gbc);
146 hdr->bit_rate = 8LL * hdr->frame_size * hdr->sample_rate /
147 (hdr->num_blocks * 256);
148 hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
150 hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
151 if (hdr->lfe_on)
152 hdr->channel_layout |= AV_CH_LOW_FREQUENCY;
162 AC3HeaderInfo *hdr;
169 hdr = *phdr;
174 err = ff_ac3_parse_header(&gb, hdr);
185 AC3HeaderInfo hdr;
189 err = ff_ac3_parse_header(&gb, &hdr);
193 *bitstream_id = hdr.bitstream_id;
194 *frame_size = hdr.frame_size;
207 AC3HeaderInfo hdr;
217 err = ff_ac3_parse_header(&gbc, &hdr);
222 hdr_info->sample_rate = hdr.sample_rate;
223 hdr_info->bit_rate = hdr.bit_rate;
224 hdr_info->channels = hdr.channels;
225 hdr_info->channel_layout = hdr.channel_layout;
226 hdr_info->samples = hdr.num_blocks * 256;
227 hdr_info->service_type = hdr.bitstream_mode;
228 if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)
230 if(hdr.bitstream_id>10)
235 *new_frame_start = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);
236 *need_next_header = *new_frame_start || (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);
237 return hdr.frame_size;