From d342a1befa88cb3f23c7e3fccfd1edaeea968fed Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 22 May 2014 14:57:56 +0100 Subject: Add ContentTimePeriod class. --- src/lib/ffmpeg_decoder.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 9548eaae9..eec70501a 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -535,7 +535,7 @@ FFmpegDecoder::decode_subtitle_packet () indicate that the previous subtitle should stop. */ if (sub.num_rects <= 0) { - image_subtitle (ContentTime (), ContentTime (), shared_ptr (), dcpomatic::Rect ()); + image_subtitle (ContentTimePeriod (), shared_ptr (), dcpomatic::Rect ()); return; } else if (sub.num_rects > 1) { throw DecodeError (_("multi-part subtitles not yet supported")); @@ -545,10 +545,11 @@ FFmpegDecoder::decode_subtitle_packet () source that we may have chopped off for the DCP) */ ContentTime packet_time = ContentTime::from_seconds (static_cast (sub.pts) / AV_TIME_BASE) + _pts_offset; - - /* hence start time for this sub */ - ContentTime const from = packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3); - ContentTime const to = packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3); + + ContentTimePeriod period ( + packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3), + packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3) + ); AVSubtitleRect const * rect = sub.rects[0]; @@ -586,8 +587,7 @@ FFmpegDecoder::decode_subtitle_packet () dcp::Size const vs = _ffmpeg_content->video_size (); image_subtitle ( - from, - to, + period, image, dcpomatic::Rect ( static_cast (rect->x) / vs.width, -- cgit v1.2.3