X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fvideo_content.h;h=ccc61b1f9eba3f15b7cc4521609642545874be45;hb=8167d04e4dde6297ad936dca5dc691818a4dae41;hp=27b36e9bc65ed73358ae36ef2da2adb32c607f77;hpb=c39979ef676b49e97129c5f29c2e2c700fdc1d3a;p=dcpomatic.git diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 27b36e9bc..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, int round) 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; @@ -124,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); @@ -162,24 +130,44 @@ 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 struct ffmpeg_pts_offset_test; @@ -193,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