From e193babcec6a26bc1ee83d99d009bd5a3751a5bc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 4 Nov 2012 02:12:12 +0000 Subject: Untested trim of start and end. --- src/lib/decoder.cc | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/lib/decoder.cc') diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 32d0bab64..6da45a788 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -142,27 +142,13 @@ Decoder::go () while (pass () == false) { if (_job && _film->dcp_length()) { - _job->set_progress (float (_video_frame_index) / _film->dcp_length().get()); + _job->set_progress (float ((_video_frame_index - _film->dcp_trim_start())) / _film->dcp_length().get()); } } process_end (); } -/** Run one pass. This may or may not generate any actual video / audio data; - * some decoders may require several passes to generate a single frame. - * @return true if we have finished processing all data; otherwise false. - */ -bool -Decoder::pass () -{ - if (!_ignore_length && _video_frame_index >= _film->dcp_length()) { - return true; - } - - return do_pass (); -} - /** Called by subclasses to tell the world that some audio data is ready * @param data Audio data, in Film::audio_sample_format. * @param size Number of bytes of data. @@ -265,6 +251,8 @@ Decoder::emit_audio (uint8_t* data, int size) void Decoder::process_video (AVFrame* frame) { + assert (_film->length()); + if (_minimal) { ++_video_frame_index; return; @@ -282,6 +270,11 @@ Decoder::process_video (AVFrame* frame) return; } + if (_film->dcp_trim_start() > _video_frame_index || (_film->length().get() - _film->dcp_trim_end()) < _video_frame_index) { + ++_video_frame_index; + return; + } + shared_ptr graph; list >::iterator i = _filter_graphs.begin(); -- cgit v1.2.3