X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fvideo_content.h;h=ccc61b1f9eba3f15b7cc4521609642545874be45;hb=8167d04e4dde6297ad936dca5dc691818a4dae41;hp=8313c73eeb8a32b8d65a79e2caa6d22466966042;hpb=bb0a36c3a6bea9cd1ebdde7b8a3a04765e317569;p=dcpomatic.git diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 8313c73ee..ccc61b1f9 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -22,6 +22,7 @@ #include "content.h" #include "colour_conversion.h" +#include "video_content_scale.h" class VideoExaminer; class Ratio; @@ -35,51 +36,13 @@ public: static int const VIDEO_CROP; static int const VIDEO_SCALE; static int const COLOUR_CONVERSION; + static int const VIDEO_FADE_IN; + static int const VIDEO_FADE_OUT; }; -class VideoContentScale -{ -public: - VideoContentScale (); - VideoContentScale (Ratio const *); - VideoContentScale (bool); - VideoContentScale (cxml::NodePtr); - - dcp::Size size (boost::shared_ptr, dcp::Size, dcp::Size) const; - std::string id () const; - std::string name () const; - void as_xml (xmlpp::Node *) const; - - Ratio const * ratio () const { - return _ratio; - } - - bool scale () const { - return _scale; - } - - static void setup_scales (); - static std::vector all () { - return _scales; - } - -private: - /** a ratio to stretch the content to, or 0 for no stretch */ - Ratio const * _ratio; - /** true if we want to scale the content */ - bool _scale; - - static std::vector _scales; -}; - -bool operator== (VideoContentScale const & a, VideoContentScale const & b); -bool operator!= (VideoContentScale const & a, VideoContentScale const & b); - class VideoContent : public virtual Content { public: - typedef int Frame; - VideoContent (boost::shared_ptr); VideoContent (boost::shared_ptr, DCPTime, ContentTime); VideoContent (boost::shared_ptr, boost::filesystem::path); @@ -88,9 +51,10 @@ public: void as_xml (xmlpp::Node *) const; std::string technical_summary () const; - virtual std::string information () const; virtual std::string identifier () const; + virtual void set_default_colour_conversion (); + ContentTime video_length () const { boost::mutex::scoped_lock lm (_mutex); return _video_length; @@ -116,6 +80,7 @@ public: } void set_video_frame_type (VideoFrameType); + void set_video_frame_rate (float); void set_left_crop (int); void set_right_crop (int); @@ -123,7 +88,11 @@ public: void set_bottom_crop (int); void set_scale (VideoContentScale); + void unset_colour_conversion (bool signal = true); void set_colour_conversion (ColourConversion); + + void set_fade_in (ContentTime); + void set_fade_out (ContentTime); VideoFrameType video_frame_type () const { boost::mutex::scoped_lock lm (_mutex); @@ -161,27 +130,50 @@ public: return _scale; } - ColourConversion colour_conversion () const { + boost::optional colour_conversion () const { boost::mutex::scoped_lock lm (_mutex); return _colour_conversion; } + boost::optional sample_aspect_ratio () const { + boost::mutex::scoped_lock lm (_mutex); + return _sample_aspect_ratio; + } + + ContentTime fade_in () const { + boost::mutex::scoped_lock lm (_mutex); + return _fade_in; + } + + ContentTime fade_out () const { + boost::mutex::scoped_lock lm (_mutex); + return _fade_out; + } + dcp::Size video_size_after_3d_split () const; dcp::Size video_size_after_crop () const; ContentTime dcp_time_to_content_time (DCPTime) const; + boost::optional fade (VideoFrame) const; + + void scale_and_crop_to_fit_width (); + void scale_and_crop_to_fit_height (); + + std::string processing_description () const; + protected: void take_from_video_examiner (boost::shared_ptr); ContentTime _video_length; float _video_frame_rate; + boost::optional _colour_conversion; private: - friend class ffmpeg_pts_offset_test; - friend class best_dcp_frame_rate_test_single; - friend class best_dcp_frame_rate_test_double; - friend class audio_sampling_rate_test; + friend struct ffmpeg_pts_offset_test; + friend struct best_dcp_frame_rate_test_single; + friend struct best_dcp_frame_rate_test_double; + friend struct audio_sampling_rate_test; void setup_default_colour_conversion (); @@ -189,7 +181,12 @@ private: VideoFrameType _video_frame_type; Crop _crop; VideoContentScale _scale; - ColourConversion _colour_conversion; + /** Sample aspect ratio obtained from the content file's header, + if there is one. + */ + boost::optional _sample_aspect_ratio; + ContentTime _fade_in; + ContentTime _fade_out; }; #endif