diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-21 10:25:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-21 10:25:46 +0100 |
| commit | 81915d4db00c333da2debd2f8e9a0c02f7a316a3 (patch) | |
| tree | 68062af342d2ef6c7a3b5aebbe7cb761bbab5372 /src/wx | |
| parent | 4c905330c2052cd77be09d9deb301f1fcf4b81f2 (diff) | |
wipopt-hacx
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/audio_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/content_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/content_timeline.cc | 10 | ||||
| -rw-r--r-- | src/wx/content_widget.h | 6 | ||||
| -rw-r--r-- | src/wx/dcp_referencing_dialog.cc | 2 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 7 | ||||
| -rw-r--r-- | src/wx/simple_video_view.cc | 35 | ||||
| -rw-r--r-- | src/wx/simple_video_view.h | 1 | ||||
| -rw-r--r-- | src/wx/text_panel.cc | 1 | ||||
| -rw-r--r-- | src/wx/timeline_content_view.cc | 2 | ||||
| -rw-r--r-- | src/wx/video_panel.cc | 3 | ||||
| -rw-r--r-- | src/wx/video_view.cc | 2 | ||||
| -rw-r--r-- | src/wx/video_view.h | 6 |
13 files changed, 70 insertions, 9 deletions
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 1418f1ff9..1bc62b547 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -214,6 +214,8 @@ AudioPanel::film_changed (FilmProperty property) void AudioPanel::film_content_changed (int property) { + PeriodTimer timer("AudioPanel::film_content_changed"); + auto ac = _parent->selected_audio (); if (property == AudioContentProperty::STREAMS) { if (ac.size() == 1) { diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 8938ef0fd..4b60e13a8 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -865,6 +865,8 @@ ContentPanel::select_all () void ContentPanel::film_content_changed (int property) { + PeriodTimer timer("ContentPanel::film_content_changed"); + if ( property == ContentProperty::PATH || property == DCPContentProperty::NEEDS_ASSETS || diff --git a/src/wx/content_timeline.cc b/src/wx/content_timeline.cc index 7200bf076..cdbe60760 100644 --- a/src/wx/content_timeline.cc +++ b/src/wx/content_timeline.cc @@ -48,6 +48,9 @@ LIBDCP_ENABLE_WARNINGS #include <list> +#include "lib/timer.h" + + using std::abs; using std::dynamic_pointer_cast; using std::list; @@ -643,7 +646,9 @@ ContentTimeline::left_up_select(wxMouseEvent& ev) _down_view->content()->set_change_signals_frequent (false); } - _content_panel->set_selection (selected_content ()); + PeriodTimer timer("Let's a go"); + // _content_panel->set_selection (selected_content ()); + /* Since we may have just set change signals back to `not-frequent', we have to make sure this position change is signalled, even if the position value has not changed since the last time it was set (with frequent=true). This is @@ -856,6 +861,8 @@ ContentTimeline::set_position_from_event(wxMouseEvent& ev, bool force_emit) new_position = DCPTime (); } + GlobalTimer::instance()->reset(); + GlobalTimer::instance()->mark("set_position"); _down_view->content()->set_position (film, new_position, force_emit); film->set_sequence (false); @@ -865,6 +872,7 @@ ContentTimeline::set_position_from_event(wxMouseEvent& ev, bool force_emit) void ContentTimeline::force_redraw(dcpomatic::Rect<int> const & r) { + GlobalTimer::instance()->mark("RefreshRect"); _main_canvas->RefreshRect (wxRect (r.x, r.y, r.width, r.height), false); } diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h index f7edf6b30..68e257c7f 100644 --- a/src/wx/content_widget.h +++ b/src/wx/content_widget.h @@ -211,9 +211,9 @@ private: void model_changed (ChangeType type, int property) { - if (type == ChangeType::DONE && property == _property && !_ignore_model_changes) { - update_from_model (); - } + // if (type == ChangeType::DONE && property == _property && !_ignore_model_changes) { + // update_from_model (); + // } } T* _wrapped; diff --git a/src/wx/dcp_referencing_dialog.cc b/src/wx/dcp_referencing_dialog.cc index 9b1c61c12..4d314a031 100644 --- a/src/wx/dcp_referencing_dialog.cc +++ b/src/wx/dcp_referencing_dialog.cc @@ -83,6 +83,8 @@ DCPReferencingDialog::film_changed(ChangeType type, FilmProperty property) void DCPReferencingDialog::film_content_changed(ChangeType type, int property) { + PeriodTimer timer("DCPReferencingDialog::film_content_changed"); + if (type != ChangeType::DONE) { return; } diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index a7a2ab984..a40c316f6 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -405,6 +405,7 @@ FilmViewer::start () start_audio_stream_if_open (); _playing = true; + _butler->enable_lookahead(); /* Calling start() below may directly result in Stopped being emitted, and if that * happens we want it to come after the Started signal, so do that first. */ @@ -423,6 +424,7 @@ FilmViewer::stop () } _playing = false; + _butler->disable_lookahead(); _video_view->stop (); Stopped (); @@ -451,6 +453,7 @@ void FilmViewer::player_change (vector<int> properties) { calculate_sizes (); + PeriodTimer timer("FV player_change"); bool try_quick_refresh = false; bool update_ccap_tracks = false; @@ -484,9 +487,11 @@ FilmViewer::player_change (vector<int> properties) } + void FilmViewer::film_change(ChangeType type, FilmProperty p) { + PeriodTimer timer("FV film_change"); if (type != ChangeType::DONE) { return; } @@ -506,6 +511,7 @@ FilmViewer::film_change(ChangeType type, FilmProperty p) void FilmViewer::film_length_change () { + PeriodTimer timer("FV film_length_change"); _video_view->set_length (_film->length()); } @@ -514,6 +520,7 @@ FilmViewer::film_length_change () void FilmViewer::slow_refresh () { + PeriodTimer timer("FV slow refresh\n"); seek (_video_view->position(), true); } diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc index 84c837757..91d4d4215 100644 --- a/src/wx/simple_video_view.cc +++ b/src/wx/simple_video_view.cc @@ -195,12 +195,17 @@ SimpleVideoView::start () VideoView::NextFrameResult SimpleVideoView::display_next_frame (bool non_blocking) { + std::cout << "dnf non_blocking=" << non_blocking << "\n"; + PeriodTimer timer("dnf"); + auto const r = get_next_frame (non_blocking); if (r != SUCCESS) { return r; } - update (); + if (do_update(non_blocking)) { + return AGAIN; + } try { _viewer->butler()->rethrow (); @@ -215,18 +220,30 @@ SimpleVideoView::display_next_frame (bool non_blocking) void SimpleVideoView::update () { + do_update(false); +} + + +/** @return true if this call was aborted because it would take too long, and we're non_blocking */ +bool +SimpleVideoView::do_update(bool non_blocking) +{ + StateTimer timer("update", "early-return"); if (!player_video().first) { _image.reset (); refresh_panel (); - return; + return false; } + timer.set("check too late"); + if (_viewer->playing() && (_viewer->time() - player_video().second) > one_video_frame()) { + std::cout << "too late!\n"; /* Too late; just drop this frame before we try to get its image (which will be the time-consuming part if this frame is J2K). */ add_dropped (); - return; + return false; } /* In an ideal world, what we would do here is: @@ -249,18 +266,30 @@ SimpleVideoView::update () _state_timer.set ("get image"); + timer.set("player_video()"); auto const pv = player_video(); + timer.set("get image"); + // if (non_blocking && !pv.first->have_image()) { + // std::cout << "not ready\n"; + // return true; + // } + _image = pv.first->image(boost::bind(&PlayerVideo::force, AV_PIX_FMT_RGB24), VideoRange::FULL, true); + timer.set("fix 2020"); if (pv.first->colour_conversion() && pv.first->colour_conversion()->about_equal(dcp::ColourConversion::rec2020_to_xyz(), 1e-6)) { _image = Image::ensure_alignment(_rec2020_filter_graph.get(_image->size(), _image->pixel_format())->process(_image).front(), Image::Alignment::COMPACT); } _state_timer.set ("ImageChanged"); + timer.set("image_changed"); _viewer->image_changed (player_video().first); _state_timer.unset (); _inter_position = player_video().first->inter_position (); _inter_size = player_video().first->inter_size (); + timer.set("refresh_panel"); refresh_panel (); + + return false; } diff --git a/src/wx/simple_video_view.h b/src/wx/simple_video_view.h index e19068979..80087a7d8 100644 --- a/src/wx/simple_video_view.h +++ b/src/wx/simple_video_view.h @@ -48,6 +48,7 @@ public: NextFrameResult display_next_frame (bool non_blocking) override; private: + bool do_update(bool non_blocking); void refresh_panel (); void paint (); void timer (); diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index b69f115f7..90842ee80 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -394,6 +394,7 @@ TextPanel::film_changed(FilmProperty property) void TextPanel::film_content_changed (int property) { + PeriodTimer timer("TextPanel::film_content_changed"); auto fc = _parent->selected_ffmpeg (); auto sc = _parent->selected_text (); diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index 69a675c42..ef9165d0d 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -175,6 +175,8 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>> void TimelineContentView::content_change (ChangeType type, int p) { + PeriodTimer timer("TimelineContentView::content_change"); + if (type != ChangeType::DONE) { return; } diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 06de93526..f83df0d0e 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -371,6 +371,7 @@ hash_value (boost::optional<ColourConversion> const & c) void VideoPanel::film_content_changed (int property) { + PeriodTimer timer("VideoPanel::film_content_changed"); auto vc = _parent->selected_video (); shared_ptr<Content> vcs; shared_ptr<FFmpegContent> fcs; @@ -543,6 +544,8 @@ VideoPanel::edit_colour_conversion_clicked () void VideoPanel::content_selection_changed () { + std::cout << "VideoContentProperty::content_selection_changed\n"; + auto video_sel = _parent->selected_video (); _frame_type->set_content (video_sel); diff --git a/src/wx/video_view.cc b/src/wx/video_view.cc index c271cb65e..1a19426f5 100644 --- a/src/wx/video_view.cc +++ b/src/wx/video_view.cc @@ -61,6 +61,8 @@ VideoView::clear () VideoView::NextFrameResult VideoView::get_next_frame (bool non_blocking) { + PeriodTimer timer("get_next_frame"); + if (length() == dcpomatic::DCPTime()) { return FAIL; } diff --git a/src/wx/video_view.h b/src/wx/video_view.h index 3ea03a5fd..7f6471934 100644 --- a/src/wx/video_view.h +++ b/src/wx/video_view.h @@ -56,8 +56,10 @@ public: /** @return the thing displaying the image */ virtual wxWindow* get () const = 0; - /** Re-make and display the image from the current _player_video */ - virtual void update () = 0; + /** Re-make and display the image from the current _player_video. + * It's OK if this takes a while. + */ + virtual void update() = 0; /** Called when playback starts */ virtual void start (); /** Called when playback stops */ |
