aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-01-15 01:47:24 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-01-15 01:47:24 +0000
commitf3ba7c54687082a82aab3183a86fd4e7bf187671 (patch)
treedd146d8155816957cb82aa54e81589262089f644
parenta57fb91ce509b3350203366cde844bc30191db36 (diff)
downloadffmpeg-f3ba7c54687082a82aab3183a86fd4e7bf187671.tar.gz
use delay for subs and dirac too
Originally committed as revision 16614 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/mpegtsenc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 1b190fd2ff..acadc28bac 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -696,16 +696,22 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
int len, max_payload_size;
const uint8_t *access_unit_index = NULL;
const uint64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
+ int64_t dts = AV_NOPTS_VALUE, pts = AV_NOPTS_VALUE;
+
+ if (pkt->pts != AV_NOPTS_VALUE)
+ pts = pkt->pts + delay;
+ if (pkt->dts != AV_NOPTS_VALUE)
+ dts = pkt->dts + delay;
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) {
/* for subtitle, a single PES packet must be generated */
- mpegts_write_pes(s, st, buf, size, pkt->pts, AV_NOPTS_VALUE);
+ mpegts_write_pes(s, st, buf, size, pts, AV_NOPTS_VALUE);
return 0;
}
if (st->codec->codec_id == CODEC_ID_DIRAC) {
/* for Dirac, a single PES packet must be generated */
- mpegts_write_pes(s, st, buf, size, pkt->pts, pkt->dts);
+ mpegts_write_pes(s, st, buf, size, pts, dts);
return 0;
}
max_payload_size = DEFAULT_PES_PAYLOAD_SIZE;
@@ -758,8 +764,8 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
if (access_unit_index && access_unit_index < buf &&
ts_st->payload_pts == AV_NOPTS_VALUE &&
ts_st->payload_dts == AV_NOPTS_VALUE) {
- ts_st->payload_dts = pkt->dts + delay;
- ts_st->payload_pts = pkt->pts + delay;
+ ts_st->payload_dts = dts;
+ ts_st->payload_pts = pts;
}
if (ts_st->payload_index >= max_payload_size) {
mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,