summaryrefslogtreecommitdiff
path: root/src/lib
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/lib
parentbfd6bd32b5e20c479170452a66cb44eff59feacd (diff)
Remove some more unnecessary use of shared_ptr.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/butler.cc16
-rw-r--r--src/lib/butler.h4
-rw-r--r--src/lib/dcp_encoder.cc12
-rw-r--r--src/lib/encoder.cc2
-rw-r--r--src/lib/encoder.h3
-rw-r--r--src/lib/ffmpeg_encoder.cc4
-rw-r--r--src/lib/subtitle_encoder.cc12
7 files changed, 27 insertions, 26 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index ce35b1f39..b2fbc6c60 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -62,7 +62,7 @@ using namespace boost::placeholders;
*/
Butler::Butler (
weak_ptr<const Film> film,
- shared_ptr<Player> player,
+ Player& player,
AudioMapping audio_mapping,
int audio_channels,
function<AVPixelFormat (AVPixelFormat)> pixel_format,
@@ -89,13 +89,13 @@ Butler::Butler (
, _fast (fast)
, _prepare_only_proxy (prepare_only_proxy)
{
- _player_video_connection = _player->Video.connect (bind (&Butler::video, this, _1, _2));
- _player_audio_connection = _player->Audio.connect (bind (&Butler::audio, this, _1, _2, _3));
- _player_text_connection = _player->Text.connect (bind (&Butler::text, this, _1, _2, _3, _4));
+ _player_video_connection = _player.Video.connect(bind(&Butler::video, this, _1, _2));
+ _player_audio_connection = _player.Audio.connect(bind(&Butler::audio, this, _1, _2, _3));
+ _player_text_connection = _player.Text.connect(bind(&Butler::text, this, _1, _2, _3, _4));
/* The butler must hear about things first, otherwise it might not sort out suspensions in time for
get_video() to be called in response to this signal.
*/
- _player_change_connection = _player->Change.connect (bind (&Butler::player_change, this, _1, _2), boost::signals2::at_front);
+ _player_change_connection = _player.Change.connect(bind(&Butler::player_change, this, _1, _2), boost::signals2::at_front);
_thread = boost::thread (bind(&Butler::thread, this));
#ifdef DCPOMATIC_LINUX
pthread_setname_np (_thread.native_handle(), "butler");
@@ -200,7 +200,7 @@ try
/* Do any seek that has been requested */
if (_pending_seek_position) {
_finished = false;
- _player->seek (*_pending_seek_position, _pending_seek_accurate);
+ _player.seek(*_pending_seek_position, _pending_seek_accurate);
_pending_seek_position = optional<DCPTime> ();
}
@@ -210,7 +210,7 @@ try
*/
while (should_run() && !_pending_seek_position) {
lm.unlock ();
- bool const r = _player->pass ();
+ bool const r = _player.pass();
lm.lock ();
if (r) {
_finished = true;
@@ -410,7 +410,7 @@ Butler::player_change (ChangeType type, int property)
if (type == ChangeType::DONE) {
auto film = _film.lock();
if (film) {
- _video.reset_metadata (film, _player->video_container_size());
+ _video.reset_metadata(film, _player.video_container_size());
}
}
return;
diff --git a/src/lib/butler.h b/src/lib/butler.h
index bac94a742..1dba6e129 100644
--- a/src/lib/butler.h
+++ b/src/lib/butler.h
@@ -50,7 +50,7 @@ public:
Butler (
std::weak_ptr<const Film> film,
- std::shared_ptr<Player> player,
+ Player& player,
AudioMapping map,
int audio_channels,
std::function<AVPixelFormat (AVPixelFormat)> pixel_format,
@@ -105,7 +105,7 @@ private:
void seek_unlocked (dcpomatic::DCPTime position, bool accurate);
std::weak_ptr<const Film> _film;
- std::shared_ptr<Player> _player;
+ Player& _player;
boost::thread _thread;
VideoRingBuffers _video;
diff --git a/src/lib/dcp_encoder.cc b/src/lib/dcp_encoder.cc
index 16a99e79e..9a840c8ab 100644
--- a/src/lib/dcp_encoder.cc
+++ b/src/lib/dcp_encoder.cc
@@ -68,10 +68,10 @@ DCPEncoder::DCPEncoder (shared_ptr<const Film> film, weak_ptr<Job> job)
, _finishing (false)
, _non_burnt_subtitles (false)
{
- _player_video_connection = _player->Video.connect (bind (&DCPEncoder::video, this, _1, _2));
- _player_audio_connection = _player->Audio.connect (bind (&DCPEncoder::audio, this, _1, _2));
- _player_text_connection = _player->Text.connect (bind (&DCPEncoder::text, this, _1, _2, _3, _4));
- _player_atmos_connection = _player->Atmos.connect (bind (&DCPEncoder::atmos, this, _1, _2, _3));
+ _player_video_connection = _player.Video.connect(bind(&DCPEncoder::video, this, _1, _2));
+ _player_audio_connection = _player.Audio.connect(bind(&DCPEncoder::audio, this, _1, _2));
+ _player_text_connection = _player.Text.connect(bind(&DCPEncoder::text, this, _1, _2, _3, _4));
+ _player_atmos_connection = _player.Atmos.connect(bind(&DCPEncoder::atmos, this, _1, _2, _3));
for (auto c: film->content ()) {
for (auto i: c->text) {
@@ -104,10 +104,10 @@ DCPEncoder::go ()
}
if (_non_burnt_subtitles) {
- _writer.write(_player->get_subtitle_fonts());
+ _writer.write(_player.get_subtitle_fonts());
}
- while (!_player->pass ()) {}
+ while (!_player.pass()) {}
for (auto i: get_referenced_reel_assets(_film, _film->playlist())) {
_writer.write(i);
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index 1d688c318..5268d8620 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -41,7 +41,7 @@
Encoder::Encoder (std::shared_ptr<const Film> film, std::weak_ptr<Job> job)
: _film (film)
, _job (job)
- , _player (new Player(film, Image::Alignment::PADDED))
+ , _player(film, Image::Alignment::PADDED)
{
}
diff --git a/src/lib/encoder.h b/src/lib/encoder.h
index 19c1120b3..24217b124 100644
--- a/src/lib/encoder.h
+++ b/src/lib/encoder.h
@@ -23,6 +23,7 @@
#define DCPOMATIC_ENCODER_H
+#include "player.h"
#include "player_text.h"
#include "types.h"
#include <boost/signals2.hpp>
@@ -62,7 +63,7 @@ public:
protected:
std::shared_ptr<const Film> _film;
std::weak_ptr<Job> _job;
- std::shared_ptr<Player> _player;
+ Player _player;
};
diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc
index 2fcad68fe..001645af3 100644
--- a/src/lib/ffmpeg_encoder.cc
+++ b/src/lib/ffmpeg_encoder.cc
@@ -79,8 +79,8 @@ FFmpegEncoder::FFmpegEncoder (
Butler::Audio::ENABLED
)
{
- _player->set_always_burn_open_subtitles ();
- _player->set_play_referenced ();
+ _player.set_always_burn_open_subtitles();
+ _player.set_play_referenced();
}
diff --git a/src/lib/subtitle_encoder.cc b/src/lib/subtitle_encoder.cc
index 2331eb52a..51b9963bc 100644
--- a/src/lib/subtitle_encoder.cc
+++ b/src/lib/subtitle_encoder.cc
@@ -56,10 +56,10 @@ SubtitleEncoder::SubtitleEncoder (shared_ptr<const Film> film, shared_ptr<Job> j
, _reel_index (0)
, _length (film->length())
{
- _player->set_play_referenced ();
- _player->set_ignore_video ();
- _player->set_ignore_audio ();
- _player->Text.connect (boost::bind(&SubtitleEncoder::text, this, _1, _2, _3, _4));
+ _player.set_play_referenced();
+ _player.set_ignore_video();
+ _player.set_ignore_audio();
+ _player.Text.connect(boost::bind(&SubtitleEncoder::text, this, _1, _2, _3, _4));
string const extension = film->interop() ? ".xml" : ".mxf";
@@ -99,7 +99,7 @@ SubtitleEncoder::go ()
_reel_index = 0;
- while (!_player->pass()) {}
+ while (!_player.pass()) {}
int reel = 0;
for (auto& i: _assets) {
@@ -119,7 +119,7 @@ SubtitleEncoder::go ()
}
if (!_film->interop() || _include_font) {
- for (auto j: _player->get_subtitle_fonts()) {
+ for (auto j: _player.get_subtitle_fonts()) {
i.first->add_font(j->id(), j->data().get_value_or(_default_font));
}
}