X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fvideo_decoder.cc;h=146120fe1adda6c930e04cd44968fed493bc4a1a;hb=c98c87afe29d9ef74bdced8a9c96d7752f3fe80f;hp=bd609d1683ddd0fca0ee82ca9da8bd7eeaed725b;hpb=bbbfb3208e74a4de2f9b4540a17ec43d4e3541a3;p=dcpomatic.git diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index bd609d168..146120fe1 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -39,19 +39,21 @@ VideoDecoder::VideoDecoder (shared_ptr c) } -optional +list VideoDecoder::decoded_video (VideoFrame frame) { + list output; + for (list::const_iterator i = _decoded_video.begin(); i != _decoded_video.end(); ++i) { if (i->frame == frame) { - return *i; + output.push_back (*i); } } - return optional (); + return output; } -optional +list VideoDecoder::get_video (VideoFrame frame, bool accurate) { if (_decoded_video.empty() || (frame < _decoded_video.front().frame || frame > (_decoded_video.back().frame + 1))) { @@ -59,7 +61,7 @@ VideoDecoder::get_video (VideoFrame frame, bool accurate) seek (ContentTime::from_frames (frame, _video_content->video_frame_rate()), accurate); } - optional dec; + list dec; /* Now enough pass() calls should either: * (a) give us what we want, or @@ -70,7 +72,7 @@ VideoDecoder::get_video (VideoFrame frame, bool accurate) * This could all be one statement but it's split up for clarity. */ while (true) { - if (decoded_video (frame)) { + if (!decoded_video(frame).empty ()) { /* We got what we want */ break; } @@ -94,7 +96,7 @@ VideoDecoder::get_video (VideoFrame frame, bool accurate) /* Any frame will do: use the first one that comes out of pass() */ while (_decoded_video.empty() && !pass ()) {} if (!_decoded_video.empty ()) { - dec = _decoded_video.front (); + dec.push_back (_decoded_video.front ()); } }