]> git.sesse.net Git - casparcg/blobdiff - core/video_format.h
[psd] Fixed wrong animation pace when interlaced video formats are used.
[casparcg] / core / video_format.h
index 9f2b52c79b524e043dfabf22493d29f85c87552e..44238b7bd66d3f5a160cb998abcd93a6a984fb06 100644 (file)
 
 #include <common/enum_class.h>
 
+#include <boost/rational.hpp>
+
 namespace caspar { namespace core {
-       
+
 enum class video_format
-{ 
-       pal,            
-       ntsc,           
-       x576p2500,      
-       x720p2500,      
+{
+       pal,
+       ntsc,
+       x576p2500,
+       x720p2500,
        x720p5000,
        x720p2398,
        x720p2400,
@@ -43,24 +45,33 @@ enum class video_format
        x720p3000,
        x720p6000,
        x1080p2398,
-       x1080p2400,     
-       x1080i5000,     
-       x1080i5994,     
-       x1080i6000,     
-       x1080p2500,     
-       x1080p2997,     
-       x1080p3000,     
+       x1080p2400,
+       x1080i5000,
+       x1080i5994,
+       x1080i6000,
+       x1080p2500,
+       x1080p2997,
+       x1080p3000,
        x1080p5000,
        x1080p5994,
        x1080p6000,
-       x2k2398,
-       x2k2400,
-       x2k2500,
-       x4k2398,
-       x4k2400,
-       x4k2500,
-       x4k2997,
-       x4k3000,
+       x1556p2398,
+       x1556p2400,
+       x1556p2500,
+       dci1080p2398,
+       dci1080p2400,
+       dci1080p2500,
+       x2160p2398,
+       x2160p2400,
+       x2160p2500,
+       x2160p2997,
+       x2160p3000,
+       x2160p5000,
+       x2160p5994,
+       x2160p6000,
+       dci2160p2398,
+       dci2160p2400,
+       dci2160p2500,
        invalid,
        count
 };
@@ -77,23 +88,23 @@ ENUM_ENABLE_BITWISE(field_mode);
 
 struct video_format_desc final
 {
-       video_format            format;         
-
-       int                                     width;          
-       int                                     height;         
-       int                                     square_width;
-       int                                     square_height;
-       field_mode                      field_mode;     // progressive, interlaced upper field first, interlaced lower field first
-       double                          fps;            // actual framerate = duration/time_scale, e.g. i50 = 25 fps, p50 = 50 fps
-       int                                     time_scale;
-       int                                     duration;
-       int                                     field_count;
-       std::size_t                     size;           // frame size in bytes 
-       std::wstring            name;           // name of output format
-
-       int                                     audio_sample_rate;
-       int                                     audio_channels;
-       std::vector<int>        audio_cadence;  // rotating optimal number of samples per frame
+       video_format                    format;
+
+       int                                             width;
+       int                                             height;
+       int                                             square_width;
+       int                                             square_height;
+       core::field_mode                field_mode;     // progressive, interlaced upper field first, interlaced lower field first
+       double                                  fps;            // actual framerate = duration/time_scale, e.g. i50 = 25 fps, p50 = 50 fps
+       boost::rational<int>    framerate;
+       int                                             time_scale;
+       int                                             duration;
+       int                                             field_count;
+       std::size_t                             size;           // frame size in bytes
+       std::wstring                    name;           // name of output format
+
+       int                                             audio_sample_rate;
+       std::vector<int>                audio_cadence;  // rotating optimal number of samples per frame
 
        video_format_desc(video_format format,
                                          int width,
@@ -105,7 +116,7 @@ struct video_format_desc final
                                          int duration,
                                          const std::wstring& name,
                                          const std::vector<int>& audio_cadence);
-               
+
        video_format_desc(video_format format = video_format::invalid);
        video_format_desc(const std::wstring& name);
 };
@@ -115,4 +126,6 @@ bool operator!=(const video_format_desc& rhs, const video_format_desc& lhs);
 
 std::wostream& operator<<(std::wostream& out, const video_format_desc& format_desc);
 
-}}
\ No newline at end of file
+std::vector<int> find_audio_cadence(const boost::rational<int>& framerate, bool log_quiet = false);
+
+}}