Lines Matching refs:hdr
63 static int calc_frame_len(struct sbc_frame_hdr *hdr)
67 nrof_subbands = (hdr->subbands + 1) * 4;
68 nrof_blocks = (hdr->blocks + 1) * 4;
70 switch (hdr->channel_mode) {
73 tmp = nrof_blocks * hdr->bitpool;
76 tmp = nrof_blocks * hdr->bitpool * 2;
79 tmp = nrof_blocks * hdr->bitpool;
82 tmp = nrof_blocks * hdr->bitpool + nrof_subbands;
91 static double calc_bit_rate(struct sbc_frame_hdr *hdr)
96 nrof_subbands = (hdr->subbands + 1) * 4;
97 nrof_blocks = (hdr->blocks + 1) * 4;
99 switch (hdr->sampling_frequency) {
116 return ((8 * (calc_frame_len(hdr) + 4) * f) /
172 struct sbc_frame_hdr hdr;
192 len = __read(fd, &hdr, sizeof(hdr));
193 if (len != sizeof(hdr) || hdr.syncword != 0x9c) {
198 subbands = (hdr.subbands + 1) * 4;
199 blocks = (hdr.blocks + 1) * 4;
200 freq = hdr.sampling_frequency;
201 mode = hdr.channel_mode;
202 method = hdr.allocation_method;
204 count = calc_frame_len(&hdr);
206 bitpool[0] = hdr.bitpool;
216 rate = calc_bit_rate(&hdr);
230 len = __read(fd, &hdr, sizeof(hdr));
240 if ((size_t) len < sizeof(hdr) || hdr.syncword != 0x9c) {
243 len, hdr.syncword);
247 count = calc_frame_len(&hdr);
253 if (p1 < 0 && (bitpool[n] == 0 || bitpool[n] == hdr.bitpool))
259 bitpool[p1] = hdr.bitpool;
276 rate += calc_bit_rate(&hdr);
283 printf("Channel mode\t\t%s\n", mode2str(hdr.channel_mode));