diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-07-15 00:53:10 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-07-15 00:53:10 +0100 |
| commit | a788f3c1e29a6b8329d54e1518f3b84d68d347d5 (patch) | |
| tree | 80c0f7a7f46934dfc2834a331d2d04c9eb22cf4b /src/lib | |
| parent | 1ba6c53ea04e6c0d61423e3345178ab41ec5f98f (diff) | |
Fix confusion about what dcp_to_content_audio should be doing.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/player.cc | 12 | ||||
| -rw-r--r-- | src/lib/player.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index a289c3d92..bc13d6ab2 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -464,9 +464,9 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate) request = DCPTime (); } - BOOST_FOREACH (AudioStreamPtr j, content->audio_streams ()) { + Frame const content_frame = dcp_to_resampled_audio (*i, request); - Frame const content_frame = dcp_to_content_audio (*i, j, request); + BOOST_FOREACH (AudioStreamPtr j, content->audio_streams ()) { if (j->channels() == 0) { /* Some content (e.g. DCPs) can have streams with no channels */ @@ -536,11 +536,11 @@ Player::content_video_to_dcp (shared_ptr<const Piece> piece, Frame f) const } Frame -Player::dcp_to_content_audio (shared_ptr<const Piece> piece, AudioStreamPtr stream, DCPTime t) const +Player::dcp_to_resampled_audio (shared_ptr<const Piece> piece, DCPTime t) const { - DCPTime s = t - piece->content->position (); - s = min (piece->content->length_after_trim(), s); - return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start ()).frames (stream->frame_rate ()); + DCPTime s = t - piece->content->position () + DCPTime (piece->content->trim_start (), piece->frc); + s = max (DCPTime (), min (piece->content->length_after_trim(), s)); + return s.frames (_film->audio_frame_rate ()); } ContentTime diff --git a/src/lib/player.h b/src/lib/player.h index 9b2e27251..3cfca4736 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -122,7 +122,7 @@ private: void update_subtitle_from_text (); Frame dcp_to_content_video (boost::shared_ptr<const Piece> piece, DCPTime t) const; DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, Frame f) const; - Frame dcp_to_content_audio (boost::shared_ptr<const Piece> piece, AudioStreamPtr stream, DCPTime t) const; + Frame dcp_to_resampled_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const; ContentTime dcp_to_content_subtitle (boost::shared_ptr<const Piece> piece, DCPTime t) const; boost::shared_ptr<PlayerVideo> black_player_video_frame (DCPTime) const; |
