Changeset 220 for libmpc/branches/r2d/mpcgain
- Timestamp:
- 02/17/07 18:49:10 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/mpcgain/mpcgain.c
r219 r220 41 41 #include "../libmpcdec/huffman.h" 42 42 #include "../libmpcdec/mpc_bits_reader.h" 43 44 // crc32.c45 unsigned long crc32(unsigned char *buf, int len);46 43 47 44 static void usage(const char *exename) … … 124 121 mpc_block b; 125 122 mpc_uint64_t size; 126 mpc_uint32_t crc_pos, crc;127 123 FILE * file; 128 124 … … 140 136 size = mpc_bits_get_block(&r, &b); 141 137 142 while( memcmp(b.key, " SI", 2) != 0 ) {143 header_pos[j] += b.size ;138 while( memcmp(b.key, "RG", 2) != 0 ) { 139 header_pos[j] += b.size + size; 144 140 fseek(file, header_pos[j], SEEK_SET); 145 141 fread(buffer, 1, 16, file); … … 150 146 151 147 header_pos[j] += size; 152 153 fread(buffer + 16, 1, 48, file);154 155 crc_pos = r.buff - buffer + (8 > r.count); // save position of CRC156 r.buff += 4; // skip CRC157 mpc_bits_get_size(&r, &size);158 size += 4 + crc_pos;159 148 160 149 buffer[size] = 1; // replaygain version … … 168 157 buffer[size + 8] = album_peak & 0xFF; 169 158 170 crc = crc32(buffer + crc_pos + 4, (int)b.size - 4);171 buffer[crc_pos] = crc >> 24;172 buffer[crc_pos + 1] = (crc >> 16) & 0xFF;173 buffer[crc_pos + 2] = (crc >> 8) & 0xFF;174 buffer[crc_pos + 3] = crc & 0xFF;175 176 159 fseek(file, header_pos[j], SEEK_SET); 177 fwrite(buffer + crc_pos, 1, b.size, file);160 fwrite(buffer + size, 1, b.size, file); 178 161 fclose(file); 179 162 }
Note: See TracChangeset
for help on using the changeset viewer.