summaryrefslogtreecommitdiff
path: root/src/lib/video_decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/video_decoder.cc')
-rw-r--r--src/lib/video_decoder.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc
index 23a69f958..e723610b3 100644
--- a/src/lib/video_decoder.cc
+++ b/src/lib/video_decoder.cc
@@ -28,33 +28,36 @@
using boost::shared_ptr;
using boost::optional;
-VideoDecoder::VideoDecoder (shared_ptr<Film> f, shared_ptr<const Options> o, Job* j)
+VideoDecoder::VideoDecoder (shared_ptr<Film> f, shared_ptr<const DecodeOptions> o, Job* j)
: Decoder (f, o, j)
, _video_frame (0)
+ , _last_source_time (0)
{
}
/** 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 decode; caller manages memory.
+ * @param image frame to emit.
+ * @param t Time of the frame within the source, in seconds.
*/
void
-VideoDecoder::emit_video (shared_ptr<Image> image)
+VideoDecoder::emit_video (shared_ptr<Image> image, double t)
{
shared_ptr<Subtitle> sub;
- if (_timed_subtitle && _timed_subtitle->displayed_at (double (video_frame()) / _film->frames_per_second())) {
+ if (_timed_subtitle && _timed_subtitle->displayed_at (t)) {
sub = _timed_subtitle->subtitle ();
}
signal_video (image, sub);
+ _last_source_time = t;
}
void
VideoDecoder::repeat_last_video ()
{
if (!_last_image) {
- _last_image.reset (new CompactImage (pixel_format(), native_size()));
+ _last_image.reset (new SimpleImage (pixel_format(), native_size(), false));
_last_image->make_black ();
}
@@ -77,7 +80,7 @@ VideoDecoder::emit_subtitle (shared_ptr<TimedSubtitle> s)
{
_timed_subtitle = s;
- if (_timed_subtitle && _opt->apply_crop) {
+ if (_timed_subtitle) {
Position const p = _timed_subtitle->subtitle()->position ();
_timed_subtitle->subtitle()->set_position (Position (p.x - _film->crop().left, p.y - _film->crop().top));
}
@@ -92,7 +95,7 @@ VideoDecoder::set_subtitle_stream (shared_ptr<SubtitleStream> s)
void
VideoDecoder::set_progress () const
{
- if (_job && _film->dcp_length()) {
+ if (_job && _film->length()) {
_job->set_progress (float (_video_frame) / _film->length().get());
}
}