using std::max;
using std::cout;
using std::list;
+using std::make_pair;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::weak_ptr;
_film = f;
_frame.reset ();
+ _queue.clear ();
if (!_film) {
return;
_player = f->player ();
_player->disable_audio ();
- _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _2, _3));
+ _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _3));
_player->Changed.connect (boost::bind (&FilmViewer::player_changed, this));
calculate_sizes ();
}
void
-FilmViewer::process_video (shared_ptr<const Image> image, bool, Time t)
+FilmViewer::process_video (shared_ptr<const Image> image, Time t)
{
+ if (_got_frame) {
+ /* This is an additional frame emitted by a single pass. Store it. */
+ _queue.push_front (make_pair (image, t));
+ return;
+ }
+
_frame = image;
-
_got_frame = true;
double const fps = _film->dcp_video_frame_rate ();
return;
}
- try {
- _got_frame = false;
- while (!_got_frame && !_player->pass ()) {}
- } catch (DecodeError& e) {
- _play_button->SetValue (false);
- check_play_state ();
- error_dialog (this, wxString::Format (_("Could not decode video for view (%s)"), std_to_wx(e.what()).data()));
+ _got_frame = false;
+
+ if (!_queue.empty ()) {
+ process_video (_queue.back().first, _queue.back().second);
+ _queue.pop_back ();
+ } else {
+ try {
+ while (!_got_frame && !_player->pass ()) {}
+ } catch (DecodeError& e) {
+ _play_button->SetValue (false);
+ check_play_state ();
+ error_dialog (this, wxString::Format (_("Could not decode video for view (%s)"), std_to_wx(e.what()).data()));
+ }
}
_panel->Refresh ();
void slider_moved (wxScrollEvent &);
void play_clicked (wxCommandEvent &);
void timer (wxTimerEvent &);
- void process_video (boost::shared_ptr<const Image>, bool, Time);
+ void process_video (boost::shared_ptr<const Image>, Time);
void calculate_sizes ();
void check_play_state ();
void fetch_current_frame_again ();
libdcp::Size _out_size;
/** Size of the panel that we have available */
libdcp::Size _panel_size;
+
+ std::list<std::pair<boost::shared_ptr<const Image>, Time> > _queue;
};