Changeset 204 for libmpc/branches/r2d/libmpcenc/bitstream.c
- Timestamp:
- 02/08/07 21:36:52 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcenc/bitstream.c
r194 r204 194 194 } 195 195 196 void writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC)196 mpc_uint32_t writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC, mpc_uint32_t min_size) 197 197 { 198 198 FILE * fp = e->outputFile; … … 200 200 mpc_uint8_t * datas = e->buffer; 201 201 char blockSize[10]; 202 mpc_uint _t len;202 mpc_uint32_t len; 203 203 204 204 writeBits(e, 0, (8 - e->bitsCount) % 8); … … 206 206 207 207 // write block header (key / length) 208 len = encodeSize(e->pos + 2 + (addCRC ? 4 : 0), blockSize, MPC_TRUE); 208 len = e->pos + 2 + (addCRC > 0) * 4; 209 if (min_size <= len) 210 min_size = len; 211 else { 212 mpc_uint32_t pad = min_size - len, i; 213 for(i = 0; i < pad; i++) 214 writeBits(e, 0, 8); 215 } 216 len = encodeSize(min_size, blockSize, MPC_TRUE); 209 217 fwrite(key, sizeof(char), 2, fp); 210 218 fwrite(blockSize, sizeof(char), len, fp); 211 219 e->outputBits += (len + 2) * 8; 212 213 220 214 221 if (addCRC) { … … 236 243 } 237 244 e->framesInBlock = 0; 245 246 return min_size; 238 247 } 239 248
Note: See TracChangeset
for help on using the changeset viewer.