comparison mxfenc.c @ 3778:85d3aca03313 libavformat

Import more MXF muxer code from the SoC tree
author vitor
date Mon, 25 Aug 2008 20:28:12 +0000
parents fde28855a81e
children 261cd3e672e5
comparison
equal deleted inserted replaced
3777:d4b086282604 3778:85d3aca03313
466 // write duration 466 // write duration
467 mxf_write_local_tag(pb, 8, 0x0202); 467 mxf_write_local_tag(pb, 8, 0x0202);
468 put_be64(pb, st->duration); 468 put_be64(pb, st->duration);
469 } 469 }
470 470
471 static int mux_write_packet(AVFormatContext *s, AVPacket *pkt)
472 {
473 ByteIOContext *pb = s->pb;
474 AVStream *st = s->streams[pkt->stream_index];
475 MXFStreamContext *sc = st->priv_data;
476
477 put_buffer(pb, sc->track_essence_element_key, 16); // write key
478 klv_encode_ber_length(pb, pkt->size); // write length
479 put_buffer(pb, pkt->data, pkt->size); // write value
480
481 put_flush_packet(pb);
482 return 0;
483 }
484
485 static void mxf_write_sequence(AVFormatContext *s, int stream_index, enum MXFMetadataSetType type) 471 static void mxf_write_sequence(AVFormatContext *s, int stream_index, enum MXFMetadataSetType type)
486 { 472 {
487 ByteIOContext *pb = s->pb; 473 ByteIOContext *pb = s->pb;
488 AVStream *st; 474 AVStream *st;
489 475
771 fail: 757 fail:
772 mxf_free(s); 758 mxf_free(s);
773 return -1; 759 return -1;
774 } 760 }
775 761
762 static int mux_write_packet(AVFormatContext *s, AVPacket *pkt)
763 {
764 ByteIOContext *pb = s->pb;
765 AVStream *st = s->streams[pkt->stream_index];
766 MXFStreamContext *sc = st->priv_data;
767
768 put_buffer(pb, sc->track_essence_element_key, 16); // write key
769 klv_encode_ber_length(pb, pkt->size); // write length
770 put_buffer(pb, pkt->data, pkt->size); // write value
771
772 put_flush_packet(pb);
773 return 0;
774 }
775
776 static void mxf_update_header_partition(AVFormatContext *s, int64_t footer_partition_offset) 776 static void mxf_update_header_partition(AVFormatContext *s, int64_t footer_partition_offset)
777 { 777 {
778 MXFContext *mxf = s->priv_data; 778 MXFContext *mxf = s->priv_data;
779 ByteIOContext *pb = s->pb; 779 ByteIOContext *pb = s->pb;
780 780