summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-15 20:09:24 +0200
committerCarl Hetherington <cth@carlh.net>2024-06-23 19:51:28 +0200
commitd04355507baefd5fa42629341ed422f7402772f4 (patch)
tree078ee4094c7a8e4165329aa672279f7f6988c872
parent6b1ebeac38cf60142c542bbad30cea5597d7e1e7 (diff)
Move some stuff into FilmViewer::dcp().
-rw-r--r--src/wx/film_viewer.cc15
-rw-r--r--src/wx/film_viewer.h6
-rw-r--r--src/wx/player_information.cc8
3 files changed, 22 insertions, 7 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index ad240b957..50c3010d0 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -35,6 +35,7 @@
#include "lib/butler.h"
#include "lib/compose.hpp"
#include "lib/config.h"
+#include "lib/dcp_content.h"
#include "lib/dcpomatic_log.h"
#include "lib/examine_content_job.h"
#include "lib/exceptions.h"
@@ -900,6 +901,20 @@ FilmViewer::unset_crop_guess ()
}
+shared_ptr<DCPContent>
+FilmViewer::dcp() const
+{
+ if (_film) {
+ auto content = _film->content();
+ if (content.size() == 1) {
+ return dynamic_pointer_cast<DCPContent>(content.front());
+ }
+ }
+
+ return {};
+}
+
+
#if (RTAUDIO_VERSION_MAJOR >= 6)
void
FilmViewer::rtaudio_error_callback(string const& error)
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 392cf85a3..3ade364fe 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -43,6 +43,7 @@ LIBDCP_ENABLE_WARNINGS
class Butler;
class ClosedCaptionsDialog;
+class DCPContent;
class FFmpegPlayer;
class Image;
class Player;
@@ -76,6 +77,11 @@ public:
return _film;
}
+ /** @return The DCP that we are playing back, if that's the only content in
+ * our Film.
+ */
+ std::shared_ptr<DCPContent> dcp() const;
+
void seek (dcpomatic::DCPTime t, bool accurate);
void seek (std::shared_ptr<Content> content, dcpomatic::ContentTime p, bool accurate);
void seek_by (dcpomatic::DCPTime by, bool accurate);
diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc
index 057d26740..395dbc367 100644
--- a/src/wx/player_information.cc
+++ b/src/wx/player_information.cc
@@ -120,13 +120,7 @@ PlayerInformation::periodic_update ()
void
PlayerInformation::triggered_update ()
{
- shared_ptr<DCPContent> dcp;
- if (_viewer.film()) {
- auto content = _viewer.film()->content();
- if (content.size() == 1) {
- dcp = dynamic_pointer_cast<DCPContent>(content.front());
- }
- }
+ auto dcp = _viewer.dcp();
if (!dcp) {
checked_set (_dcp[0], _("No DCP loaded."));