summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-26 22:25:22 +0200
committerCarl Hetherington <cth@carlh.net>2021-05-07 09:29:59 +0200
commitbb4a9fe1587e134bb85dc9a96f97c6e8750c79b9 (patch)
tree76078566b01e1b1397ef258f75936bb795ede4c6 /src/lib
parentd783d55e3cf09c4ffefbbad00c456522b0f69a18 (diff)
C++11 tidying and scoped_ptr for Player::_shuffler.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc17
-rw-r--r--src/lib/player.h31
-rw-r--r--src/lib/shuffler.h8
3 files changed, 31 insertions, 25 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index c6d1e54de..1c5d1afd5 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -70,6 +70,7 @@ using std::dynamic_pointer_cast;
using std::list;
using std::make_pair;
using std::make_shared;
+using std::make_shared;
using std::map;
using std::max;
using std::min;
@@ -78,9 +79,8 @@ using std::pair;
using std::shared_ptr;
using std::vector;
using std::weak_ptr;
-using std::make_shared;
+using std::unique_ptr;
using boost::optional;
-using boost::scoped_ptr;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
@@ -134,12 +134,6 @@ Player::construct ()
}
-Player::~Player ()
-{
- delete _shuffler;
-}
-
-
void
Player::setup_pieces ()
{
@@ -170,8 +164,7 @@ Player::setup_pieces_unlocked ()
auto old_pieces = _pieces;
_pieces.clear ();
- delete _shuffler;
- _shuffler = new Shuffler();
+ _shuffler.reset (new Shuffler());
_shuffler->Video.connect(bind(&Player::video, this, _1, _2));
for (auto i: playlist()->content()) {
@@ -227,7 +220,7 @@ Player::setup_pieces_unlocked ()
if (decoder->video) {
if (i->video->frame_type() == VideoFrameType::THREE_D_LEFT || i->video->frame_type() == VideoFrameType::THREE_D_RIGHT) {
/* We need a Shuffler to cope with 3D L/R video data arriving out of sequence */
- decoder->video->Data.connect (bind(&Shuffler::video, _shuffler, weak_ptr<Piece>(piece), _1));
+ decoder->video->Data.connect (bind(&Shuffler::video, _shuffler.get(), weak_ptr<Piece>(piece), _1));
} else {
decoder->video->Data.connect (bind(&Player::video, this, weak_ptr<Piece>(piece), _1));
}
@@ -513,7 +506,7 @@ Player::get_reel_assets ()
continue;
}
- scoped_ptr<DCPDecoder> decoder;
+ unique_ptr<DCPDecoder> decoder;
try {
decoder.reset (new DCPDecoder(_film, j, false, false, shared_ptr<DCPDecoder>()));
} catch (...) {
diff --git a/src/lib/player.h b/src/lib/player.h
index 9086c4813..c8727fdb6 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -18,26 +18,30 @@
*/
+
#ifndef DCPOMATIC_PLAYER_H
#define DCPOMATIC_PLAYER_H
-#include "atmos_metadata.h"
-#include "player_text.h"
+
#include "active_text.h"
-#include "content_text.h"
-#include "film.h"
+#include "atmos_metadata.h"
+#include "audio_merger.h"
+#include "audio_stream.h"
#include "content.h"
#include "content_atmos.h"
-#include "position_image.h"
-#include "piece.h"
-#include "content_video.h"
#include "content_audio.h"
-#include "audio_stream.h"
-#include "audio_merger.h"
+#include "content_text.h"
+#include "content_video.h"
#include "empty.h"
+#include "film.h"
+#include "piece.h"
+#include "player_text.h"
+#include "position_image.h"
+#include "shuffler.h"
#include <boost/atomic.hpp>
#include <list>
+
namespace dcp {
class ReelAsset;
}
@@ -46,12 +50,13 @@ namespace dcpomatic {
class FontData;
}
+
class AtmosContent;
class PlayerVideo;
class Playlist;
class AudioBuffers;
class ReferencedReelAsset;
-class Shuffler;
+
class PlayerProperty
{
@@ -64,6 +69,7 @@ public:
static int const PLAYBACK_LENGTH;
};
+
/** @class Player
* @brief A class which can play a Playlist.
*/
@@ -72,7 +78,6 @@ class Player : public std::enable_shared_from_this<Player>
public:
Player (std::shared_ptr<const Film>);
Player (std::shared_ptr<const Film>, std::shared_ptr<const Playlist> playlist);
- ~Player ();
Player (Player const& Player) = delete;
Player& operator= (Player const& Player) = delete;
@@ -196,8 +201,8 @@ private:
LastVideoMap _last_video;
AudioMerger _audio_merger;
- Shuffler* _shuffler = nullptr;
- std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime> > _delay;
+ std::unique_ptr<Shuffler> _shuffler;
+ std::list<std::pair<std::shared_ptr<PlayerVideo>, dcpomatic::DCPTime>> _delay;
Empty _black;
Empty _silent;
diff --git a/src/lib/shuffler.h b/src/lib/shuffler.h
index 2b37b70a1..eb1705002 100644
--- a/src/lib/shuffler.h
+++ b/src/lib/shuffler.h
@@ -19,6 +19,10 @@
*/
+#ifndef DCPOMATIC_SHUFFLER_H
+#define DCPOMATIC_SHUFFLER_H
+
+
#include "types.h"
#include "content_video.h"
#include <boost/signals2.hpp>
@@ -48,3 +52,7 @@ private:
boost::optional<ContentVideo> _last;
static int const _max_size;
};
+
+
+#endif
+