projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: Player does not need enable_shared_from_this.
[dcpomatic.git]
/
src
/
lib
/
player.h
diff --git
a/src/lib/player.h
b/src/lib/player.h
index e07cc8200a3bb9af2d15b51856511e1902f311c4..0add90e97c82aedc9d34c45eea2d1899a4296714 100644
(file)
--- a/
src/lib/player.h
+++ b/
src/lib/player.h
@@
-32,6
+32,7
@@
#include "content_text.h"
#include "content_video.h"
#include "empty.h"
#include "content_text.h"
#include "content_video.h"
#include "empty.h"
+#include "enum_indexed_vector.h"
#include "film.h"
#include "image.h"
#include "player_text.h"
#include "film.h"
#include "image.h"
#include "player_text.h"
@@
-62,20
+63,28
@@
public:
static int const FILM_VIDEO_FRAME_RATE;
static int const DCP_DECODE_REDUCTION;
static int const PLAYBACK_LENGTH;
static int const FILM_VIDEO_FRAME_RATE;
static int const DCP_DECODE_REDUCTION;
static int const PLAYBACK_LENGTH;
+ static int const IGNORE_VIDEO;
+ static int const IGNORE_AUDIO;
+ static int const IGNORE_TEXT;
+ static int const ALWAYS_BURN_OPEN_SUBTITLES;
+ static int const PLAY_REFERENCED;
};
/** @class Player
* @brief A class which can play a Playlist.
*/
};
/** @class Player
* @brief A class which can play a Playlist.
*/
-class Player
: public std::enable_shared_from_this<Player>
+class Player
{
public:
Player (std::shared_ptr<const Film>, Image::Alignment subtitle_alignment);
Player (std::shared_ptr<const Film>, std::shared_ptr<const Playlist> playlist);
{
public:
Player (std::shared_ptr<const Film>, Image::Alignment subtitle_alignment);
Player (std::shared_ptr<const Film>, std::shared_ptr<const Playlist> playlist);
- Player (Player const& Player) = delete;
- Player& operator= (Player const& Player) = delete;
+ Player (Player const&) = delete;
+ Player& operator= (Player const&) = delete;
+
+ Player(Player&& other);
+ Player& operator=(Player&& other);
bool pass ();
void seek (dcpomatic::DCPTime time, bool accurate);
bool pass ();
void seek (dcpomatic::DCPTime time, bool accurate);
@@
-98,6
+107,12
@@
public:
boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<const Content> content, dcpomatic::ContentTime t) const;
boost::optional<dcpomatic::ContentTime> dcp_to_content_time (std::shared_ptr<const Content> content, dcpomatic::DCPTime t) const;
boost::optional<dcpomatic::DCPTime> content_time_to_dcp (std::shared_ptr<const Content> content, dcpomatic::ContentTime t) const;
boost::optional<dcpomatic::ContentTime> dcp_to_content_time (std::shared_ptr<const Content> content, dcpomatic::DCPTime t) const;
+ void signal_change(ChangeType type, int property);
+
+ /** First parameter is PENDING, DONE or CANCELLED.
+ * Second parameter is the property.
+ * Third parameter is true if these signals are currently likely to be frequent.
+ */
boost::signals2::signal<void (ChangeType, int, bool)> Change;
/** Emitted when a video frame is ready. These emissions happen in the correct order. */
boost::signals2::signal<void (ChangeType, int, bool)> Change;
/** Emitted when a video frame is ready. These emissions happen in the correct order. */
@@
-125,6
+140,7
@@
private:
friend struct overlap_video_test1;
void construct ();
friend struct overlap_video_test1;
void construct ();
+ void connect();
void setup_pieces ();
void film_change (ChangeType, Film::Property);
void playlist_change (ChangeType);
void setup_pieces ();
void film_change (ChangeType, Film::Property);
void playlist_change (ChangeType);
@@
-155,15
+171,15
@@
private:
void emit_audio (std::shared_ptr<AudioBuffers> data, dcpomatic::DCPTime time);
std::shared_ptr<const Playlist> playlist () const;
void emit_audio (std::shared_ptr<AudioBuffers> data, dcpomatic::DCPTime time);
std::shared_ptr<const Playlist> playlist () const;
- /** Mutex to protect the
whol
e Player state. When it's used for the preview we have
+ /** Mutex to protect the
most of th
e Player state. When it's used for the preview we have
seek() and pass() called from the Butler thread and lots of other stuff called
from the GUI thread.
*/
mutable boost::mutex _mutex;
seek() and pass() called from the Butler thread and lots of other stuff called
from the GUI thread.
*/
mutable boost::mutex _mutex;
- std::
shared_ptr<const Film> const
_film;
+ std::
weak_ptr<const Film>
_film;
/** Playlist, or 0 if we are using the one from the _film */
/** Playlist, or 0 if we are using the one from the _film */
- std::shared_ptr<const Playlist>
const
_playlist;
+ std::shared_ptr<const Playlist> _playlist;
/** > 0 if we are suspended (i.e. pass() and seek() do nothing) */
boost::atomic<int> _suspended;
/** > 0 if we are suspended (i.e. pass() and seek() do nothing) */
boost::atomic<int> _suspended;
@@
-173,6
+189,8
@@
private:
* the size of preview in a window.
*/
boost::atomic<dcp::Size> _video_container_size;
* the size of preview in a window.
*/
boost::atomic<dcp::Size> _video_container_size;
+
+ mutable boost::mutex _black_image_mutex;
std::shared_ptr<Image> _black_image;
/** true if the player should ignore all video; i.e. never produce any */
std::shared_ptr<Image> _black_image;
/** true if the player should ignore all video; i.e. never produce any */
@@
-184,7
+202,7
@@
private:
/** true if we should try to be fast rather than high quality */
boost::atomic<bool> _fast;
/** true if we should keep going in the face of `survivable' errors */
/** true if we should try to be fast rather than high quality */
boost::atomic<bool> _fast;
/** true if we should keep going in the face of `survivable' errors */
- bool
const
_tolerant;
+ bool _tolerant;
/** true if we should `play' (i.e output) referenced DCP data (e.g. for preview) */
boost::atomic<bool> _play_referenced;
/** true if we should `play' (i.e output) referenced DCP data (e.g. for preview) */
boost::atomic<bool> _play_referenced;
@@
-222,13
+240,13
@@
private:
Empty _black;
Empty _silent;
Empty _black;
Empty _silent;
-
ActiveText _active_texts[static_cast<int>(TextType::COUNT)]
;
+
EnumIndexedVector<ActiveText, TextType> _active_texts
;
std::shared_ptr<AudioProcessor> _audio_processor;
std::shared_ptr<AudioProcessor> _audio_processor;
-
dcpomatic::DCPTime
_playback_length;
+
boost::atomic<dcpomatic::DCPTime>
_playback_length;
/** Alignment for subtitle images that we create */
/** Alignment for subtitle images that we create */
- Image::Alignment
const
_subtitle_alignment = Image::Alignment::PADDED;
+ Image::Alignment _subtitle_alignment = Image::Alignment::PADDED;
boost::signals2::scoped_connection _film_changed_connection;
boost::signals2::scoped_connection _playlist_change_connection;
boost::signals2::scoped_connection _film_changed_connection;
boost::signals2::scoped_connection _playlist_change_connection;