summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-08-26 08:43:11 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-08-26 08:43:11 +0000
commit8b03c014f051e18dc103cf89a224ee983775815a (patch)
tree0e2133bb7cd2eeb682645eb15bdefe78ed673409 /ffmpeg.c
parent44ed34b79097b972095e7c9efae32a13b4bc51dc (diff)
Make sure that start_display_time is 0 by moving its value onto pts.
If it was not 0, subtitle encoding would fail. Originally committed as revision 19710 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 2686e1d09c..9e41bbc786 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -826,6 +826,10 @@ static void do_subtitle_out(AVFormatContext *s,
for(i = 0; i < nb; i++) {
sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);
+ // start_display_time is required to be 0
+ sub->pts += av_rescale_q(sub->start_display_time, (AVRational){1, 1000}, AV_TIME_BASE_Q);
+ sub->end_display_time -= sub->start_display_time;
+ sub->start_display_time = 0;
subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out,
subtitle_out_max_size, sub);
if (subtitle_out_size < 0) {
@@ -837,7 +841,7 @@ static void do_subtitle_out(AVFormatContext *s,
pkt.stream_index = ost->index;
pkt.data = subtitle_out;
pkt.size = subtitle_out_size;
- pkt.pts = av_rescale_q(pts, ist->st->time_base, ost->st->time_base);
+ pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {
/* XXX: the pts correction is handled here. Maybe handling
it in the codec would be better */