Changeset 149 for libmpc/branches/r2d/libmpcdec/streaminfo.c
- Timestamp:
- 11/23/06 19:17:14 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcdec/streaminfo.c
r146 r149 140 140 } 141 141 142 /// Reads replay gain datas 143 void streaminfo_gain(mpc_streaminfo* si, const mpc_bits_reader * r_in) 144 { 145 mpc_bits_reader r = *r_in; 146 147 mpc_bits_read(&r, 8); // gain version 148 // FIXME : add gain conversion 149 si->gain_title = (mpc_uint16_t) mpc_bits_read(&r, 16); 150 si->peak_title = (mpc_uint16_t) mpc_bits_read(&r, 16); 151 si->gain_album = (mpc_uint16_t) mpc_bits_read(&r, 16); 152 si->peak_album = (mpc_uint16_t) mpc_bits_read(&r, 16); 153 } 154 142 155 /// Reads streaminfo from SV8 header. 143 156 mpc_status … … 145 158 mpc_size_t block_size) 146 159 { 147 mpc_uint32_t CRC, CRC_tmp; 148 mpc_bits_reader r = *r_in; 160 mpc_uint32_t CRC; 161 mpc_uint64_t info_len; 162 mpc_bits_reader r = *r_in, r_gain; 149 163 150 164 CRC = mpc_bits_read(&r, 32); 151 CRC_tmp = crc32(r.buff + 1 - (r.count >> 3), block_size - 4); 152 if (CRC != CRC_tmp) 165 if (CRC != crc32(r.buff + 1 - (r.count >> 3), block_size - 4)) 153 166 return MPC_STATUS_FILE; 167 168 r_gain = r; 169 mpc_bits_get_size(&r, &info_len); 170 r_gain.buff += info_len; 154 171 155 172 si->stream_version = mpc_bits_read(&r, 8); … … 164 181 si->bitrate = 0; 165 182 166 si->average_bitrate = (si->tag_offset - si->header_position) * 8.0 167 * si->sample_freq / si->samples; 183 if (si->samples != 0) 184 si->average_bitrate = (si->tag_offset - si->header_position) * 8.0 185 * si->sample_freq / si->samples; 186 187 streaminfo_gain(si, &r_gain); 168 188 169 189 return MPC_STATUS_OK; … … 187 207 } 188 208 189 /// Reads replay gain datas190 void streaminfo_gain(mpc_streaminfo* si, const mpc_bits_reader * r_in)191 {192 mpc_bits_reader r = *r_in;193 194 mpc_bits_read(&r, 8); // gain version195 // FIXME : add gain conversion196 si->gain_title = (mpc_uint16_t) mpc_bits_read(&r, 16);197 si->peak_title = (mpc_uint16_t) mpc_bits_read(&r, 16);198 si->gain_album = (mpc_uint16_t) mpc_bits_read(&r, 16);199 si->peak_album = (mpc_uint16_t) mpc_bits_read(&r, 16);200 }201 202 209 double 203 210 mpc_streaminfo_get_length(mpc_streaminfo * si)
Note: See TracChangeset
for help on using the changeset viewer.