Changeset 388
- Timestamp:
- 04/02/08 16:01:16 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/mpcchap/mpcchap.c
r387 r388 106 106 tag_len += key_len + item_len; 107 107 } 108 tag_len += 24 + nitem * 9;109 char block_ size[12] = "CT";108 if (nitem > 0) tag_len += 24 + nitem * 9; 109 char block_header[12] = "CT"; 110 110 char sample_offset[10]; 111 111 int offset_size = encodeSize(chap_pos, sample_offset, MPC_FALSE); 112 tag_len = encodeSize(tag_len + offset_size + 2, block_ size+ 2, MPC_TRUE);113 fwrite(block_ size, 1, tag_len + 2, in_file);112 tag_len = encodeSize(tag_len + offset_size + 2, block_header + 2, MPC_TRUE); 113 fwrite(block_header, 1, tag_len + 2, in_file); 114 114 fwrite(sample_offset, 1, offset_size, in_file); 115 115 FinalizeTags(in_file, TAG_VERSION, TAG_NO_FOOTER | TAG_NO_PREAMBLE); … … 141 141 142 142 for (i = 0; i < chap_nb; i++) { 143 int item_count, j;144 143 fprintf(out_file, "[%lli]\n", mpc_demux_chap(demux, i, &tag, &tag_size)); 145 item_count = tag[8] | (tag[9] << 8) | (tag[10] << 16) | (tag[11] << 24); 146 tag += 24; 147 for( j = 0; j < item_count; j++){ 148 int key_len = strlen(tag + 8); 149 int value_len = tag[0] | (tag[1] << 8) | (tag[2] << 16) | (tag[3] << 24); 150 fprintf(out_file, "%s=%.*s\n", tag + 8, value_len, tag + 9 + key_len); 151 tag += 9 + key_len + value_len; 144 if (tag_size > 0) { 145 int item_count, j; 146 item_count = tag[8] | (tag[9] << 8) | (tag[10] << 16) | (tag[11] << 24); 147 tag += 24; 148 for( j = 0; j < item_count; j++){ 149 int key_len = strlen(tag + 8); 150 int value_len = tag[0] | (tag[1] << 8) | (tag[2] << 16) | (tag[3] << 24); 151 fprintf(out_file, "%s=\"%.*s\"\n", tag + 8, value_len, tag + 9 + key_len); 152 tag += 9 + key_len + value_len; 153 } 152 154 } 153 155 fprintf(out_file, "\n");
Note: See TracChangeset
for help on using the changeset viewer.