]> git.sesse.net Git - casparcg/blobdiff - test/mock/mock_frame_producer.h
2.0.0.2:
[casparcg] / test / mock / mock_frame_producer.h
index 0f8eded66dcf41895fa12abe78f9b527525f3df6..8c8b551ebff1080c6d0f820e28d040462d089238 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once\r
 \r
-#include <core/frame/gpu_frame.h>\r
+#include "mock_frame.h"\r
+\r
 #include <core/producer/frame_producer.h>\r
 #include <common/exception/exceptions.h>\r
 \r
@@ -11,7 +12,8 @@ class mock_frame_producer : public frame_producer
 {\r
 public:\r
        mock_frame_producer(bool null = false, bool throws = false) \r
-               : null_(null), throws_(throws){}\r
+               : null_(null), throws_(throws), initialized_(false), volume_(100){}\r
+       void set_volume(short volume) { volume_ = volume;}\r
        gpu_frame_ptr get_frame()\r
        { \r
                if(throws_)\r
@@ -19,7 +21,7 @@ public:
                if(leading_)\r
                        return leading_->get_frame();\r
                if(!null_)\r
-                       return std::make_shared<gpu_frame>(0, 0);\r
+                       return std::make_shared<mock_frame>(this, volume_);\r
                return nullptr;\r
        }\r
        std::shared_ptr<frame_producer> get_following_producer() const \r
@@ -32,12 +34,16 @@ public:
                return format;\r
        }\r
        void initialize(const frame_factory_ptr& factory)\r
-       {}\r
+       {initialized_ = true;}\r
        void set_following_producer(const std::shared_ptr<frame_producer>& following)\r
        {following_ = following;}\r
+\r
+       bool is_initialized() const { return initialized_;}\r
 private:\r
        std::shared_ptr<frame_producer> following_;\r
        std::shared_ptr<frame_producer> leading_;\r
        bool null_;\r
        bool throws_;\r
+       bool initialized_;\r
+       short volume_;\r
 };
\ No newline at end of file