diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-06-23 00:58:23 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-06-23 00:58:23 +0200 |
| commit | dc9269b658819ecbe35060fffe176137e613a252 (patch) | |
| tree | ec73dfdc4045b6308811c2cc2b626306955bcff9 | |
| parent | ade7cc821117c2c81321a6503bbef3bac61d6fa1 (diff) | |
Some more piece layer stuff.
| -rw-r--r-- | src/lib/piece.cc | 51 | ||||
| -rw-r--r-- | src/lib/piece.h | 8 | ||||
| -rw-r--r-- | src/lib/player.cc | 19 |
3 files changed, 67 insertions, 11 deletions
diff --git a/src/lib/piece.cc b/src/lib/piece.cc index 57e00334b..84d0968c2 100644 --- a/src/lib/piece.cc +++ b/src/lib/piece.cc @@ -19,10 +19,12 @@ */ +#include "audio_content.h" #include "film.h" #include "piece.h" +using boost::optional; using boost::shared_ptr; using namespace dcpomatic; @@ -88,3 +90,52 @@ Piece::dcp_to_content_time (shared_ptr<const Film> film, DCPTime t) const return max(ContentTime(), ContentTime(s, frc) + content->trim_start()); } + +bool +Piece::video_use () const +{ + return content->video->use(); +} + + +optional<double> +Piece::video_fade (shared_ptr<const Film> film, Frame frame) const +{ + return content->video->fade (film, frame); +} + + +dcp::Size +Piece::video_scaled_size (dcp::Size container_size) +{ + return content->video->scaled_size(container_size); +} + + +optional<ColourConversion> +Piece::video_colour_conversion () const +{ + return content->video->colour_conversion(); +} + + +VideoRange +Piece::video_range () const +{ + return content->video->range(); +} + + +int +Piece::audio_resampled_frame_rate (boost::shared_ptr<const Film> film) const +{ + return content->audio->resampled_frame_rate (film); +} + + +double +Piece::audio_gain () const +{ + return content->audio->gain(); +} + diff --git a/src/lib/piece.h b/src/lib/piece.h index aa67316f1..dd7867227 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -48,6 +48,14 @@ public: dcpomatic::ContentTime dcp_to_content_time (boost::shared_ptr<const Film> film, dcpomatic::DCPTime t) const; Crop video_crop () const; + bool video_use () const; + boost::optional<double> video_fade (boost::shared_ptr<const Film> film, Frame frame) const; + dcp::Size video_scaled_size (dcp::Size container_size); + boost::optional<ColourConversion> video_colour_conversion () const; + VideoRange video_range () const; + + int audio_resampled_frame_rate (boost::shared_ptr<const Film> film) const; + double audio_gain () const; boost::shared_ptr<Content> content; boost::shared_ptr<Decoder> decoder; diff --git a/src/lib/player.cc b/src/lib/player.cc index 9630e6a9c..0cf47263d 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -741,7 +741,7 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video) return; } - if (!piece->content->video->use()) { + if (!piece->video_use()) { return; } @@ -816,13 +816,13 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video) new PlayerVideo ( video.image, piece->video_crop(), - piece->content->video->fade (_film, video.frame), - scale_for_display(piece->content->video->scaled_size(_film->frame_size()), _video_container_size, _film->frame_size()), + piece->video_fade(_film, video.frame), + scale_for_display(piece->video_scaled_size(_film->frame_size()), _video_container_size, _film->frame_size()), _video_container_size, video.eyes, video.part, - piece->content->video->colour_conversion(), - piece->content->video->range(), + piece->video_colour_conversion(), + piece->video_range(), piece->content, video.frame, false @@ -848,10 +848,7 @@ Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_a return; } - shared_ptr<AudioContent> content = piece->content->audio; - DCPOMATIC_ASSERT (content); - - int const rfr = content->resampled_frame_rate (_film); + int const rfr = piece->audio_resampled_frame_rate (_film); /* Compute time in the DCP */ DCPTime time = piece->resampled_audio_to_dcp (_film, content_audio.frame); @@ -882,9 +879,9 @@ Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_a /* Gain */ - if (content->gain() != 0) { + if (piece->audio_gain() != 0) { shared_ptr<AudioBuffers> gain (new AudioBuffers (content_audio.audio)); - gain->apply_gain (content->gain ()); + gain->apply_gain (piece->audio_gain()); content_audio.audio = gain; } |
