]> git.sesse.net Git - casparcg/commitdiff
Added boost::rational framerate in video_format_desc for convenience.
authorHelge Norberg <helge.norberg@svt.se>
Tue, 27 Sep 2016 15:46:47 +0000 (17:46 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Tue, 27 Sep 2016 15:46:47 +0000 (17:46 +0200)
core/video_format.cpp
core/video_format.h

index b58e1f199a968d9bcb565a5600ee87211ea6fc85..30db1e3fc259b1896e458c68c5ceb0a9f9c566e1 100644 (file)
@@ -85,6 +85,7 @@ video_format_desc::video_format_desc(
        , square_height(square_height)
        , field_mode(field_mode)
        , fps(static_cast<double>(time_scale) / static_cast<double>(duration))
+       , framerate(time_scale, duration)
        , time_scale(time_scale)
        , duration(duration)
        , field_count(field_mode == core::field_mode::progressive ? 1 : 2)
index 90ff1f806ecd640a55ade16b7dc0796206e603bc..0016f2d24b47449a20db02b235e498d9066775ee 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <common/enum_class.h>
 
+#include <boost/rational.hpp>
+
 namespace caspar { namespace core {
        
 enum class video_format
@@ -83,22 +85,23 @@ ENUM_ENABLE_BITWISE(field_mode);
 
 struct video_format_desc final
 {
-       video_format            format;         
+       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
-       int                                     time_scale;
-       int                                     duration;
-       int                                     field_count;
-       std::size_t                     size;           // frame size in bytes 
-       std::wstring            name;           // name of output 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
+       int                                             audio_sample_rate;
+       std::vector<int>                audio_cadence;  // rotating optimal number of samples per frame
 
        video_format_desc(video_format format,
                                          int width,