-static int mxf_write_d10_packet(AVFormatContext *s, AVPacket *pkt)
-{
- MXFContext *mxf = s->priv_data;
- ByteIOContext *pb = s->pb;
- AVStream *st = s->streams[pkt->stream_index];
- MXFStreamContext *sc = st->priv_data;
- int flags = 0;
-
- if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
- if (!mxf_parse_mpeg2_frame(s, st, pkt, &flags)) {
- av_log(s, AV_LOG_ERROR, "could not get mpeg2 profile and level\n");
- return -1;
- }
- }
-
- if (!mxf->header_written) {
- mxf_write_partition(s, 1, 2, header_open_partition_key, 1);
- mxf->header_written = 1;
- mxf_write_klv_fill(s);
- mxf_write_index_table_segment(s);
- }
-
- if (st->index == 0) {
- mxf_write_klv_fill(s);
- mxf_write_system_item(s);
-
- mxf->edit_units_count++;
- }
-
- mxf_write_klv_fill(s);
- put_buffer(pb, sc->track_essence_element_key, 16); // write key
- if (st->codec->codec_type == CODEC_TYPE_VIDEO)
- mxf_write_d10_video_packet(s, st, pkt);
- else
- mxf_write_d10_audio_packet(s, st, pkt);
-
- put_flush_packet(pb);
-
- return 0;
-}
-