summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-10-15 00:28:32 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-17 00:10:59 +0200
commit7d8d78c183656191ff44c9464e06b843bfadc54d (patch)
treefaaca79c98662546e6d41a14650780257344cf37 /src/wx
parentbfd6bd32b5e20c479170452a66cb44eff59feacd (diff)
Remove some more unnecessary use of shared_ptr.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/film_viewer.cc10
-rw-r--r--src/wx/film_viewer.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index c56e2f5d2..c5fb50217 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -161,14 +161,14 @@ FilmViewer::set_film (shared_ptr<Film> film)
_closed_captions_dialog->clear ();
if (!_film) {
- _player.reset ();
+ _player = boost::none;
recreate_butler ();
_video_view->update ();
return;
}
try {
- _player = make_shared<Player>(_film, _optimise_for_j2k ? Image::Alignment::COMPACT : Image::Alignment::PADDED);
+ _player.emplace(_film, _optimise_for_j2k ? Image::Alignment::COMPACT : Image::Alignment::PADDED);
_player->set_fast ();
if (_dcp_decode_reduction) {
_player->set_dcp_decode_reduction (_dcp_decode_reduction);
@@ -219,9 +219,11 @@ FilmViewer::recreate_butler ()
auto const j2k_gl_optimised = false;
#endif
+ DCPOMATIC_ASSERT(_player);
+
_butler = std::make_shared<Butler>(
_film,
- _player,
+ *_player,
Config::instance()->audio_mapping(_audio_channels),
_audio_channels,
boost::bind(&PlayerVideo::force, AV_PIX_FMT_RGB24),
@@ -517,6 +519,7 @@ FilmViewer::quick_refresh ()
void
FilmViewer::seek (shared_ptr<Content> content, ContentTime t, bool accurate)
{
+ DCPOMATIC_ASSERT(_player);
auto dt = _player->content_time_to_dcp (content, t);
if (dt) {
seek (*dt, accurate);
@@ -722,6 +725,7 @@ FilmViewer::dcp_decode_reduction () const
optional<ContentTime>
FilmViewer::position_in_content (shared_ptr<const Content> content) const
{
+ DCPOMATIC_ASSERT(_player);
return _player->dcp_to_content_time (content, position());
}
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 1fa85a621..062522ffd 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -175,7 +175,7 @@ private:
bool quick_refresh ();
std::shared_ptr<Film> _film;
- std::shared_ptr<Player> _player;
+ boost::optional<Player> _player;
std::shared_ptr<VideoView> _video_view;
bool _coalesce_player_changes = false;