Lines Matching refs:pb
426 static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value) in mxf_write_uuid() argument
428 avio_write(pb, uuid_base, 12); in mxf_write_uuid()
429 avio_wb16(pb, type); in mxf_write_uuid()
430 avio_wb16(pb, value); in mxf_write_uuid()
436 avio_write(s->pb, umid_ul, 13); in mxf_write_umid()
437 avio_wb24(s->pb, mxf->instance_number); in mxf_write_umid()
438 avio_write(s->pb, mxf->umid, 15); in mxf_write_umid()
439 avio_w8(s->pb, type); in mxf_write_umid()
442 static void mxf_write_refs_count(AVIOContext *pb, int ref_count) in mxf_write_refs_count() argument
444 avio_wb32(pb, ref_count); in mxf_write_refs_count()
445 avio_wb32(pb, 16); in mxf_write_refs_count()
456 static int klv_encode_ber_length(AVIOContext *pb, uint64_t len) in klv_encode_ber_length() argument
462 avio_w8(pb, len); in klv_encode_ber_length()
468 avio_w8(pb, 0x80 + size); in klv_encode_ber_length()
471 avio_w8(pb, len >> 8 * size & 0xff); in klv_encode_ber_length()
476 static void klv_encode_ber4_length(AVIOContext *pb, int len) in klv_encode_ber4_length() argument
478 avio_w8(pb, 0x80 + 3); in klv_encode_ber4_length()
479 avio_wb24(pb, len); in klv_encode_ber4_length()
482 static void klv_encode_ber9_length(AVIOContext *pb, uint64_t len) in klv_encode_ber9_length() argument
484 avio_w8(pb, 0x80 + 8); in klv_encode_ber9_length()
485 avio_wb64(pb, len); in klv_encode_ber9_length()
521 AVIOContext *pb = s->pb; in mxf_write_primer_pack() local
561 avio_write(pb, primer_pack_key, 16); in mxf_write_primer_pack()
562 klv_encode_ber_length(pb, local_tag_number * 18 + 8); in mxf_write_primer_pack()
564 avio_wb32(pb, local_tag_number); // local_tag num in mxf_write_primer_pack()
565 avio_wb32(pb, 18); // item size, always 18 according to the specs in mxf_write_primer_pack()
569 avio_wb16(pb, mxf_local_tag_batch[i].local_tag); in mxf_write_primer_pack()
570 avio_write(pb, mxf_local_tag_batch[i].uid, 16); in mxf_write_primer_pack()
578 AVIOContext *pb = s->pb; in mxf_write_local_tag() local
584 avio_wb16(pb, tag); in mxf_write_local_tag()
585 avio_wb16(pb, size); in mxf_write_local_tag()
588 static void mxf_write_metadata_key(AVIOContext *pb, unsigned int value) in mxf_write_metadata_key() argument
590 avio_write(pb, header_metadata_key, 13); in mxf_write_metadata_key()
591 avio_wb24(pb, value); in mxf_write_metadata_key()
611 AVIOContext *pb = s->pb; in mxf_write_essence_container_refs() local
614 mxf_write_refs_count(pb, DESCRIPTOR_COUNT(c->essence_container_count)); in mxf_write_essence_container_refs()
621 avio_write(pb, *sc->container_ul, 16); in mxf_write_essence_container_refs()
627 avio_write(pb, multiple_desc_ul, 16); in mxf_write_essence_container_refs()
633 AVIOContext *pb = s->pb; in mxf_write_preface() local
635 mxf_write_metadata_key(pb, 0x012f00); in mxf_write_preface()
636 PRINT_KEY(s, "preface key", pb->buf_ptr - 16); in mxf_write_preface()
637 klv_encode_ber_length(pb, 138 + 16LL * DESCRIPTOR_COUNT(mxf->essence_container_count)); in mxf_write_preface()
641 mxf_write_uuid(pb, Preface, 0); in mxf_write_preface()
642 PRINT_KEY(s, "preface uid", pb->buf_ptr - 16); in mxf_write_preface()
646 avio_wb64(pb, mxf->timestamp); in mxf_write_preface()
650 avio_wb16(pb, 259); // v1.3 in mxf_write_preface()
654 avio_wb32(pb, 1); in mxf_write_preface()
658 mxf_write_refs_count(pb, 1); in mxf_write_preface()
659 mxf_write_uuid(pb, Identification, 0); in mxf_write_preface()
663 mxf_write_uuid(pb, ContentStorage, 0); in mxf_write_preface()
668 avio_write(pb, opatom_ul, 16); in mxf_write_preface()
670 avio_write(pb, op1a_ul, 16); in mxf_write_preface()
678 avio_wb64(pb, 0); in mxf_write_preface()
728 AVIOContext *pb = s->pb; in mxf_write_local_tag_utf16() local
737 avio_put_str16be(pb, value); in mxf_write_local_tag_utf16()
741 AVIOContext *pb = s->pb; in store_version() local
744 avio_wb16(pb, 0); // major in store_version()
745 avio_wb16(pb, 0); // minor in store_version()
746 avio_wb16(pb, 0); // tertiary in store_version()
748 avio_wb16(pb, LIBAVFORMAT_VERSION_MAJOR); // major in store_version()
749 avio_wb16(pb, LIBAVFORMAT_VERSION_MINOR); // minor in store_version()
750 avio_wb16(pb, LIBAVFORMAT_VERSION_MICRO); // tertiary in store_version()
752 avio_wb16(pb, 0); // patch in store_version()
753 avio_wb16(pb, 0); // release in store_version()
760 AVIOContext *pb = s->pb; in mxf_write_identification() local
772 mxf_write_metadata_key(pb, 0x013000); in mxf_write_identification()
773 PRINT_KEY(s, "identification key", pb->buf_ptr - 16); in mxf_write_identification()
779 klv_encode_ber_length(pb, length); in mxf_write_identification()
783 mxf_write_uuid(pb, Identification, 0); in mxf_write_identification()
784 PRINT_KEY(s, "identification uid", pb->buf_ptr - 16); in mxf_write_identification()
788 mxf_write_uuid(pb, Identification, 1); in mxf_write_identification()
800 mxf_write_uuid(pb, Identification, 2); in mxf_write_identification()
804 avio_wb64(pb, mxf->timestamp); in mxf_write_identification()
812 AVIOContext *pb = s->pb; in mxf_write_content_storage() local
815 mxf_write_metadata_key(pb, 0x011800); in mxf_write_content_storage()
816 PRINT_KEY(s, "content storage key", pb->buf_ptr - 16); in mxf_write_content_storage()
817 klv_encode_ber_length(pb, 60 + (16 * package_count)); in mxf_write_content_storage()
821 mxf_write_uuid(pb, ContentStorage, 0); in mxf_write_content_storage()
822 PRINT_KEY(s, "content storage uid", pb->buf_ptr - 16); in mxf_write_content_storage()
826 mxf_write_refs_count(pb, package_count); in mxf_write_content_storage()
828 mxf_write_uuid(pb, packages[i].type, packages[i].instance); in mxf_write_content_storage()
833 mxf_write_refs_count(pb, 1); in mxf_write_content_storage()
834 mxf_write_uuid(pb, EssenceContainerData, 0); in mxf_write_content_storage()
840 AVIOContext *pb = s->pb; in mxf_write_track() local
843 mxf_write_metadata_key(pb, 0x013b00); in mxf_write_track()
844 PRINT_KEY(s, "track key", pb->buf_ptr - 16); in mxf_write_track()
845 klv_encode_ber_length(pb, 80); in mxf_write_track()
849 mxf_write_uuid(pb, Track, mxf->track_instance_count); in mxf_write_track()
850 PRINT_KEY(s, "track uid", pb->buf_ptr - 16); in mxf_write_track()
854 avio_wb32(pb, st->index+2); in mxf_write_track()
859 avio_wb32(pb, 0); // track number of material package is 0 in mxf_write_track()
861 avio_write(pb, sc->track_essence_element_key + 12, 4); in mxf_write_track()
867 avio_wb32(pb, mxf->tc.rate.num); in mxf_write_track()
868 avio_wb32(pb, mxf->tc.rate.den); in mxf_write_track()
870 avio_wb32(pb, mxf->time_base.den); in mxf_write_track()
871 avio_wb32(pb, mxf->time_base.num); in mxf_write_track()
876 avio_wb64(pb, 0); in mxf_write_track()
880 mxf_write_uuid(pb, Sequence, mxf->track_instance_count); in mxf_write_track()
888 AVIOContext *pb = s->pb; in mxf_write_common_fields() local
893 avio_write(pb, smpte_12m_timecode_track_data_ul, 16); in mxf_write_common_fields()
896 avio_write(pb, data_def_ul->uid, 16); in mxf_write_common_fields()
903 avio_wb64(pb, mxf->body_offset / mxf->edit_unit_byte_count); in mxf_write_common_fields()
905 avio_wb64(pb, mxf->duration); in mxf_write_common_fields()
912 AVIOContext *pb = s->pb; in mxf_write_sequence() local
915 mxf_write_metadata_key(pb, 0x010f00); in mxf_write_sequence()
916 PRINT_KEY(s, "sequence key", pb->buf_ptr - 16); in mxf_write_sequence()
917 klv_encode_ber_length(pb, 80); in mxf_write_sequence()
920 mxf_write_uuid(pb, Sequence, mxf->track_instance_count); in mxf_write_sequence()
922 PRINT_KEY(s, "sequence uid", pb->buf_ptr - 16); in mxf_write_sequence()
927 mxf_write_refs_count(pb, 1); in mxf_write_sequence()
933 mxf_write_uuid(pb, component, mxf->track_instance_count); in mxf_write_sequence()
939 AVIOContext *pb = s->pb; in mxf_write_timecode_component() local
941 mxf_write_metadata_key(pb, 0x011400); in mxf_write_timecode_component()
942 klv_encode_ber_length(pb, 75); in mxf_write_timecode_component()
946 mxf_write_uuid(pb, TimecodeComponent, mxf->track_instance_count); in mxf_write_timecode_component()
952 avio_wb64(pb, mxf->tc.start); in mxf_write_timecode_component()
956 avio_wb16(pb, mxf->timecode_base); in mxf_write_timecode_component()
960 avio_w8(pb, !!(mxf->tc.flags & AV_TIMECODE_FLAG_DROPFRAME)); in mxf_write_timecode_component()
966 AVIOContext *pb = s->pb; in mxf_write_structural_component() local
969 mxf_write_metadata_key(pb, 0x011100); in mxf_write_structural_component()
970 PRINT_KEY(s, "sturctural component key", pb->buf_ptr - 16); in mxf_write_structural_component()
971 klv_encode_ber_length(pb, 108); in mxf_write_structural_component()
975 mxf_write_uuid(pb, SourceClip, mxf->track_instance_count); in mxf_write_structural_component()
977 PRINT_KEY(s, "structural component uid", pb->buf_ptr - 16); in mxf_write_structural_component()
982 avio_wb64(pb, 0); in mxf_write_structural_component()
988 avio_wb64(pb, 0); in mxf_write_structural_component()
995 avio_wb32(pb, 0); in mxf_write_structural_component()
997 avio_wb32(pb, st->index+2); in mxf_write_structural_component()
1002 AVIOContext *pb = s->pb; in mxf_write_tape_descriptor() local
1004 mxf_write_metadata_key(pb, 0x012e00); in mxf_write_tape_descriptor()
1005 PRINT_KEY(s, "tape descriptor key", pb->buf_ptr - 16); in mxf_write_tape_descriptor()
1006 klv_encode_ber_length(pb, 20); in mxf_write_tape_descriptor()
1008 mxf_write_uuid(pb, TapeDescriptor, 0); in mxf_write_tape_descriptor()
1009 PRINT_KEY(s, "tape_desc uid", pb->buf_ptr - 16); in mxf_write_tape_descriptor()
1016 AVIOContext *pb = s->pb; in mxf_write_multi_descriptor() local
1020 mxf_write_metadata_key(pb, 0x014400); in mxf_write_multi_descriptor()
1021 PRINT_KEY(s, "multiple descriptor key", pb->buf_ptr - 16); in mxf_write_multi_descriptor()
1022 klv_encode_ber_length(pb, 64 + 16LL * s->nb_streams); in mxf_write_multi_descriptor()
1025 mxf_write_uuid(pb, MultipleDescriptor, 0); in mxf_write_multi_descriptor()
1026 PRINT_KEY(s, "multi_desc uid", pb->buf_ptr - 16); in mxf_write_multi_descriptor()
1030 avio_wb32(pb, mxf->time_base.den); in mxf_write_multi_descriptor()
1031 avio_wb32(pb, mxf->time_base.num); in mxf_write_multi_descriptor()
1041 avio_write(pb, ul, 16); in mxf_write_multi_descriptor()
1045 mxf_write_refs_count(pb, s->nb_streams); in mxf_write_multi_descriptor()
1047 mxf_write_uuid(pb, SubDescriptor, i); in mxf_write_multi_descriptor()
1054 AVIOContext *pb = s->pb; in mxf_write_generic_desc() local
1057 avio_write(pb, key, 16); in mxf_write_generic_desc()
1058 klv_encode_ber4_length(pb, 0); in mxf_write_generic_desc()
1059 pos = avio_tell(pb); in mxf_write_generic_desc()
1062 mxf_write_uuid(pb, SubDescriptor, st->index); in mxf_write_generic_desc()
1065 avio_wb32(pb, st->index+2); in mxf_write_generic_desc()
1069 avio_wb32(pb, mxf->time_base.den); in mxf_write_generic_desc()
1070 avio_wb32(pb, mxf->time_base.num); in mxf_write_generic_desc()
1074 avio_wb32(pb, st->codecpar->sample_rate); in mxf_write_generic_desc()
1075 avio_wb32(pb, 1); in mxf_write_generic_desc()
1077 avio_wb32(pb, mxf->time_base.den); in mxf_write_generic_desc()
1078 avio_wb32(pb, mxf->time_base.num); in mxf_write_generic_desc()
1083 avio_write(pb, *sc->container_ul, 16); in mxf_write_generic_desc()
1110 AVIOContext *pb = s->pb; in mxf_write_cdci_common() local
1135 avio_wb32(pb, stored_width); in mxf_write_cdci_common()
1138 avio_wb32(pb, stored_height>>sc->interlaced); in mxf_write_cdci_common()
1143 avio_wb32(pb, 0); in mxf_write_cdci_common()
1147 avio_wb32(pb, 0); in mxf_write_cdci_common()
1151 avio_wb32(pb, 0); in mxf_write_cdci_common()
1156 avio_wb32(pb, stored_width); in mxf_write_cdci_common()
1160 avio_wb32(pb, st->codecpar->height>>sc->interlaced); in mxf_write_cdci_common()
1164 avio_wb32(pb, 0); in mxf_write_cdci_common()
1168 avio_wb32(pb, 0); in mxf_write_cdci_common()
1171 avio_wb32(pb, stored_width); in mxf_write_cdci_common()
1181 avio_wb32(pb, display_height>>sc->interlaced); in mxf_write_cdci_common()
1185 avio_wb32(pb, 0); in mxf_write_cdci_common()
1189 avio_wb32(pb, (st->codecpar->height - display_height)>>sc->interlaced); in mxf_write_cdci_common()
1194 avio_wb32(pb, -((st->codecpar->height - display_height)&1)); in mxf_write_cdci_common()
1199 avio_wb32(pb, sc->component_depth); in mxf_write_cdci_common()
1203 avio_wb32(pb, sc->h_chroma_sub_sample); in mxf_write_cdci_common()
1207 avio_wb32(pb, sc->v_chroma_sub_sample); in mxf_write_cdci_common()
1211 avio_w8(pb, sc->color_siting); in mxf_write_cdci_common()
1215 avio_wb16(pb, 0); in mxf_write_cdci_common()
1227 avio_wb32(pb, black); in mxf_write_cdci_common()
1229 avio_wb32(pb, white); in mxf_write_cdci_common()
1231 avio_wb32(pb, color); in mxf_write_cdci_common()
1236 avio_w8(pb, sc->signal_standard); in mxf_write_cdci_common()
1241 avio_w8(pb, sc->interlaced); in mxf_write_cdci_common()
1261 avio_wb32(pb, 2); in mxf_write_cdci_common()
1262 avio_wb32(pb, 4); in mxf_write_cdci_common()
1263 avio_wb32(pb, f1); in mxf_write_cdci_common()
1264 avio_wb32(pb, f2); in mxf_write_cdci_common()
1267 avio_wb32(pb, sc->aspect_ratio.num); in mxf_write_cdci_common()
1268 avio_wb32(pb, sc->aspect_ratio.den); in mxf_write_cdci_common()
1272 avio_write(pb, color_primaries_ul->uid, 16); in mxf_write_cdci_common()
1277 avio_write(pb, color_trc_ul->uid, 16); in mxf_write_cdci_common()
1282 avio_write(pb, color_space_ul->uid, 16); in mxf_write_cdci_common()
1286 avio_write(pb, *sc->codec_ul, 16); in mxf_write_cdci_common()
1294 avio_wb16(pb, rescale_mastering_chroma(metadata->display_primaries[0][0])); in mxf_write_cdci_common()
1295 avio_wb16(pb, rescale_mastering_chroma(metadata->display_primaries[0][1])); in mxf_write_cdci_common()
1296 avio_wb16(pb, rescale_mastering_chroma(metadata->display_primaries[1][0])); in mxf_write_cdci_common()
1297 avio_wb16(pb, rescale_mastering_chroma(metadata->display_primaries[1][1])); in mxf_write_cdci_common()
1298 avio_wb16(pb, rescale_mastering_chroma(metadata->display_primaries[2][0])); in mxf_write_cdci_common()
1299 avio_wb16(pb, rescale_mastering_chroma(metadata->display_primaries[2][1])); in mxf_write_cdci_common()
1301 avio_wb16(pb, rescale_mastering_chroma(metadata->white_point[0])); in mxf_write_cdci_common()
1302 avio_wb16(pb, rescale_mastering_chroma(metadata->white_point[1])); in mxf_write_cdci_common()
1308 avio_wb32(pb, rescale_mastering_luma(metadata->max_luminance)); in mxf_write_cdci_common()
1310 avio_wb32(pb, rescale_mastering_luma(metadata->min_luminance)); in mxf_write_cdci_common()
1318 avio_w8(pb, sc->field_dominance); in mxf_write_cdci_common()
1324 mxf_write_refs_count(pb, 1); in mxf_write_cdci_common()
1325 mxf_write_uuid(pb, AVCSubDescriptor, 0); in mxf_write_cdci_common()
1331 static void mxf_update_klv_size(AVIOContext *pb, int64_t pos) in mxf_update_klv_size() argument
1333 int64_t cur_pos = avio_tell(pb); in mxf_update_klv_size()
1335 avio_seek(pb, pos - 4, SEEK_SET); in mxf_update_klv_size()
1336 klv_encode_ber4_length(pb, size); in mxf_update_klv_size()
1337 avio_seek(pb, cur_pos, SEEK_SET); in mxf_update_klv_size()
1342 AVIOContext *pb = s->pb; in mxf_write_avc_subdesc() local
1345 avio_write(pb, mxf_avc_subdescriptor_key, 16); in mxf_write_avc_subdesc()
1346 klv_encode_ber4_length(pb, 0); in mxf_write_avc_subdesc()
1347 pos = avio_tell(pb); in mxf_write_avc_subdesc()
1350 mxf_write_uuid(pb, AVCSubDescriptor, 0); in mxf_write_avc_subdesc()
1353 avio_w8(pb, 0xFF); // AVC Decoding Delay, unknown in mxf_write_avc_subdesc()
1356 avio_w8(pb, st->codecpar->profile); // AVC Profile in mxf_write_avc_subdesc()
1359 avio_w8(pb, st->codecpar->level); // AVC Level in mxf_write_avc_subdesc()
1361 mxf_update_klv_size(s->pb, pos); in mxf_write_avc_subdesc()
1367 mxf_update_klv_size(s->pb, pos); in mxf_write_cdci_desc()
1381 mxf_update_klv_size(s->pb, pos); in mxf_write_h264_desc()
1389 mxf_update_klv_size(s->pb, pos); in mxf_write_s436m_anc_desc()
1394 AVIOContext *pb = s->pb; in mxf_write_mpegvideo_desc() local
1402 avio_wb32(pb, sc->video_bit_rate); in mxf_write_mpegvideo_desc()
1408 avio_w8(pb, profile_and_level); in mxf_write_mpegvideo_desc()
1412 avio_w8(pb, sc->low_delay); in mxf_write_mpegvideo_desc()
1416 avio_w8(pb, sc->seq_closed_gop); in mxf_write_mpegvideo_desc()
1420 avio_wb16(pb, sc->max_gop); in mxf_write_mpegvideo_desc()
1424 avio_wb16(pb, sc->b_picture_count); in mxf_write_mpegvideo_desc()
1427 mxf_update_klv_size(pb, pos); in mxf_write_mpegvideo_desc()
1432 AVIOContext *pb = s->pb; in mxf_write_generic_sound_common() local
1439 avio_wb64(pb, mxf->body_offset / mxf->edit_unit_byte_count); in mxf_write_generic_sound_common()
1444 avio_w8(pb, 1); in mxf_write_generic_sound_common()
1448 avio_wb32(pb, st->codecpar->sample_rate); in mxf_write_generic_sound_common()
1449 avio_wb32(pb, 1); in mxf_write_generic_sound_common()
1453 avio_w8(pb, 0); in mxf_write_generic_sound_common()
1460 avio_wb32(pb, st->codecpar->channels); in mxf_write_generic_sound_common()
1466 avio_wb32(pb, mxf->channel_count); in mxf_write_generic_sound_common()
1468 avio_wb32(pb, st->codecpar->channels); in mxf_write_generic_sound_common()
1472 avio_wb32(pb, av_get_bits_per_sample(st->codecpar->codec_id)); in mxf_write_generic_sound_common()
1479 AVIOContext *pb = s->pb; in mxf_write_wav_common() local
1483 avio_wb16(pb, st->codecpar->block_align); in mxf_write_wav_common()
1487 avio_wb32(pb, st->codecpar->block_align*st->codecpar->sample_rate); in mxf_write_wav_common()
1495 mxf_update_klv_size(s->pb, pos); in mxf_write_wav_desc()
1501 mxf_update_klv_size(s->pb, pos); in mxf_write_aes3_desc()
1507 mxf_update_klv_size(s->pb, pos); in mxf_write_generic_sound_desc()
1515 AVIOContext *pb = s->pb; in mxf_write_tagged_value() local
1522 mxf_write_metadata_key(pb, 0x013f00); in mxf_write_tagged_value()
1523 klv_encode_ber_length(pb, 24 + name_size + indirect_value_size); in mxf_write_tagged_value()
1527 mxf_write_uuid(pb, TaggedValue, mxf->tagged_value_count); in mxf_write_tagged_value()
1534 avio_write(pb, mxf_indirect_value_utf16le, 17); in mxf_write_tagged_value()
1535 avio_put_str16le(pb, value); in mxf_write_tagged_value()
1562 AVIOContext *pb = s->pb; in mxf_write_package() local
1570 mxf_write_metadata_key(pb, 0x013600); in mxf_write_package()
1571 PRINT_KEY(s, "Material Package key", pb->buf_ptr - 16); in mxf_write_package()
1572 …klv_encode_ber_length(pb, 92 + name_size + (16*track_count) + (16*user_comment_count) + 12LL*mxf->… in mxf_write_package()
1574 mxf_write_metadata_key(pb, 0x013700); in mxf_write_package()
1575 PRINT_KEY(s, "Source Package key", pb->buf_ptr - 16); in mxf_write_package()
1576 …klv_encode_ber_length(pb, 112 + name_size + (16*track_count) + 12LL*mxf->store_user_comments); // … in mxf_write_package()
1581 mxf_write_uuid(pb, package->type, package->instance); in mxf_write_package()
1583 PRINT_KEY(s, "package uid", pb->buf_ptr - 16); in mxf_write_package()
1588 PRINT_KEY(s, "package umid second part", pb->buf_ptr - 16); in mxf_write_package()
1596 avio_wb64(pb, mxf->timestamp); in mxf_write_package()
1600 avio_wb64(pb, mxf->timestamp); in mxf_write_package()
1604 mxf_write_refs_count(pb, track_count); in mxf_write_package()
1607 mxf_write_uuid(pb, Track, mxf->track_instance_count + i); in mxf_write_package()
1612 mxf_write_refs_count(pb, user_comment_count); in mxf_write_package()
1614 mxf_write_uuid(pb, TaggedValue, mxf->tagged_value_count - user_comment_count + i); in mxf_write_package()
1621 mxf_write_uuid(pb, MultipleDescriptor, 0); in mxf_write_package()
1624 mxf_write_uuid(pb, SubDescriptor, 0); in mxf_write_package()
1627 mxf_write_uuid(pb, TapeDescriptor, 0); in mxf_write_package()
1661 AVIOContext *pb = s->pb; in mxf_write_essence_container_data() local
1663 mxf_write_metadata_key(pb, 0x012300); in mxf_write_essence_container_data()
1664 klv_encode_ber_length(pb, 72); in mxf_write_essence_container_data()
1667 mxf_write_uuid(pb, EssenceContainerData, 0); in mxf_write_essence_container_data()
1673 avio_wb32(pb, 1); in mxf_write_essence_container_data()
1676 avio_wb32(pb, 2); in mxf_write_essence_container_data()
1742 AVIOContext *pb = s->pb; in mxf_write_index_table_segment() local
1754 avio_write(pb, index_table_segment_key, 16); in mxf_write_index_table_segment()
1756 klv_encode_ber4_length(pb, 0); in mxf_write_index_table_segment()
1757 pos = avio_tell(pb); in mxf_write_index_table_segment()
1761 mxf_write_uuid(pb, IndexTableSegment, 0); in mxf_write_index_table_segment()
1765 avio_wb32(pb, mxf->time_base.den); in mxf_write_index_table_segment()
1766 avio_wb32(pb, mxf->time_base.num); in mxf_write_index_table_segment()
1770 avio_wb64(pb, mxf->last_indexed_edit_unit); in mxf_write_index_table_segment()
1775 avio_wb64(pb, 0); // index table covers whole container in mxf_write_index_table_segment()
1777 avio_wb64(pb, mxf->edit_units_count); in mxf_write_index_table_segment()
1781 avio_wb32(pb, mxf->edit_unit_byte_count); in mxf_write_index_table_segment()
1785 avio_wb32(pb, 2); in mxf_write_index_table_segment()
1789 avio_wb32(pb, 1); in mxf_write_index_table_segment()
1793 avio_w8(pb, !mxf->edit_unit_byte_count); // only one slice for CBR in mxf_write_index_table_segment()
1797 avio_wb32(pb, s->nb_streams+1); // num of entries in mxf_write_index_table_segment()
1798 avio_wb32(pb, 6); // size of one entry in mxf_write_index_table_segment()
1800 avio_w8(pb, 0); in mxf_write_index_table_segment()
1801 avio_w8(pb, 0); // slice entry in mxf_write_index_table_segment()
1802 avio_wb32(pb, 0); // element delta in mxf_write_index_table_segment()
1807 avio_w8(pb, sc->temporal_reordering); in mxf_write_index_table_segment()
1811 avio_w8(pb, 0); // slice number in mxf_write_index_table_segment()
1812 avio_wb32(pb, sc->slice_offset); in mxf_write_index_table_segment()
1814 avio_w8(pb, 0); // slice number in mxf_write_index_table_segment()
1815 avio_wb32(pb, KAG_SIZE); // system item size including klv fill in mxf_write_index_table_segment()
1821 avio_w8(pb, 1); in mxf_write_index_table_segment()
1822 avio_wb32(pb, (i-1)*audio_frame_size); // element delta in mxf_write_index_table_segment()
1829 avio_wb32(pb, mxf->edit_units_count); // num of entries in mxf_write_index_table_segment()
1830 avio_wb32(pb, 15); // size of one entry in mxf_write_index_table_segment()
1853 avio_w8(pb, temporal_offset); in mxf_write_index_table_segment()
1857 avio_w8(pb, mxf->last_key_index - i); in mxf_write_index_table_segment()
1859 avio_w8(pb, key_index - i); // key frame offset in mxf_write_index_table_segment()
1868 avio_w8(pb, mxf->index_entries[i].flags); in mxf_write_index_table_segment()
1870 avio_wb64(pb, mxf->index_entries[i].offset); in mxf_write_index_table_segment()
1872 avio_wb32(pb, mxf->index_entries[i].slice_offset); in mxf_write_index_table_segment()
1874 avio_wb32(pb, 0); in mxf_write_index_table_segment()
1882 mxf_update_klv_size(pb, pos); in mxf_write_index_table_segment()
1887 unsigned pad = klv_fill_size(avio_tell(s->pb)); in mxf_write_klv_fill()
1889 avio_write(s->pb, klv_fill_key, 16); in mxf_write_klv_fill()
1891 klv_encode_ber4_length(s->pb, pad); in mxf_write_klv_fill()
1892 ffio_fill(s->pb, 0, pad); in mxf_write_klv_fill()
1893 av_assert1(!(avio_tell(s->pb) & (KAG_SIZE-1))); in mxf_write_klv_fill()
1902 AVIOContext *pb = s->pb; in mxf_write_partition() local
1905 uint64_t partition_offset = avio_tell(pb); in mxf_write_partition()
1930 avio_write(pb, key, 16); in mxf_write_partition()
1932 avio_write(pb, body_partition_key, 16); in mxf_write_partition()
1934 klv_encode_ber4_length(pb, 88 + 16LL * DESCRIPTOR_COUNT(mxf->essence_container_count)); in mxf_write_partition()
1937 avio_wb16(pb, 1); // majorVersion in mxf_write_partition()
1938 avio_wb16(pb, 3); // minorVersion in mxf_write_partition()
1939 avio_wb32(pb, KAG_SIZE); // KAGSize in mxf_write_partition()
1941 avio_wb64(pb, partition_offset); // ThisPartition in mxf_write_partition()
1944 … avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition in mxf_write_partition()
1946 … avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition in mxf_write_partition()
1948 avio_wb64(pb, 0); in mxf_write_partition()
1950 avio_wb64(pb, mxf->footer_partition_offset); // footerPartition in mxf_write_partition()
1953 header_byte_count_offset = avio_tell(pb); in mxf_write_partition()
1954 avio_wb64(pb, 0); // headerByteCount, update later in mxf_write_partition()
1957 avio_wb64(pb, index_byte_count); // indexByteCount in mxf_write_partition()
1958 avio_wb32(pb, index_byte_count ? indexsid : 0); // indexSID in mxf_write_partition()
1962 avio_wb64(pb, mxf->body_offset); in mxf_write_partition()
1964 avio_wb64(pb, 0); in mxf_write_partition()
1966 avio_wb32(pb, bodysid); // bodySID in mxf_write_partition()
1970 avio_write(pb, opatom_ul, 16); in mxf_write_partition()
1972 avio_write(pb, op1a_ul, 16); in mxf_write_partition()
1983 start = avio_tell(s->pb); in mxf_write_partition()
1987 pos = avio_tell(s->pb); in mxf_write_partition()
1991 avio_seek(pb, header_byte_count_offset, SEEK_SET); in mxf_write_partition()
1992 avio_wb64(pb, header_byte_count); in mxf_write_partition()
1993 avio_seek(pb, pos, SEEK_SET); in mxf_write_partition()
1997 avio_write_marker(pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); in mxf_write_partition()
2733 AVIOContext *pb = s->pb; in mxf_write_system_item() local
2741 avio_write(pb, system_metadata_pack_key, 16); in mxf_write_system_item()
2742 klv_encode_ber4_length(pb, 57); in mxf_write_system_item()
2750 avio_w8(pb, system_item_bitmap); in mxf_write_system_item()
2751 avio_w8(pb, mxf->content_package_rate); // content package rate in mxf_write_system_item()
2752 avio_w8(pb, 0x00); // content package type in mxf_write_system_item()
2753 avio_wb16(pb, 0x00); // channel handle in mxf_write_system_item()
2754 avio_wb16(pb, frame & 0xFFFF); // continuity count, supposed to overflow in mxf_write_system_item()
2756 avio_write(pb, multiple_desc_ul, 16); in mxf_write_system_item()
2759 avio_write(pb, *sc->container_ul, 16); in mxf_write_system_item()
2761 avio_w8(pb, 0); in mxf_write_system_item()
2762 avio_wb64(pb, 0); in mxf_write_system_item()
2763 avio_wb64(pb, 0); // creation date/time stamp in mxf_write_system_item()
2765 avio_w8(pb, 0x81); // SMPTE 12M time code in mxf_write_system_item()
2767 avio_wb32(pb, time_code); in mxf_write_system_item()
2768 avio_wb32(pb, 0); // binary group data in mxf_write_system_item()
2769 avio_wb64(pb, 0); in mxf_write_system_item()
2772 avio_write(pb, system_metadata_package_set_key, 16); in mxf_write_system_item()
2773 klv_encode_ber4_length(pb, 35); in mxf_write_system_item()
2774 avio_w8(pb, 0x83); // UMID in mxf_write_system_item()
2775 avio_wb16(pb, 0x20); in mxf_write_system_item()
2782 AVIOContext *pb = s->pb; in mxf_write_d10_audio_packet() local
2788 klv_encode_ber4_length(pb, 4 + frame_size*4*8); in mxf_write_d10_audio_packet()
2790 avio_w8(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1)); in mxf_write_d10_audio_packet()
2791 avio_wl16(pb, frame_size); in mxf_write_d10_audio_packet()
2792 avio_w8(pb, (1<<st->codecpar->channels)-1); in mxf_write_d10_audio_packet()
2804 avio_wl32(pb, sample | i); in mxf_write_d10_audio_packet()
2807 avio_wl32(pb, i); in mxf_write_d10_audio_packet()
2814 AVIOContext *pb = s->pb; in mxf_write_opatom_body_partition() local
2827 avio_write(pb, sc->track_essence_element_key, 16); in mxf_write_opatom_body_partition()
2828 klv_encode_ber9_length(pb, mxf->body_offset); in mxf_write_opatom_body_partition()
2835 AVIOContext *pb = s->pb; in mxf_write_opatom_packet() local
2855 avio_write(pb, pkt->data, pkt->size); in mxf_write_opatom_packet()
2885 AVIOContext *pb = s->pb; in mxf_write_packet() local
2991 avio_write(pb, sc->track_essence_element_key, 16); // write key in mxf_write_packet()
2996 klv_encode_ber4_length(pb, pkt->size); // write length in mxf_write_packet()
2997 avio_write(pb, pkt->data, pkt->size); in mxf_write_packet()
3007 AVIOContext *pb = s->pb; in mxf_write_random_index_pack() local
3008 uint64_t pos = avio_tell(pb); in mxf_write_random_index_pack()
3011 avio_write(pb, ff_mxf_random_index_pack_key, 16); in mxf_write_random_index_pack()
3012 klv_encode_ber_length(pb, 28 + 12LL*mxf->body_partitions_count); in mxf_write_random_index_pack()
3015 avio_wb32(pb, 1); // BodySID of header partition in mxf_write_random_index_pack()
3017 avio_wb32(pb, 0); in mxf_write_random_index_pack()
3018 avio_wb64(pb, 0); // offset of header partition in mxf_write_random_index_pack()
3021 avio_wb32(pb, 1); // BodySID in mxf_write_random_index_pack()
3022 avio_wb64(pb, mxf->body_partition_offset[i]); in mxf_write_random_index_pack()
3025 avio_wb32(pb, 0); // BodySID of footer partition in mxf_write_random_index_pack()
3026 avio_wb64(pb, mxf->footer_partition_offset); in mxf_write_random_index_pack()
3028 avio_wb32(pb, avio_tell(pb) - pos + 4); in mxf_write_random_index_pack()
3034 AVIOContext *pb = s->pb; in mxf_write_footer() local
3046 mxf->footer_partition_offset = avio_tell(pb); in mxf_write_footer()
3060 if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { in mxf_write_footer()
3063 avio_seek(pb, mxf->body_partition_offset[0], SEEK_SET); in mxf_write_footer()
3068 avio_seek(pb, 0, SEEK_SET); in mxf_write_footer()
3080 avio_seek(pb, mxf->body_partition_offset[i]+44, SEEK_SET); in mxf_write_footer()
3081 avio_wb64(pb, mxf->footer_partition_offset); in mxf_write_footer()