3 #include "mock_frame.h"
\r
5 #include <core/producer/frame_producer.h>
\r
6 #include <common/exception/exceptions.h>
\r
8 using namespace caspar;
\r
9 using namespace caspar::core;
\r
11 class mock_frame_producer : public frame_producer
\r
14 mock_frame_producer(bool null = false, bool throws = false)
\r
15 : null_(null), throws_(throws), initialized_(false), volume_(100){}
\r
16 void set_volume(short volume) { volume_ = volume;}
\r
17 gpu_frame_ptr get_frame()
\r
20 BOOST_THROW_EXCEPTION(caspar_exception());
\r
22 return leading_->get_frame();
\r
24 return std::make_shared<mock_frame>(this, volume_);
\r
27 std::shared_ptr<frame_producer> get_following_producer() const
\r
28 { return following_; }
\r
29 void set_leading_producer(const std::shared_ptr<frame_producer>& leading)
\r
30 { leading_ = leading; }
\r
31 const frame_format_desc& get_frame_format_desc() const
\r
33 static frame_format_desc format;
\r
36 void initialize(const frame_factory_ptr& factory)
\r
37 {initialized_ = true;}
\r
38 void set_following_producer(const std::shared_ptr<frame_producer>& following)
\r
39 {following_ = following;}
\r
41 bool is_initialized() const { return initialized_;}
\r
43 std::shared_ptr<frame_producer> following_;
\r
44 std::shared_ptr<frame_producer> leading_;
\r