Correctly spot that a DCP with unencrypted picture but encrypted sound/subtitle needs...
[dcpomatic.git] / src / lib / player.cc
index 10c92c0736eb87385b5d4e0e20f88ba95c473f43..69306e3817e94fd378a17ea862e525a19293419f 100644 (file)
@@ -169,7 +169,8 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque
                property == ContentProperty::TRIM_END ||
                property == ContentProperty::PATH ||
                property == VideoContentProperty::FRAME_TYPE ||
-               property == DCPContentProperty::CAN_BE_PLAYED ||
+               property == DCPContentProperty::NEEDS_ASSETS ||
+               property == DCPContentProperty::NEEDS_KDM ||
                property == SubtitleContentProperty::COLOUR ||
                property == SubtitleContentProperty::OUTLINE ||
                property == SubtitleContentProperty::SHADOW ||
@@ -184,7 +185,9 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque
        } else if (
                property == SubtitleContentProperty::LINE_SPACING ||
                property == SubtitleContentProperty::OUTLINE_WIDTH ||
-               property == SubtitleContentProperty::Y_SCALE
+               property == SubtitleContentProperty::Y_SCALE ||
+               property == SubtitleContentProperty::FADE_IN ||
+               property == SubtitleContentProperty::FADE_OUT
                ) {
 
                /* These changes just need the pieces' decoders to be reset.
@@ -737,8 +740,17 @@ Player::get_reel_assets ()
 
                int64_t offset = 0;
                BOOST_FOREACH (shared_ptr<dcp::Reel> k, decoder->reels()) {
+
+                       DCPOMATIC_ASSERT (j->video_frame_rate ());
+                       double const cfr = j->video_frame_rate().get();
+                       Frame const trim_start = j->trim_start().frames_round (cfr);
+                       Frame const trim_end = j->trim_end().frames_round (cfr);
+
                        DCPTime const from = i->position() + DCPTime::from_frames (offset, _film->video_frame_rate());
                        if (j->reference_video ()) {
+                               DCPOMATIC_ASSERT (k->main_picture ());
+                               k->main_picture()->set_entry_point (trim_start);
+                               k->main_picture()->set_duration (k->main_picture()->intrinsic_duration() - trim_start - trim_end);
                                a.push_back (
                                        ReferencedReelAsset (
                                                k->main_picture (),
@@ -748,6 +760,9 @@ Player::get_reel_assets ()
                        }
 
                        if (j->reference_audio ()) {
+                               DCPOMATIC_ASSERT (k->main_sound ());
+                               k->main_sound()->set_entry_point (trim_start);
+                               k->main_sound()->set_duration (k->main_sound()->intrinsic_duration() - trim_start - trim_end);
                                a.push_back (
                                        ReferencedReelAsset (
                                                k->main_sound (),
@@ -758,6 +773,8 @@ Player::get_reel_assets ()
 
                        if (j->reference_subtitle ()) {
                                DCPOMATIC_ASSERT (k->main_subtitle ());
+                               k->main_subtitle()->set_entry_point (trim_start);
+                               k->main_subtitle()->set_duration (k->main_subtitle()->intrinsic_duration() - trim_start - trim_end);
                                a.push_back (
                                        ReferencedReelAsset (
                                                k->main_subtitle (),