projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various alignment adjustments.
[dcpomatic.git]
/
src
/
lib
/
player.cc
diff --git
a/src/lib/player.cc
b/src/lib/player.cc
index a5538d9a6103120ec69b2543f6ac4d4eff004ff0..810d949d971278e81512138a203b78b9e743c3a0 100644
(file)
--- a/
src/lib/player.cc
+++ b/
src/lib/player.cc
@@
-95,11
+95,12
@@
int const PlayerProperty::DCP_DECODE_REDUCTION = 704;
int const PlayerProperty::PLAYBACK_LENGTH = 705;
int const PlayerProperty::PLAYBACK_LENGTH = 705;
-Player::Player (shared_ptr<const Film> film)
+Player::Player (shared_ptr<const Film> film
, bool aligned
)
: _film (film)
, _suspended (0)
, _tolerant (film->tolerant())
, _audio_merger (_film->audio_frame_rate())
: _film (film)
, _suspended (0)
, _tolerant (film->tolerant())
, _audio_merger (_film->audio_frame_rate())
+ , _aligned_subtitles (aligned)
{
construct ();
}
{
construct ();
}
@@
-134,12
+135,6
@@
Player::construct ()
}
}
-Player::~Player ()
-{
- delete _shuffler;
-}
-
-
void
Player::setup_pieces ()
{
void
Player::setup_pieces ()
{
@@
-170,8
+165,7
@@
Player::setup_pieces_unlocked ()
auto old_pieces = _pieces;
_pieces.clear ();
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()) {
_shuffler->Video.connect(bind(&Player::video, this, _1, _2));
for (auto i: playlist()->content()) {
@@
-226,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 */
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));
}
} else {
decoder->video->Data.connect (bind(&Player::video, this, weak_ptr<Piece>(piece), _1));
}
@@
-834,13
+828,17
@@
Player::open_subtitles_for_frame (DCPTime time) const
return {};
}
return {};
}
- return merge (captions);
+ return merge (captions
, _aligned_subtitles
);
}
void
Player::video (weak_ptr<Piece> wp, ContentVideo video)
{
}
void
Player::video (weak_ptr<Piece> wp, ContentVideo video)
{
+ if (_suspended) {
+ return;
+ }
+
auto piece = wp.lock ();
if (!piece) {
return;
auto piece = wp.lock ();
if (!piece) {
return;
@@
-951,6
+949,10
@@
Player::video (weak_ptr<Piece> wp, ContentVideo video)
void
Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_audio)
{
void
Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_audio)
{
+ if (_suspended) {
+ return;
+ }
+
DCPOMATIC_ASSERT (content_audio.audio->frames() > 0);
auto piece = wp.lock ();
DCPOMATIC_ASSERT (content_audio.audio->frames() > 0);
auto piece = wp.lock ();
@@
-1021,6
+1023,10
@@
Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_a
void
Player::bitmap_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentBitmapText subtitle)
{
void
Player::bitmap_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentBitmapText subtitle)
{
+ if (_suspended) {
+ return;
+ }
+
auto piece = wp.lock ();
auto text = wc.lock ();
if (!piece || !text) {
auto piece = wp.lock ();
auto text = wc.lock ();
if (!piece || !text) {
@@
-1060,6
+1066,10
@@
Player::bitmap_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, C
void
Player::plain_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentStringText subtitle)
{
void
Player::plain_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentStringText subtitle)
{
+ if (_suspended) {
+ return;
+ }
+
auto piece = wp.lock ();
auto text = wc.lock ();
if (!piece || !text) {
auto piece = wp.lock ();
auto text = wc.lock ();
if (!piece || !text) {
@@
-1105,6
+1115,10
@@
Player::plain_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Co
void
Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentTime to)
{
void
Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, ContentTime to)
{
+ if (_suspended) {
+ return;
+ }
+
auto text = wc.lock ();
if (!text) {
return;
auto text = wc.lock ();
if (!text) {
return;
@@
-1199,6
+1213,16
@@
Player::seek (DCPTime time, bool accurate)
void
Player::emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
{
void
Player::emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
{
+ if (!_film->three_d()) {
+ if (pv->eyes() == Eyes::LEFT) {
+ /* Use left-eye images for both eyes... */
+ pv->set_eyes (Eyes::BOTH);
+ } else if (pv->eyes() == Eyes::RIGHT) {
+ /* ...and discard the right */
+ return;
+ }
+ }
+
/* We need a delay to give a little wiggle room to ensure that relevent subtitles arrive at the
player before the video that requires them.
*/
/* We need a delay to give a little wiggle room to ensure that relevent subtitles arrive at the
player before the video that requires them.
*/
@@
-1344,6
+1368,10
@@
Player::playlist () const
void
Player::atmos (weak_ptr<Piece>, ContentAtmos data)
{
void
Player::atmos (weak_ptr<Piece>, ContentAtmos data)
{
+ if (_suspended) {
+ return;
+ }
+
Atmos (data.data, DCPTime::from_frames(data.frame, _film->video_frame_rate()), data.metadata);
}
Atmos (data.data, DCPTime::from_frames(data.frame, _film->video_frame_rate()), data.metadata);
}