aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2019-11-10 23:34:17 +0100
committerMarton Balint <cus@passwd.hu>2019-12-03 11:00:11 +0100
commit1e0ea369456b93dcf6d2ecc2bce45e1b33c2baca (patch)
treeedb78973e866e5cf2b66f535dbd87934fcc22cb8
parent998906a0a40872a43bf7c601b4269f8cb0145424 (diff)
downloadffmpeg-1e0ea369456b93dcf6d2ecc2bce45e1b33c2baca.tar.gz
avformat/mpegtsenc: add padding to m2ts streams
6144 byte alignment is needed. Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--libavformat/mpegtsenc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 98e91ebf89..e8dd8b7d56 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1774,6 +1774,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
static void mpegts_write_flush(AVFormatContext *s)
{
+ MpegTSWrite *ts = s->priv_data;
int i;
/* flush current packets */
@@ -1788,6 +1789,12 @@ static void mpegts_write_flush(AVFormatContext *s)
ts_st->opus_queued_samples = 0;
}
}
+
+ if (ts->m2ts_mode) {
+ int packets = (avio_tell(s->pb) / (TS_PACKET_SIZE + 4)) % 32;
+ while (packets++ < 32)
+ mpegts_insert_null_packet(s);
+ }
}
static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)