Add Piece::resampled_audio_frame_rate().
[dcpomatic.git] / src / lib / piece.cc
index fb9289dbb62fdd1a6a52abcc0137aa2a05803e06..2a4f012689eafc19798978d11fb722ba0ba11cdd 100644 (file)
 #include "content.h"
 #include "film.h"
 #include "piece.h"
+#include "player_video.h"
 #include "video_content.h"
 
 
 using std::shared_ptr;
+using std::make_shared;
 using namespace dcpomatic;
 
 
@@ -126,3 +128,31 @@ Piece::end (shared_ptr<const Film> film) const
        return content->end (film);
 }
 
+
+shared_ptr<PlayerVideo>
+Piece::player_video (ContentVideo video, shared_ptr<const Film> film, dcp::Size container_size) const
+{
+       return std::make_shared<PlayerVideo>(
+               video.image,
+               content->video->crop (),
+               content->video->fade (film, video.frame),
+               scale_for_display(content->video->scaled_size(film->frame_size()), container_size, film->frame_size()),
+               container_size,
+               video.eyes,
+               video.part,
+               content->video->colour_conversion(),
+               content->video->range(),
+               content,
+               video.frame,
+               false
+               );
+}
+
+
+int
+Piece::resampled_audio_frame_rate (shared_ptr<const Film> film) const
+{
+       DCPOMATIC_ASSERT (content->audio);
+       return content->audio->resampled_frame_rate (film);
+}
+