diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2016-02-29 09:42:54 -0500 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2016-03-11 11:19:10 -0500 |
commit | 6d8ab358a3c2a8fbdd6ae7f144893b7c88c30557 (patch) | |
tree | 23f828365cc3743026aa12a2b9212621608f58f8 /libavformat/mux.c | |
parent | 867637caeab58bb9627a4a49637d37cbe885368b (diff) | |
download | ffmpeg-6d8ab358a3c2a8fbdd6ae7f144893b7c88c30557.tar.gz |
lavf: allow BSFs to drop packets.
If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter()
returns, the packet is considered dropped.
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r-- | libavformat/mux.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c index eb0b9739c2..9ca5df4095 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1025,6 +1025,19 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) if (pkt) { AVStream *st = s->streams[pkt->stream_index]; + if (s->oformat->check_bitstream) { + if (!st->internal->bitstream_checked) { + if ((ret = s->oformat->check_bitstream(s, pkt)) < 0) + goto fail; + else if (ret == 1) + st->internal->bitstream_checked = 1; + } + } + + av_apply_bitstream_filters(st->codec, pkt, st->internal->bsfc); + if (pkt->size == 0 && pkt->side_data_elems == 0) + return 0; + if (s->debug & FF_FDEBUG_TS) av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%s pts:%s\n", pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts)); @@ -1038,17 +1051,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) ret = AVERROR(EINVAL); goto fail; } - - if (s->oformat->check_bitstream) { - if (!st->internal->bitstream_checked) { - if ((ret = s->oformat->check_bitstream(s, pkt)) < 0) - goto fail; - else if (ret == 1) - st->internal->bitstream_checked = 1; - } - } - - av_apply_bitstream_filters(st->codec, pkt, st->internal->bsfc); } else { av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame FLUSH\n"); flush = 1; |