• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/ffmpeg-2.3.4/libavformat/

Lines Matching defs:mxf

56 #include "mxf.h"
353 MXFContext *mxf = s->priv_data;
363 if (!mxf->aesc && s->key && s->keylen == 16) {
364 mxf->aesc = av_aes_alloc();
365 if (!mxf->aesc)
367 av_aes_init(mxf->aesc, s->key, 128, 1);
393 if (mxf->aesc)
394 av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1);
404 if (mxf->aesc)
405 av_aes_crypt(mxf->aesc, &pkt->data[plaintext_size],
415 MXFContext *mxf = arg;
424 av_log(mxf->fc, AV_LOG_ERROR, "item_num %d is too large\n", item_num);
427 mxf->local_tags = av_calloc(item_num, item_len);
428 if (!mxf->local_tags)
430 mxf->local_tags_count = item_num;
431 avio_read(pb, mxf->local_tags, item_num*item_len);
437 MXFContext *mxf = arg;
443 tmp_part = av_realloc_array(mxf->partitions, mxf->partitions_count + 1, sizeof(*mxf->partitions));
446 mxf->partitions = tmp_part;
448 if (mxf->parsing_backward) {
450 * this makes the entries in mxf->partitions sorted by offset */
451 memmove(&mxf->partitions[mxf->last_forward_partition+1],
452 &mxf->partitions[mxf->last_forward_partition],
453 (mxf->partitions_count - mxf->last_forward_partition)*sizeof(*mxf->partitions));
454 partition = mxf->current_partition = &mxf->partitions[mxf->last_forward_partition];
456 mxf->last_forward_partition++;
457 partition = mxf->current_partition = &mxf->partitions[mxf->partitions_count];
461 mxf->partitions_count++;
475 av_log(mxf->fc, AV_LOG_ERROR, "unknown partition type %i\n", uid[13]);
493 av_log(mxf->fc, AV_LOG_ERROR, "Failed reading UID\n");
500 av_log(mxf->fc, AV_LOG_ERROR,
504 if (!mxf->parsing_backward && mxf->last_forward_partition > 1) {
506 mxf->partitions + mxf->last_forward_partition - 2;
513 av_log(mxf->fc, AV_LOG_ERROR,
520 if (mxf->footer_partition && mxf->footer_partition != footer_partition) {
521 av_log(mxf->fc, AV_LOG_ERROR,
523 mxf->footer_partition, footer_partition);
525 mxf->footer_partition = footer_partition;
529 av_dlog(mxf->fc,
539 mxf->run_in + partition->previous_partition >= klv_offset) {
540 av_log(mxf->fc, AV_LOG_ERROR,
545 if (op[12] == 1 && op[13] == 1) mxf->op = OP1a;
546 else if (op[12] == 1 && op[13] == 2) mxf->op = OP1b;
547 else if (op[12] == 1 && op[13] == 3) mxf->op = OP1c;
548 else if (op[12] == 2 && op[13] == 1) mxf->op = OP2a;
549 else if (op[12] == 2 && op[13] == 2) mxf->op = OP2b;
550 else if (op[12] == 2 && op[13] == 3) mxf->op = OP2c;
551 else if (op[12] == 3 && op[13] == 1) mxf->op = OP3a;
552 else if (op[12] == 3 && op[13] == 2) mxf->op = OP3b;
553 else if (op[12] == 3 && op[13] == 3) mxf->op = OP3c;
554 else if (op[12] == 64&& op[13] == 1) mxf->op = OPSONYOpt;
558 * 2011_DCPTEST_24FPS.V.mxf - two ECs, OP1a
559 * abcdefghiv016f56415e.mxf - zero ECs, OPAtom, output by Avid AirSpeed */
564 if (!mxf->op)
565 av_log(mxf->fc, AV_LOG_WARNING,
570 mxf->op = op;
572 mxf->op = OPAtom;
574 av_log(mxf->fc, AV_LOG_ERROR, "unknown operational pattern: %02xh %02xh - guessing OP1a\n", op[12], op[13]);
575 mxf->op = OP1a;
579 av_log(mxf->fc, AV_LOG_WARNING, "invalid KAGSize %"PRId32" - guessing ",
582 if (mxf->op == OPSONYOpt)
587 av_log(mxf->fc, AV_LOG_WARNING, "%"PRId32"\n", partition->kag_size);
593 static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
597 tmp = av_realloc_array(mxf->metadata_sets, mxf->metadata_sets_count + 1, sizeof(*mxf->metadata_sets));
600 mxf->metadata_sets = tmp;
601 mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set;
602 mxf->metadata_sets_count++;
618 MXFContext *mxf = arg;
621 mxf->packages_count = avio_rb32(pb);
622 mxf->packages_refs = av_calloc(mxf->packages_count, sizeof(UID));
623 if (!mxf->packages_refs)
626 avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
898 /* Private uid used by SONY C0023S01.mxf */
939 static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type)
945 for (i = 0; i < mxf->metadata_sets_count; i++) {
946 if (!memcmp(*strong_ref, mxf->metadata_sets[i]->uid, 16) &&
947 (type == AnyType || mxf->metadata_sets[i]->type == type)) {
948 return mxf->metadata_sets[i];
980 { { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0xff,0x4b,0x46,0x41,0x41,0x00,0x0d,0x4d,0x4F }, 14, AV_CODEC_ID_PCM_S16LE }, /* 0001GL00.MXF.A1.mxf_opatom.mxf */
984 static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments)
991 for (i = 0; i < mxf->metadata_sets_count; i++)
992 if (mxf->metadata_sets[i]->type == IndexTableSegment)
1005 for (i = j = 0; i < mxf->metadata_sets_count; i++)
1006 if (mxf->metadata_sets[i]->type == IndexTableSegment)
1007 unsorted_segments[j++] = (MXFIndexTableSegment*)mxf->metadata_sets[i];
1052 static int mxf_absolute_bodysid_offset(MXFContext *mxf, int body_sid, int64_t offset, int64_t *offset_out)
1057 for (x = 0; x < mxf->partitions_count; x++) {
1058 MXFPartition *p = &mxf->partitions[x];
1071 av_log(mxf->fc, AV_LOG_ERROR,
1081 static int64_t mxf_essence_container_end(MXFContext *mxf, int body_sid)
1086 for (x = 0; x < mxf->partitions_count; x++) {
1087 MXFPartition *p = &mxf->partitions[x];
1102 static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, int64_t *edit_unit_out, int64_t *offset_out, int nag)
1122 av_log(mxf->fc, AV_LOG_ERROR, "IndexSID %i segment at %"PRId64" IndexEntryArray too small\n",
1129 av_log(mxf->fc, AV_LOG_ERROR, "IndexSID %i segment at %"PRId64" missing EditUnitByteCount and IndexEntryArray\n",
1137 return mxf_absolute_bodysid_offset(mxf, index_table->body_sid, offset_temp, offset_out);
1145 av_log(mxf->fc, AV_LOG_ERROR, "failed to map EditUnit %"PRId64" in IndexSID %i to an offset\n", edit_unit, index_table->index_sid);
1150 static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_table)
1205 * We do this by bucket sorting x by x+TemporalOffset[x] into mxf->ptses,
1206 * then settings mxf->first_dts = -max(TemporalOffset[x]).
1225 av_log(mxf->fc, AV_LOG_ERROR,
1235 av_log(mxf->fc, AV_LOG_ERROR,
1255 static int mxf_compute_index_tables(MXFContext *mxf)
1260 if ((ret = mxf_get_sorted_table_segments(mxf, &nb_sorted_segments, &sorted_segments)) ||
1262 av_log(mxf->fc, AV_LOG_WARNING, "broken or empty index\n");
1269 mxf->nb_index_tables++;
1271 av_log(mxf->fc, AV_LOG_ERROR, "found inconsistent BodySID\n");
1277 mxf->index_tables = av_mallocz_array(mxf->nb_index_tables,
1278 sizeof(*mxf->index_tables));
1279 if (!mxf->index_tables) {
1280 av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n");
1292 mxf->index_tables[j].nb_segments++;
1295 for (i = j = 0; j < mxf->nb_index_tables; i += mxf->index_tables[j++].nb_segments) {
1296 MXFIndexTable *t = &mxf->index_tables[j];
1302 av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment"
1309 av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i starts at EditUnit %"PRId64" - seeking may not work as expected\n",
1316 if ((ret = mxf_compute_ptses_fake_index(mxf, t)) < 0)
1325 av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i segment %i has zero IndexDuration and there's more than one segment\n",
1328 if (mxf->fc->nb_streams <= 0) {
1329 av_log(mxf->fc, AV_LOG_WARNING, "no streams?\n");
1336 t->segments[k]->index_duration = mxf->fc->streams[0]->duration;
1363 static int mxf_parse_structural_metadata(MXFContext *mxf)
1369 av_dlog(mxf->fc, "metadata sets count %d\n", mxf->metadata_sets_count);
1371 for (i = 0; i < mxf->packages_count; i++) {
1372 material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage);
1376 av_log(mxf->fc, AV_LOG_ERROR, "no material package found\n");
1396 if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {
1397 av_log(mxf->fc, AV_LOG_ERROR, "could not resolve material track strong ref\n");
1401 if ((component = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, TimecodeComponent))) {
1404 if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {
1405 mxf_add_timecode_metadata(&mxf->fc->metadata, "timecode", &tc);
1409 if (!(material_track->sequence = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, Sequence))) {
1410 av_log(mxf->fc, AV_LOG_ERROR, "could not resolve material track sequence strong ref\n");
1415 component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j], TimecodeComponent);
1421 if (av_timecode_init(&tc, mxf_tc->rate, flags, mxf_tc->start_frame, mxf->fc) == 0) {
1422 mxf_add_timecode_metadata(&mxf->fc->metadata, "timecode", &tc);
1429 component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j], SourceClip);
1433 for (k = 0; k < mxf->packages_count; k++) {
1434 temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[k], SourcePackage);
1443 av_dlog(mxf->fc, "material track %d: no corresponding source package found\n", material_track->track_id);
1447 if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k], Track))) {
1448 av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n");
1458 av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no corresponding source track found\n", material_track->track_id);
1465 if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {
1466 av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n");
1471 /* 0001GL00.MXF.A1.mxf_opatom.mxf has the same SourcePackageID as 0001GL.MXF.V1.mxf_opatom.mxf
1474 av_log(mxf->fc, AV_LOG_ERROR, "material track %d: DataDefinition mismatch\n", material_track->track_id);
1478 st = avformat_new_stream(mxf->fc, NULL);
1480 av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
1492 av_log(mxf->fc, AV_LOG_WARNING,
1505 PRINT_KEY(mxf->fc, "data definition ul", source_track->sequence->data_definition_ul);
1509 source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType);
1513 MXFDescriptor *sub_descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor->sub_descriptors_refs[j], Descriptor);
1516 av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub descriptor strong ref\n");
1528 av_log(mxf->fc, AV_LOG_INFO, "source track %d: stream %d, no descriptor found\n", source_track->track_id, st->index);
1531 PRINT_KEY(mxf->fc, "essence codec ul", descriptor->essence_codec_ul);
1532 PRINT_KEY(mxf->fc, "essence container ul", descriptor->essence_container_ul);
1537 av_log(mxf->fc, AV_LOG_INFO, "broken encrypted mxf file\n");
1538 for (k = 0; k < mxf->metadata_sets_count; k++) {
1539 MXFMetadataSet *metadata = mxf->metadata_sets[k];
1550 av_log(mxf->fc, AV_LOG_VERBOSE, "%s: Universal Label: ",
1553 av_log(mxf->fc, AV_LOG_VERBOSE, "%.2x",
1556 av_log(mxf->fc, AV_LOG_VERBOSE, ".");
1558 av_log(mxf->fc, AV_LOG_VERBOSE, "\n");
1570 av_log(mxf->fc, AV_LOG_INFO, "SegmentedFrame layout isn't currently supported\n");
1577 av_log(mxf->fc, AV_LOG_INFO, "OneField frame layout isn't currently supported\n");
1592 avpriv_request_sample(mxf->fc,
1601 av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout type: %d\n", descriptor->frame_layout);
1633 av_log(mxf->fc, AV_LOG_WARNING, "invalid sample rate (%d/%d) "
1769 MXFContext *mxf = arg;
1770 AVFormatContext *s = mxf->fc;
1837 static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type)
1839 AVIOContext *pb = mxf->fc->pb;
1840 MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
1852 av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size);
1854 av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x with 0 size\n", tag);
1859 for (i = 0; i < mxf->local_tags_count; i++) {
1860 int local_tag = AV_RB16(mxf->local_tags+i*18);
1862 memcpy(uid, mxf->local_tags+i*18+2, 16);
1863 av_dlog(mxf->fc, "local tag %#04x\n", local_tag);
1864 PRINT_KEY(mxf->fc, "uid", uid);
1874 * it extending past the end of the KLV though (zzuf5.mxf). */
1879 av_log(mxf->fc, AV_LOG_ERROR,
1887 return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0;
1894 static int mxf_seek_to_previous_partition(MXFContext *mxf)
1896 AVIOContext *pb = mxf->fc->pb;
1898 if (!mxf->current_partition ||
1899 mxf->run_in + mxf->current_partition->previous_partition <= mxf->last_forward_tell)
1903 avio_seek(pb, mxf->run_in + mxf->current_partition->previous_partition, SEEK_SET);
1904 mxf->current_partition = NULL;
1906 av_dlog(mxf->fc, "seeking to previous partition\n");
1915 static int mxf_parse_handle_essence(MXFContext *mxf)
1917 AVIOContext *pb = mxf->fc->pb;
1920 if (mxf->parsing_backward) {
1921 return mxf_seek_to_previous_partition(mxf);
1923 uint64_t offset = mxf->footer_partition ? mxf->footer_partition
1924 : mxf->last_partition;
1927 av_dlog(mxf->fc, "no last partition\n");
1931 av_dlog(mxf->fc, "seeking to last partition\n");
1934 mxf->last_forward_tell = avio_tell(pb);
1937 av_log(mxf->fc, AV_LOG_INFO, "file is not seekable - not parsing last partition\n");
1942 if ((ret = avio_seek(pb, mxf->run_in + offset, SEEK_SET)) < 0) {
1943 av_log(mxf->fc, AV_LOG_ERROR,
1946 mxf->run_in + offset, ret);
1950 mxf->current_partition = NULL;
1951 mxf->parsing_backward = 1;
1961 static int mxf_parse_handle_partition_or_eof(MXFContext *mxf)
1963 return mxf->parsing_backward ? mxf_seek_to_previous_partition(mxf) : 1;
1969 static void mxf_compute_essence_containers(MXFContext *mxf)
1974 if (mxf->op == OPAtom)
1977 for (x = 0; x < mxf->partitions_count; x++) {
1978 MXFPartition *p = &mxf->partitions[x];
1983 if (x >= mxf->partitions_count - 1)
1987 p->essence_length = mxf->partitions[x+1].this_partition - p->essence_offset;
1992 av_log(mxf->fc, AV_LOG_ERROR,
1994 x+1, mxf->partitions[x+1].this_partition);
2020 MXFContext *mxf = s->priv_data;
2024 if (mxf->op != OPAtom)
2031 mxf->nb_index_tables != 1 ||
2032 mxf->index_tables[0].nb_segments != 1 ||
2033 mxf->index_tables[0].segments[0]->edit_unit_byte_count >= 32)
2040 mxf->edit_units_per_packet = 1920;
2045 MXFContext *mxf = s->priv_data;
2065 mxf->last_partition = avio_rb64(s->pb);
2068 avio_seek(s->pb, mxf->run_in, SEEK_SET);
2073 MXFContext *mxf = s->priv_data;
2080 mxf->last_forward_tell = INT64_MAX;
2081 mxf->edit_units_per_packet = 1;
2088 mxf->fc = s;
2089 mxf->run_in = avio_tell(s->pb);
2096 av_log(mxf->fc, AV_LOG_ERROR, "MXF structure loop detected\n");
2103 if(mxf_parse_handle_partition_or_eof(mxf) <= 0)
2116 if (!mxf->current_partition) {
2117 av_log(mxf->fc, AV_LOG_ERROR, "found essence prior to first PartitionPack\n");
2121 if (!mxf->current_partition->essence_offset) {
2128 round_to_kag(mxf->current_partition->this_partition +
2129 mxf->current_partition->pack_length, mxf->current_partition->kag_size) +
2130 round_to_kag(mxf->current_partition->header_byte_count, mxf->current_partition->kag_size) +
2131 round_to_kag(mxf->current_partition->index_byte_count, mxf->current_partition->kag_size);
2133 if (mxf->op == OPAtom) {
2137 mxf->current_partition->essence_offset = avio_tell(s->pb);
2138 mxf->current_partition->essence_length = klv.length;
2140 /* NOTE: op1a_essence_offset may be less than to klv.offset (C0023S01.mxf) */
2141 mxf->current_partition->essence_offset = op1a_essence_offset;
2149 if (mxf_parse_handle_essence(mxf) <= 0)
2153 klv.key[13] >= 2 && klv.key[13] <= 4 && mxf->current_partition) {
2155 if(mxf_parse_handle_partition_or_eof(mxf) <= 0)
2157 else if (mxf->parsing_backward)
2166 res = mxf_read_local_tags(mxf, &klv, metadata->read, metadata->ctx_size, metadata->type);
2169 res = metadata->read(mxf, s->pb, 0, klv.length, klv.key, klv.offset);
2197 mxf_compute_essence_containers(mxf);
2201 if ((ret = mxf_parse_structural_metadata(mxf)) < 0)
2204 if ((ret = mxf_compute_index_tables(mxf)) < 0)
2207 if (mxf->nb_index_tables > 1) {
2209 av_log(mxf->fc, AV_LOG_INFO, "got %i index tables - only the first one (IndexSID %i) will be used\n",
2210 mxf->nb_index_tables, mxf->index_tables[0].index_sid);
2211 } else if (mxf->nb_index_tables == 0 && mxf->op == OPAtom) {
2212 av_log(mxf->fc, AV_LOG_ERROR, "cannot demux OPAtom without an index\n");
2227 * Sets mxf->current_edit_unit based on what offset we're currently at.
2230 static int64_t mxf_set_current_edit_unit(MXFContext *mxf, int64_t current_offset)
2233 MXFIndexTable *t = &mxf->index_tables[0];
2237 if (mxf->nb_index_tables <= 0)
2240 /* find mxf->current_edit_unit so that the next edit unit starts ahead of current_offset */
2241 while (mxf->current_edit_unit >= 0) {
2242 if (mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit + 1, NULL, &next_ofs, 0) < 0)
2247 * around this fixes the infinite loop on zzuf3.mxf */
2248 av_log(mxf->fc, AV_LOG_ERROR,
2257 mxf->current_edit_unit++;
2260 /* not checking mxf->current_edit_unit >= t->nb_ptses here since CBR files may lack IndexEntryArrays */
2261 if (mxf->current_edit_unit < 0)
2267 static int mxf_compute_sample_count(MXFContext *mxf, int stream_index,
2271 AVStream *st = mxf->fc->streams[stream_index];
2278 spf = ff_mxf_get_samples_per_frame(mxf->fc, time_base);
2282 *sample_count = av_q2d(av_mul_q((AVRational){mxf->current_edit_unit, 1},
2285 av_log(mxf->fc, AV_LOG_WARNING,
2300 *sample_count = (mxf->current_edit_unit / size) * (uint64_t)total;
2301 for (i = 0; i < mxf->current_edit_unit % size; i++) {
2308 static int mxf_set_audio_pts(MXFContext *mxf, AVCodecContext *codec,
2311 MXFTrack *track = mxf->fc->streams[pkt->stream_index]->priv_data;
2327 MXFContext *mxf = s->priv_data;
2363 next_ofs = mxf_set_current_edit_unit(mxf, klv.offset);
2372 mxf->current_edit_unit);
2395 /* mxf->current_edit_unit good - see if we have an
2397 MXFIndexTable *t = &mxf->index_tables[0];
2399 if (mxf->nb_index_tables >= 1 && mxf->current_edit_unit < t->nb_ptses) {
2400 pkt->dts = mxf->current_edit_unit + t->first_dts;
2401 pkt->pts = t->ptses[mxf->current_edit_unit];
2405 pkt->pts = mxf->current_edit_unit;
2408 ret = mxf_set_audio_pts(mxf, codec, pkt);
2426 MXFContext *mxf = s->priv_data;
2433 if (mxf->op != OPAtom)
2439 t = &mxf->index_tables[0];
2441 if (mxf->current_edit_unit >= st->duration)
2444 edit_units = FFMIN(mxf->edit_units_per_packet, st->duration - mxf->current_edit_unit);
2446 if ((ret = mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit, NULL, &pos, 1)) < 0)
2451 if ((ret = mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit + edit_units, NULL, &next_pos, 0)) < 0 &&
2452 (next_pos = mxf_essence_container_end(mxf, t->body_sid)) <= 0) {
2471 mxf->current_edit_unit >= 0 && mxf->current_edit_unit < t->nb_ptses) {
2472 pkt->dts = mxf->current_edit_unit + t->first_dts;
2473 pkt->pts = t->ptses[mxf->current_edit_unit];
2475 int ret = mxf_set_audio_pts(mxf, st->codec, pkt);
2480 mxf->current_edit_unit += edit_units;
2487 MXFContext *mxf = s->priv_data;
2491 av_freep(&mxf->packages_refs);
2496 for (i = 0; i < mxf->metadata_sets_count; i++) {
2497 switch (mxf->metadata_sets[i]->type) {
2499 av_freep(&((MXFDescriptor *)mxf->metadata_sets[i])->extradata);
2502 av_freep(&((MXFDescriptor *)mxf->metadata_sets[i])->sub_descriptors_refs);
2505 av_freep(&((MXFSequence *)mxf->metadata_sets[i])->structural_components_refs);
2509 av_freep(&((MXFPackage *)mxf->metadata_sets[i])->tracks_refs);
2512 seg = (MXFIndexTableSegment *)mxf->metadata_sets[i];
2520 av_freep(&mxf->metadata_sets[i]);
2522 av_freep(&mxf->partitions);
2523 av_freep(&mxf->metadata_sets);
2524 av_freep(&mxf->aesc);
2525 av_freep(&mxf->local_tags);
2527 if (mxf->index_tables) {
2528 for (i = 0; i < mxf->nb_index_tables; i++) {
2529 av_freep(&mxf->index_tables[i].segments);
2530 av_freep(&mxf->index_tables[i].ptses);
2531 av_freep(&mxf->index_tables[i].fake_index);
2534 av_freep(&mxf->index_tables);
2570 MXFContext* mxf = s->priv_data;
2581 if (mxf->nb_index_tables <= 0) {
2593 mxf->current_edit_unit = sample_time;
2595 t = &mxf->index_tables[0];
2611 if ((ret = mxf_edit_unit_absolute_offset(mxf, t, sample_time, &sample_time, &seekpos, 1)) < 0)
2615 mxf->current_edit_unit = sample_time;
2625 ret = mxf_compute_sample_count(mxf, i, &current_sample_count);
2636 .name = "mxf",