These are written when the next packet is written. This allows for similarity to custom segmentation/flushing as for the ismv muxer, where flush can be used to output the buffered data and write a fragment. On the other hand, flush isn't really the right semantics for this particular operation, so the AVOption approach might be more right. --- libavformat/mpegtsenc.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 8232cbc..cf1bb3b 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -928,7 +928,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, avio_flush(s->pb); } -static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) +static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) { AVStream *st = s->streams[pkt->stream_index]; int size = pkt->size; @@ -1046,6 +1046,17 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) +{ + MpegTSWrite *ts = s->priv_data; + if (!pkt) { + ts->pat_packet_count = ts->pat_packet_period - 1; + ts->sdt_packet_count = ts->sdt_packet_period - 1; + return 1; + } + return mpegts_write_packet_internal(s, pkt); +} + static int mpegts_write_end(AVFormatContext *s) { MpegTSWrite *ts = s->priv_data; @@ -1091,4 +1102,5 @@ AVOutputFormat ff_mpegts_muxer = { .write_packet = mpegts_write_packet, .write_trailer = mpegts_write_end, .priv_class = &mpegts_muxer_class, + .flags = AVFMT_ALLOW_FLUSH, }; -- 1.7.3.1 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel