void
-Player::atmos (weak_ptr<Piece>, ContentAtmos data)
+Player::atmos (weak_ptr<Piece> weak_piece, ContentAtmos data)
{
if (_suspended) {
return;
}
- Atmos (data.data, DCPTime::from_frames(data.frame, _film->video_frame_rate()), data.metadata);
+ auto piece = weak_piece.lock ();
+ DCPOMATIC_ASSERT (piece);
+
+ auto const vfr = _film->video_frame_rate();
+
+ DCPTime const dcp_time = DCPTime::from_frames(data.frame, vfr) - DCPTime(piece->content->trim_start(), FrameRateChange(vfr, vfr));
+ if (dcp_time < piece->content->position() || dcp_time >= (piece->content->end(_film))) {
+ return;
+ }
+
+ Atmos (data.data, dcp_time, data.metadata);
}
cl.run ();
}
+
+BOOST_AUTO_TEST_CASE (atmos_trim_test)
+{
+ Cleanup cl;
+
+ auto ref = TestPaths::private_data() / "atmos_asset.mxf";
+ auto content = content_factory (TestPaths::private_data() / "atmos_asset.mxf").front();
+ auto film = new_test_film2 ("atmos_trim_test", {content}, &cl);
+
+ content->set_trim_start (dcpomatic::ContentTime::from_seconds(1));
+
+ /* Just check that the encode runs; I'm not sure how to test the MXF */
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
+}
+