comparison mpeg4audio.c @ 11588:480a999ce2c4 libavcodec

Add support for PS sync extensions.
author alexc
date Thu, 08 Apr 2010 06:04:41 +0000
parents d80d54dd267d
children 2d81202be6e2
comparison
equal deleted inserted replaced
11587:d80d54dd267d 11588:480a999ce2c4
86 c->sample_rate = get_sample_rate(&gb, &c->sampling_index); 86 c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
87 c->chan_config = get_bits(&gb, 4); 87 c->chan_config = get_bits(&gb, 4);
88 if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) 88 if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
89 c->channels = ff_mpeg4audio_channels[c->chan_config]; 89 c->channels = ff_mpeg4audio_channels[c->chan_config];
90 c->sbr = -1; 90 c->sbr = -1;
91 c->ps = -1;
91 if (c->object_type == AOT_SBR || (c->object_type == AOT_PS && 92 if (c->object_type == AOT_SBR || (c->object_type == AOT_PS &&
92 // check for W6132 Annex YYYY draft MP3onMP4 93 // check for W6132 Annex YYYY draft MP3onMP4
93 !(show_bits(&gb, 3) & 0x03 && !(show_bits(&gb, 9) & 0x3F)))) { 94 !(show_bits(&gb, 3) & 0x03 && !(show_bits(&gb, 9) & 0x3F)))) {
95 if (c->object_type == AOT_PS)
96 c->ps = 1;
94 c->ext_object_type = AOT_SBR; 97 c->ext_object_type = AOT_SBR;
95 c->sbr = 1; 98 c->sbr = 1;
96 c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index); 99 c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index);
97 c->object_type = get_object_type(&gb); 100 c->object_type = get_object_type(&gb);
98 if (c->object_type == AOT_ER_BSAC) 101 if (c->object_type == AOT_ER_BSAC)
119 if (show_bits(&gb, 11) == 0x2b7) { // sync extension 122 if (show_bits(&gb, 11) == 0x2b7) { // sync extension
120 get_bits(&gb, 11); 123 get_bits(&gb, 11);
121 c->ext_object_type = get_object_type(&gb); 124 c->ext_object_type = get_object_type(&gb);
122 if (c->ext_object_type == AOT_SBR && (c->sbr = get_bits1(&gb)) == 1) 125 if (c->ext_object_type == AOT_SBR && (c->sbr = get_bits1(&gb)) == 1)
123 c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index); 126 c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index);
127 if (get_bits_left(&gb) > 11 && get_bits(&gb, 11) == 0x548)
128 c->ps = get_bits1(&gb);
124 break; 129 break;
125 } else 130 } else
126 get_bits1(&gb); // skip 1 bit 131 get_bits1(&gb); // skip 1 bit
127 } 132 }
128 } 133 }