summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-09-29 14:16:56 +0200
committerCarl Hetherington <cth@carlh.net>2021-02-15 03:16:16 +0100
commit42a6003535d3153224da33b973bb79662d296e02 (patch)
treef17b37e110fbd93355c21515614d9ecad5364fdf /src/lib
parenta632e34e3c9ca94574fcab1b3006227ed2833766 (diff)
Basic handling of overlapping video (#1848).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/piece.h11
-rw-r--r--src/lib/player.cc20
-rw-r--r--src/lib/player.h2
3 files changed, 31 insertions, 2 deletions
diff --git a/src/lib/piece.h b/src/lib/piece.h
index a2e62d366..688242c06 100644
--- a/src/lib/piece.h
+++ b/src/lib/piece.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,15 +18,20 @@
*/
+
#ifndef DCPOMATIC_PIECE_H
#define DCPOMATIC_PIECE_H
-#include "types.h"
+
+#include "dcpomatic_time.h"
#include "frame_rate_change.h"
+#include "types.h"
+
class Content;
class Decoder;
+
class Piece
{
public:
@@ -39,8 +44,10 @@ public:
std::shared_ptr<Content> content;
std::shared_ptr<Decoder> decoder;
+ boost::optional<dcpomatic::DCPTimePeriod> ignore_video;
FrameRateChange frc;
bool done;
};
+
#endif
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 465fcad6d..36d3fde67 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -266,6 +266,22 @@ Player::setup_pieces_unlocked ()
}
}
+ for (auto i = _pieces.begin(); i != _pieces.end(); ++i) {
+ if (auto video = (*i)->content->video) {
+ if (video->use() && video->frame_type() != VideoFrameType::THREE_D_LEFT && video->frame_type() != VideoFrameType::THREE_D_RIGHT) {
+ /* Look for content later in the content list with in-use video that overlaps this */
+ auto period = DCPTimePeriod((*i)->content->position(), (*i)->content->end(_film));
+ auto j = i;
+ ++j;
+ for (; j != _pieces.end(); ++j) {
+ if ((*j)->content->video && (*j)->content->video->use()) {
+ (*i)->ignore_video = DCPTimePeriod((*j)->content->position(), (*j)->content->end(_film)).overlap(period);
+ }
+ }
+ }
+ }
+ }
+
_black = Empty (_film, playlist(), bind(&have_video, _1), _playback_length);
_silent = Empty (_film, playlist(), bind(&have_audio, _1), _playback_length);
@@ -851,6 +867,10 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
return;
}
+ if (piece->ignore_video && piece->ignore_video->contains(time)) {
+ return;
+ }
+
/* Fill gaps that we discover now that we have some video which needs to be emitted.
This is where we need to fill to.
*/
diff --git a/src/lib/player.h b/src/lib/player.h
index ce49af148..be8d556af 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -76,6 +76,7 @@ public:
Player (Player const& Player) = delete;
Player& operator= (Player const& Player) = delete;
+
bool pass ();
void seek (dcpomatic::DCPTime time, bool accurate);
@@ -118,6 +119,7 @@ private:
friend struct empty_test1;
friend struct empty_test2;
friend struct check_reuse_old_data_test;
+ friend struct overlap_video_test1;
void construct ();
void setup_pieces ();