diff options
author | Martin Storsjö <martin@martin.st> | 2012-01-20 19:27:33 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-01-25 12:15:41 +0200 |
commit | f1caf01d5e2913a96c5689e6570fd10e25d1c76b (patch) | |
tree | 9986608a2cb38c20f5cfee5847dfae8aab652a31 /libavformat/utils.c | |
parent | 83988d58ed134f82b6d2a25ef0065edfaf50ccb0 (diff) | |
download | ffmpeg-f1caf01d5e2913a96c5689e6570fd10e25d1c76b.tar.gz |
libavformat: Add a flag for muxers that support write_packet(NULL) for flushing
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 22ee13b51f..093389b386 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3135,7 +3135,15 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){ int av_write_frame(AVFormatContext *s, AVPacket *pkt) { - int ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt); + int ret; + + if (!pkt) { + if (s->oformat->flags & AVFMT_ALLOW_FLUSH) + return s->oformat->write_packet(s, pkt); + return 1; + } + + ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt); if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) return ret; |