]> git.sesse.net Git - casparcg/blobdiff - core/frame/draw_frame.cpp
[main] added missing include
[casparcg] / core / frame / draw_frame.cpp
index a986f7c54173649a3fe1a46cb4cbbbc0ba609ed2..7284a8d7e5748d144433a7f5b65beab8d5e115ec 100644 (file)
 * Author: Robert Nagy, ronag89@gmail.com
 */
 
-#include "../stdafx.h"
+#include "../StdAfx.h"
 
 #include "draw_frame.h"
-
 #include "frame.h"
-
 #include "frame_transform.h"
 
 namespace caspar { namespace core {
@@ -41,7 +39,7 @@ struct draw_frame::impl
 {              
        std::shared_ptr<const_frame>    frame_;
        std::vector<draw_frame>                 frames_;
-       core::frame_transform                   frame_transform_;               
+       core::frame_transform                   frame_transform_;
 public:                
 
        impl()
@@ -91,6 +89,22 @@ public:
                                frame_                          == other.frame_ &&
                                frame_transform_        == other.frame_transform_;
        }
+
+       int64_t get_and_record_age_millis(const draw_frame& self)
+       {
+               int64_t result = 0;
+
+               for (auto& frame : frames_)
+               {
+                       if (frame != self)
+                               result = std::max(result, frame.get_and_record_age_millis());
+               }
+
+               if (frame_)
+                       result = std::max(result, frame_->get_age_millis());
+
+               return result;
+       }
 };
        
 draw_frame::draw_frame() : impl_(new impl()){}
@@ -110,6 +124,7 @@ void draw_frame::swap(draw_frame& other){impl_.swap(other.impl_);}
 const core::frame_transform& draw_frame::transform() const { return impl_->frame_transform_;}
 core::frame_transform& draw_frame::transform() { return impl_->frame_transform_;}
 void draw_frame::accept(frame_visitor& visitor) const{impl_->accept(visitor);}
+int64_t draw_frame::get_and_record_age_millis() { return impl_->get_and_record_age_millis(*this); }
 bool draw_frame::operator==(const draw_frame& other)const{return *impl_ == *other.impl_;}
 bool draw_frame::operator!=(const draw_frame& other)const{return !(*this == other);}
 
@@ -174,8 +189,8 @@ draw_frame late_frame(const_frame(0));
 
 draw_frame draw_frame::still(draw_frame frame)
 {
-       frame.transform().image_transform.is_still      = true; 
-       frame.transform().audio_transform.is_still      = true;         
+       frame.transform().image_transform.is_still = true;      
+       frame.transform().audio_transform.is_still = true;              
        return frame;
 }
 
@@ -190,4 +205,4 @@ const draw_frame& draw_frame::late()
 }
        
 
-}}
\ No newline at end of file
+}}