Mercurial > libavformat.hg
comparison mxfenc.c @ 4435:4f96c60c9561 libavformat
cosmetics, associate mxf_write_klv_fill to aligned elements
author | bcoudurier |
---|---|
date | Tue, 10 Feb 2009 07:23:51 +0000 |
parents | a75d42745d16 |
children | 98928aca0df9 |
comparison
equal
deleted
inserted
replaced
4434:a75d42745d16 | 4435:4f96c60c9561 |
---|---|
1049 // mark the start of the headermetadata and calculate metadata size | 1049 // mark the start of the headermetadata and calculate metadata size |
1050 int64_t pos, start; | 1050 int64_t pos, start; |
1051 unsigned header_byte_count; | 1051 unsigned header_byte_count; |
1052 | 1052 |
1053 mxf_write_klv_fill(s); | 1053 mxf_write_klv_fill(s); |
1054 | |
1055 start = url_ftell(s->pb); | 1054 start = url_ftell(s->pb); |
1056 mxf_write_primer_pack(s); | 1055 mxf_write_primer_pack(s); |
1057 mxf_write_header_metadata_sets(s); | 1056 mxf_write_header_metadata_sets(s); |
1058 pos = url_ftell(s->pb); | 1057 pos = url_ftell(s->pb); |
1059 header_byte_count = pos - start + klv_fill_size(pos); | 1058 header_byte_count = pos - start + klv_fill_size(pos); |
1328 if (!mxf->header_written) { | 1327 if (!mxf->header_written) { |
1329 mxf_write_partition(s, 1, 0, 0, header_open_partition_key, 1); | 1328 mxf_write_partition(s, 1, 0, 0, header_open_partition_key, 1); |
1330 mxf->header_written = 1; | 1329 mxf->header_written = 1; |
1331 } | 1330 } |
1332 | 1331 |
1333 mxf_write_klv_fill(s); | |
1334 | |
1335 if (st->index == 0) { | 1332 if (st->index == 0) { |
1336 mxf->index_entries[mxf->edit_units_count].offset = url_ftell(pb); | 1333 mxf->index_entries[mxf->edit_units_count].offset = url_ftell(pb); |
1337 | 1334 |
1335 mxf_write_klv_fill(s); | |
1338 mxf_write_system_item(s); | 1336 mxf_write_system_item(s); |
1339 mxf_write_klv_fill(s); | |
1340 | 1337 |
1341 mxf->edit_units_count++; | 1338 mxf->edit_units_count++; |
1342 } else if (st->index == 1) { | 1339 } else if (st->index == 1) { |
1343 mxf->index_entries[mxf->edit_units_count-1].slice_offset = | 1340 mxf->index_entries[mxf->edit_units_count-1].slice_offset = |
1344 url_ftell(pb) - mxf->index_entries[mxf->edit_units_count-1].offset; | 1341 url_ftell(pb) - mxf->index_entries[mxf->edit_units_count-1].offset; |
1345 } | 1342 } |
1346 | 1343 |
1344 mxf_write_klv_fill(s); | |
1347 put_buffer(pb, sc->track_essence_element_key, 16); // write key | 1345 put_buffer(pb, sc->track_essence_element_key, 16); // write key |
1348 klv_encode_ber_length(pb, pkt->size); // write length | 1346 klv_encode_ber_length(pb, pkt->size); // write length |
1349 put_buffer(pb, pkt->data, pkt->size); // write value | 1347 put_buffer(pb, pkt->data, pkt->size); // write value |
1350 | 1348 |
1351 sc->duration = FFMAX(pkt->pts + pkt->duration, sc->duration); | 1349 sc->duration = FFMAX(pkt->pts + pkt->duration, sc->duration); |
1383 // add encoded ber length | 1381 // add encoded ber length |
1384 index_byte_count += 16 + klv_ber_length(index_byte_count); | 1382 index_byte_count += 16 + klv_ber_length(index_byte_count); |
1385 index_byte_count += klv_fill_size(index_byte_count); | 1383 index_byte_count += klv_fill_size(index_byte_count); |
1386 | 1384 |
1387 mxf_write_klv_fill(s); | 1385 mxf_write_klv_fill(s); |
1388 | |
1389 mxf->footer_partition_offset = url_ftell(pb); | 1386 mxf->footer_partition_offset = url_ftell(pb); |
1390 mxf_write_partition(s, 0, 2, index_byte_count, footer_partition_key, 0); | 1387 mxf_write_partition(s, 0, 2, index_byte_count, footer_partition_key, 0); |
1391 | 1388 |
1392 mxf_write_klv_fill(s); | 1389 mxf_write_klv_fill(s); |
1393 | |
1394 mxf_write_index_table_segment(s); | 1390 mxf_write_index_table_segment(s); |
1395 | 1391 |
1396 mxf_write_klv_fill(s); | 1392 mxf_write_klv_fill(s); |
1397 | |
1398 mxf_write_random_index_pack(s); | 1393 mxf_write_random_index_pack(s); |
1399 | 1394 |
1400 if (!url_is_streamed(s->pb)) { | 1395 if (!url_is_streamed(s->pb)) { |
1401 url_fseek(pb, 0, SEEK_SET); | 1396 url_fseek(pb, 0, SEEK_SET); |
1402 mxf_write_partition(s, 1, 0, 0, header_closed_partition_key, 1); | 1397 mxf_write_partition(s, 1, 0, 0, header_closed_partition_key, 1); |