Changeset 149 for libmpc/branches/r2d/libmpcenc/encode_sv7.c
- Timestamp:
- 11/23/06 19:17:14 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcenc/encode_sv7.c
r147 r149 76 76 e->Overflows = 0; 77 77 e->seek_pos = 0; 78 } 79 78 e->block_cnt = 0; 79 e->seek_pwr = 1; 80 } 81 82 // writes replay gain info 83 static void writeGainInfo ( mpc_encoder_t * e ) 84 { 85 writeBits ( e, 1, 8 ); // version 86 writeBits ( e, 0, 16 ); // Title gain 87 writeBits ( e, 0, 16 ); // Title peak 88 writeBits ( e, 0, 16 ); // Album gain 89 writeBits ( e, 0, 16 ); // Album peak 90 } 80 91 81 92 // writes SV8-header … … 88 99 const unsigned int ChannelCount) 89 100 { 90 unsigned char samplesCount[10]; 91 int samplesCountLen = encodeSize(SamplesCount, (char *)samplesCount, MPC_FALSE); 92 int i; 101 unsigned char tmp[10]; 102 int i, len = encodeSize(SamplesCount, (char *)tmp, MPC_FALSE); 103 104 len = encodeSize(len + 4, (char *)tmp, MPC_TRUE); 105 writeBits ( e, tmp[0] , 8 ); 93 106 94 107 writeBits ( e, 0x08, 8 ); // StreamVersion 95 108 96 for( i = 0; i < samplesCountLen; i++) // nb of samples 97 writeBits ( e, samplesCount[i] , 8 ); 109 len = encodeSize(SamplesCount, (char *)tmp, MPC_FALSE); 110 for( i = 0; i < len; i++) // nb of samples 111 writeBits ( e, tmp[i] , 8 ); 98 112 99 113 switch ( SampleFreq ) { … … 110 124 writeBits ( e, MS_on , 1 ); // MS-Coding Flag 111 125 writeBits ( e, FRAMES_PER_BLOCK_PWR, 4 ); // frames per block (log2 unit) 126 writeBits ( e, 0, 6 ); // unused 127 128 writeGainInfo(e); 112 129 } 113 130 … … 128 145 writeBits ( e, version_implement, 4 ); 129 146 writeBits ( e, version_build, 8 ); 130 }131 132 // writes replay gain info133 void writeGainInfo ( mpc_encoder_t * e )134 {135 writeBits ( e, 1, 8 ); // version136 writeBits ( e, 0, 16 ); // Title gain137 writeBits ( e, 0, 16 ); // Title peak138 writeBits ( e, 0, 16 ); // Album gain139 writeBits ( e, 0, 16 ); // Album peak140 147 } 141 148 … … 417 424 e->framesInBlock++; 418 425 if (e->framesInBlock == FRAMES_PER_BLOCK) { 419 e->seek_table[e->seek_pos] = ftell(e->outputFile); 420 e->seek_pos++; 426 if ((e->block_cnt & ((1 << e->seek_pwr) - 1)) == 0) { 427 e->seek_table[e->seek_pos] = ftell(e->outputFile); 428 e->seek_pos++; 429 } 430 e->block_cnt++; 421 431 writeBlock(e, "AD", MPC_FALSE); 422 432 }
Note: See TracChangeset
for help on using the changeset viewer.