Mercurial > libavformat.hg
comparison gxfenc.c @ 4674:c727d4a90177 libavformat
factorize write packet
author | bcoudurier |
---|---|
date | Sun, 08 Mar 2009 22:14:26 +0000 |
parents | c8161db9d863 |
children | f036a151abf8 |
comparison
equal
deleted
inserted
replaced
4673:c8161db9d863 | 4674:c727d4a90177 |
---|---|
760 put_byte(pb, 1); /* flags */ | 760 put_byte(pb, 1); /* flags */ |
761 put_byte(pb, 0); /* reserved */ | 761 put_byte(pb, 0); /* reserved */ |
762 return 16; | 762 return 16; |
763 } | 763 } |
764 | 764 |
765 static int gxf_write_media_packet(AVFormatContext *s, AVPacket *pkt) | 765 static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) |
766 { | 766 { |
767 GXFContext *gxf = s->priv_data; | 767 GXFContext *gxf = s->priv_data; |
768 ByteIOContext *pb = s->pb; | 768 ByteIOContext *pb = s->pb; |
769 AVStream *st = s->streams[pkt->stream_index]; | 769 AVStream *st = s->streams[pkt->stream_index]; |
770 int64_t pos = url_ftell(pb); | 770 int64_t pos = url_ftell(pb); |
780 gxf_write_padding(pb, padding); | 780 gxf_write_padding(pb, padding); |
781 | 781 |
782 if (st->codec->codec_type == CODEC_TYPE_VIDEO) | 782 if (st->codec->codec_type == CODEC_TYPE_VIDEO) |
783 gxf->nb_fields += 2; // count fields | 783 gxf->nb_fields += 2; // count fields |
784 | 784 |
785 put_flush_packet(pb); | |
786 | |
785 return updatePacketSize(pb, pos); | 787 return updatePacketSize(pb, pos); |
786 } | |
787 | |
788 static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) | |
789 { | |
790 gxf_write_media_packet(s, pkt); | |
791 put_flush_packet(s->pb); | |
792 return 0; | |
793 } | 788 } |
794 | 789 |
795 static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush) | 790 static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush) |
796 { | 791 { |
797 return ff_audio_rechunk_interleave(s, out, pkt, flush, | 792 return ff_audio_rechunk_interleave(s, out, pkt, flush, |