diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-18 16:18:10 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-18 16:18:10 +0000 |
| commit | 880719c0bf2f2ce99ca44a5f5289fdd30962246a (patch) | |
| tree | cd83af4cc1e7c6e8abdcc678ef217f25def2a400 /src | |
| parent | 3b03f47d632d2a1da25aab689a59ad5701e7d63c (diff) | |
Fix being tested.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 2 | ||||
| -rw-r--r-- | src/lib/subtitle.cc | 9 | ||||
| -rw-r--r-- | src/lib/subtitle.h | 2 | ||||
| -rw-r--r-- | src/lib/video_decoder.cc | 4 |
4 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index a05b331cc..f81f00b19 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -334,7 +334,7 @@ FFmpegDecoder::pass () if (sub.num_rects > 0) { shared_ptr<TimedSubtitle> ts; try { - emit_subtitle (shared_ptr<TimedSubtitle> (new TimedSubtitle (sub, _first_video.get()))); + emit_subtitle (shared_ptr<TimedSubtitle> (new TimedSubtitle (sub))); } catch (...) { /* some problem with the subtitle; we probably didn't understand it */ } diff --git a/src/lib/subtitle.cc b/src/lib/subtitle.cc index 4b7f81947..1af277255 100644 --- a/src/lib/subtitle.cc +++ b/src/lib/subtitle.cc @@ -31,14 +31,15 @@ using namespace boost; /** Construct a TimedSubtitle. This is a subtitle image, position, * and a range of time over which it should be shown. * @param sub AVSubtitle to read. - * @param c Fractional seconds that should be subtracted from the AVSubtitle's PTS. */ -TimedSubtitle::TimedSubtitle (AVSubtitle const & sub, double c) +TimedSubtitle::TimedSubtitle (AVSubtitle const & sub) { assert (sub.rects > 0); - /* subtitle PTS in seconds */ - double const packet_time = ((sub.pts / AV_TIME_BASE) + float (sub.pts % AV_TIME_BASE) / 1e6) - c; + /* Subtitle PTS in seconds (within the source, not taking into account any of the + source that we may have chopped off for the DCP) + */ + double const packet_time = ((sub.pts / AV_TIME_BASE) + float (sub.pts % AV_TIME_BASE) / 1e6); /* hence start time for this sub */ _from = packet_time + (double (sub.start_display_time) / 1e3); diff --git a/src/lib/subtitle.h b/src/lib/subtitle.h index 590e0dd31..38ba4e70e 100644 --- a/src/lib/subtitle.h +++ b/src/lib/subtitle.h @@ -63,7 +63,7 @@ subtitle_transformed_area ( class TimedSubtitle { public: - TimedSubtitle (AVSubtitle const &, double c); + TimedSubtitle (AVSubtitle const &); bool displayed_at (double t) const; diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 4c05d5fcd..f4501bbf3 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -38,13 +38,15 @@ VideoDecoder::VideoDecoder (shared_ptr<Film> f, shared_ptr<const DecodeOptions> /** Called by subclasses to tell the world that some video data is ready. * We find a subtitle then emit it for listeners. - * @param frame to emit. + * @param image frame to emit. + * @param f Frame within the source. */ void VideoDecoder::emit_video (shared_ptr<Image> image, SourceFrame f) { shared_ptr<Subtitle> sub; if (_timed_subtitle && _timed_subtitle->displayed_at (f / _film->frames_per_second())) { + _film->log()->log (String::compose ("putting subtitle using %1 instead of %2", f, video_frame())); sub = _timed_subtitle->subtitle (); } |
