summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-09-04 00:39:39 +0100
committerCarl Hetherington <cth@carlh.net>2018-09-04 00:39:39 +0100
commit1938b1b08d38fc199717d1875a61ef05e5b965de (patch)
tree3734257f39ea97983c7dc49425ae6d51a596215c /src/lib
parenta45dd41c4dc7b95b1e3e79640e965ae663e7e680 (diff)
Build Empty objects from the presence or absence of decoders in
Pieces, rather than the presence or absence of content. This seems better because of cases like encrypted DCPs without a a KDM: here we may have content but no decoder.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/empty.cc9
-rw-r--r--src/lib/empty.h10
-rw-r--r--src/lib/player.cc17
-rw-r--r--src/lib/player.h7
4 files changed, 31 insertions, 12 deletions
diff --git a/src/lib/empty.cc b/src/lib/empty.cc
index 68a153b07..1e6e1c3fb 100644
--- a/src/lib/empty.cc
+++ b/src/lib/empty.cc
@@ -25,6 +25,7 @@
#include "content_part.h"
#include "dcp_content.h"
#include "dcpomatic_time_coalesce.h"
+#include "piece.h"
#include <boost/foreach.hpp>
#include <iostream>
@@ -34,12 +35,12 @@ using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::function;
-Empty::Empty (ContentList content, DCPTime length, function<shared_ptr<ContentPart> (Content *)> part)
+Empty::Empty (list<shared_ptr<Piece> > pieces, DCPTime length, function<bool (shared_ptr<Piece>)> part)
{
list<DCPTimePeriod> full;
- BOOST_FOREACH (shared_ptr<Content> i, content) {
- if (part (i.get())) {
- full.push_back (DCPTimePeriod (i->position(), i->end()));
+ BOOST_FOREACH (shared_ptr<Piece> i, pieces) {
+ if (part(i)) {
+ full.push_back (DCPTimePeriod (i->content->position(), i->content->end()));
}
}
diff --git a/src/lib/empty.h b/src/lib/empty.h
index d8b00047f..73548f729 100644
--- a/src/lib/empty.h
+++ b/src/lib/empty.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,6 +18,9 @@
*/
+#ifndef DCPOMATIC_EMPTY_H
+#define DCPOMATIC_EMPTY_H
+
#include "playlist.h"
#include "dcpomatic_time.h"
#include "content_part.h"
@@ -26,12 +29,13 @@
struct empty_test1;
struct empty_test2;
struct player_subframe_test;
+class Piece;
class Empty
{
public:
Empty () {}
- Empty (ContentList content, DCPTime length, boost::function<boost::shared_ptr<ContentPart> (Content *)> part);
+ Empty (std::list<boost::shared_ptr<Piece> > pieces, DCPTime length, boost::function<bool (boost::shared_ptr<Piece>)> part);
DCPTime position () const {
return _position;
@@ -51,3 +55,5 @@ private:
std::list<DCPTimePeriod> _periods;
DCPTime _position;
};
+
+#endif
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 15f274e98..a7440cb4f 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -123,6 +123,18 @@ Player::setup_pieces ()
setup_pieces_unlocked ();
}
+bool
+have_video (shared_ptr<Piece> piece)
+{
+ return piece->decoder && piece->decoder->video;
+}
+
+bool
+have_audio (shared_ptr<Piece> piece)
+{
+ return piece->decoder && piece->decoder->audio;
+}
+
void
Player::setup_pieces_unlocked ()
{
@@ -215,8 +227,8 @@ Player::setup_pieces_unlocked ()
}
}
- _black = Empty (_film->content(), _film->length(), bind(&Content::video, _1));
- _silent = Empty (_film->content(), _film->length(), bind(&Content::audio, _1));
+ _black = Empty (_pieces, _film->length(), bind(&have_video, _1));
+ _silent = Empty (_pieces, _film->length(), bind(&have_audio, _1));
_last_video_time = DCPTime ();
_last_video_eyes = EYES_BOTH;
@@ -238,6 +250,7 @@ Player::playlist_content_change (ChangeType type, int property, bool frequent)
/* A change in our content has gone through. Re-build our pieces. */
setup_pieces ();
} else if (type == CHANGE_TYPE_CANCELLED) {
+ boost::mutex::scoped_lock lm (_mutex);
_suspended = false;
}
diff --git a/src/lib/player.h b/src/lib/player.h
index 95547f61c..b3c4e82b4 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -90,9 +90,6 @@ public:
boost::signals2::signal<void (ChangeType, int, bool)> Change;
- /** The change suggested by a MayChange did not happen */
- boost::signals2::signal<void ()> NotChanged;
-
/** Emitted when a video frame is ready. These emissions happen in the correct order. */
boost::signals2::signal<void (boost::shared_ptr<PlayerVideo>, DCPTime)> Video;
boost::signals2::signal<void (boost::shared_ptr<AudioBuffers>, DCPTime)> Audio;
@@ -108,6 +105,8 @@ private:
friend struct player_time_calculation_test2;
friend struct player_time_calculation_test3;
friend struct player_subframe_test;
+ friend struct empty_test1;
+ friend struct empty_test2;
void setup_pieces ();
void setup_pieces_unlocked ();
@@ -146,7 +145,7 @@ private:
boost::shared_ptr<const Film> _film;
boost::shared_ptr<const Playlist> _playlist;
- /** true if we are suspended (i.e. pass() and seek() do nothing */
+ /** true if we are suspended (i.e. pass() and seek() do nothing) */
bool _suspended;
std::list<boost::shared_ptr<Piece> > _pieces;