-
- /* Use Film::length here as our one may be wrong */
-
- int gap = 0;
- if (_opt->decode_video_frequency != 0) {
- gap = _film->length().get() / _opt->decode_video_frequency;
- }
-
- if (_opt->decode_video_frequency != 0 && gap != 0 && (_video_frame_index % gap) != 0) {
- ++_video_frame_index;
- 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<FilterGraph> graph;
-
- list<shared_ptr<FilterGraph> >::iterator i = _filter_graphs.begin();
- while (i != _filter_graphs.end() && !(*i)->can_process (Size (frame->width, frame->height), (AVPixelFormat) frame->format)) {
- ++i;
- }
-
- if (i == _filter_graphs.end ()) {
- graph.reset (new FilterGraph (_film, this, _opt->apply_crop, Size (frame->width, frame->height), (AVPixelFormat) frame->format));
- _filter_graphs.push_back (graph);
- _film->log()->log (String::compose ("New graph for %1x%2, pixel format %3", frame->width, frame->height, frame->format));
- } else {
- graph = *i;
- }
-
- list<shared_ptr<Image> > images = graph->process (frame);
-
- for (list<shared_ptr<Image> >::iterator i = images.begin(); i != images.end(); ++i) {
- shared_ptr<Subtitle> sub;
- if (_timed_subtitle && _timed_subtitle->displayed_at (double (video_frame_index()) / _film->frames_per_second())) {
- sub = _timed_subtitle->subtitle ();
- }
-
- TIMING ("Decoder emits %1", _video_frame_index);
- Video (*i, _video_frame_index, sub);
- ++_video_frame_index;
- _last_image = *i;
- _last_subtitle = sub;
- }
-}
-
-void
-Decoder::repeat_last_video ()
-{
- if (!_last_image) {
- _last_image.reset (new CompactImage (pixel_format(), native_size()));
- _last_image->make_black ();
- }
-
- Video (_last_image, _video_frame_index, _last_subtitle);
- ++_video_frame_index;