{
wxPaintDC dc (_panel);
- if (!_frame || !_film || !_out_size.width || !_out_size.height) {
+ if (!_frame || !_film || !_out_size.width || !_out_size.height || _out_size != _frame->size()) {
dc.Clear ();
return;
}
_panel_size.height = ev.GetSize().GetHeight();
calculate_sizes ();
- quick_refresh ();
+ if (!quick_refresh()) {
+ slow_refresh ();
+ }
update_position_label ();
update_position_slider ();
}
void
FilmViewer::start ()
{
+ if (!_film) {
+ return;
+ }
+
if (_audio.isStreamOpen()) {
_audio.setStreamTime (_video_position.seconds());
_audio.startStream ();
}
DCPTime
-FilmViewer::nudge_amount (wxMouseEvent& ev)
+FilmViewer::nudge_amount (wxKeyboardState& ev)
{
DCPTime amount = one_video_frame ();
}
void
-FilmViewer::back_clicked (wxMouseEvent& ev)
+FilmViewer::back_frame ()
+{
+ if (!_film) {
+ return;
+ }
+
+ go_to (_video_position - one_video_frame());
+}
+
+void
+FilmViewer::forward_frame ()
+{
+ if (!_film) {
+ return;
+ }
+
+ go_to (_video_position + one_video_frame());
+}
+
+void
+FilmViewer::back_clicked (wxKeyboardState& ev)
{
go_to (_video_position - nudge_amount (ev));
- ev.Skip ();
}
void
-FilmViewer::forward_clicked (wxMouseEvent& ev)
+FilmViewer::forward_clicked (wxKeyboardState& ev)
{
go_to (_video_position + nudge_amount (ev));
- ev.Skip ();
}
void
}
calculate_sizes ();
+ bool refreshed = false;
if (
property == VideoContentProperty::CROP ||
property == VideoContentProperty::SCALE ||
property == PlayerProperty::VIDEO_CONTAINER_SIZE ||
property == PlayerProperty::FILM_CONTAINER
) {
- quick_refresh ();
- } else {
+ refreshed = quick_refresh ();
+ }
+
+ if (!refreshed) {
slow_refresh ();
}
update_position_label ();
seek (_video_position, true);
}
-/** Re-get the current frame quickly by resetting the metadata in the PlayerVideo that we used last time */
-void
+/** Try to re-get the current frame quickly by resetting the metadata
+ * in the PlayerVideo that we used last time.
+ * @return true if this was possible, false if not.
+ */
+bool
FilmViewer::quick_refresh ()
{
if (!_player_video.first) {
- return;
+ return false;
+ }
+
+ if (!_player_video.first->reset_metadata (_player->video_container_size(), _film->frame_size())) {
+ return false;
}
- _player_video.first->reset_metadata (_player->video_container_size(), _film->frame_size());
display_player_video ();
+ return true;
}
void
_audio.closeStream ();
}
- if (Config::instance()->sound()) {
+ if (Config::instance()->sound() && _audio.getDeviceCount() > 0) {
unsigned int st = 0;
if (Config::instance()->sound_output()) {
while (st < _audio.getDeviceCount()) {