summaryrefslogtreecommitdiff
path: root/src/lib/player.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-04-02 17:04:47 +0100
committerCarl Hetherington <cth@carlh.net>2014-04-02 17:04:47 +0100
commitc86ed0c80b762d31eb68386662a7c37ae4e21b6b (patch)
tree0b7e2bd5b5f5606b71c5ba39af35aa21bcbad5db /src/lib/player.cc
parent89b2ca022fd8020a713d3a66c0bee93b2b95aac1 (diff)
Various fixes to FFmpeg decoder, including a couple of tests.
Diffstat (limited to 'src/lib/player.cc')
-rw-r--r--src/lib/player.cc36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 02ae4e5c9..368d4c2ff 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -288,6 +288,23 @@ Player::set_approximate_size ()
}
shared_ptr<DCPVideo>
+Player::black_dcp_video (DCPTime time) const
+{
+ return shared_ptr<DCPVideo> (
+ new DCPVideo (
+ _black_image,
+ EYES_BOTH,
+ Crop (),
+ _video_container_size,
+ _video_container_size,
+ Scaler::from_id ("bicubic"),
+ Config::instance()->colour_conversions().front().conversion,
+ time
+ )
+ );
+}
+
+shared_ptr<DCPVideo>
Player::get_video (DCPTime time, bool accurate)
{
if (!_have_valid_pieces) {
@@ -296,19 +313,8 @@ Player::get_video (DCPTime time, bool accurate)
list<shared_ptr<Piece> > ov = overlaps<VideoContent> (time);
if (ov.empty ()) {
- /* No video content at this time: return a black frame */
- return shared_ptr<DCPVideo> (
- new DCPVideo (
- _black_image,
- EYES_BOTH,
- Crop (),
- _video_container_size,
- _video_container_size,
- Scaler::from_id ("bicubic"),
- Config::instance()->colour_conversions().front().conversion,
- time
- )
- );
+ /* No video content at this time */
+ return black_dcp_video (time);
}
/* Create a DCPVideo from the content's video at this time */
@@ -320,7 +326,9 @@ Player::get_video (DCPTime time, bool accurate)
assert (content);
optional<ContentVideo> dec = decoder->get_video (dcp_to_content_video (piece, time), accurate);
- assert (dec);
+ if (!dec) {
+ return black_dcp_video (time);
+ }
dcp::Size image_size = content->scale().size (content, _video_container_size, _film->frame_size ());
if (_approximate_size) {