#include "output.h"\r
\r
#include "frame_consumer.h"\r
+#include "port.h"\r
\r
#include "../video_format.h"\r
#include "../frame/frame.h"\r
#include <boost/timer.hpp>\r
\r
namespace caspar { namespace core {\r
- \r
-class port : public monitor::observable\r
-{\r
- port(const port&);\r
- port& operator=(const port&);\r
-\r
- monitor::basic_subject event_subject_;\r
- std::shared_ptr<frame_consumer> consumer_;\r
- int index_;\r
- int channel_index_;\r
-public:\r
- port(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer)\r
- : event_subject_(monitor::path("port") % index)\r
- , consumer_(std::move(consumer))\r
- , index_(index)\r
- , channel_index_(channel_index)\r
- {\r
- consumer_->subscribe(event_subject_);\r
- }\r
-\r
- port(port&& other)\r
- : event_subject_(std::move(other.event_subject_))\r
- , consumer_(std::move(other.consumer_))\r
- , index_(other.index_)\r
- , channel_index_(other.channel_index_)\r
- {\r
- }\r
-\r
- port& operator=(port&& other)\r
- {\r
- event_subject_ = std::move(other.event_subject_);\r
- consumer_ = std::move(other.consumer_);\r
- index_ = std::move(other.index_);\r
- channel_index_ = std::move(other.channel_index_);\r
- }\r
-\r
- void video_format_desc(const struct video_format_desc& format_desc)\r
- {\r
- consumer_->initialize(format_desc, channel_index_);\r
- }\r
- \r
- bool send(class const_frame frame)\r
- {\r
- event_subject_ << monitor::event("type") % consumer_->name();\r
- return consumer_->send(frame);\r
- }\r
- \r
- int index() const\r
- {\r
- return index_;\r
- }\r
-\r
- int buffer_depth() const\r
- {\r
- return consumer_->buffer_depth();\r
- }\r
-\r
- bool has_synchronization_clock() const\r
- {\r
- return consumer_->has_synchronization_clock();\r
- }\r
-\r
- boost::property_tree::wptree info() const\r
- {\r
- return consumer_->info();\r
- }\r
-\r
- void subscribe(const monitor::observable::observer_ptr& o) override\r
- {\r
- event_subject_.subscribe(o);\r
- }\r
-\r
- void unsubscribe(const monitor::observable::observer_ptr& o) override\r
- {\r
- event_subject_.unsubscribe(o);\r
- } \r
-};\r
\r
struct output::impl\r
{ \r
return std::move(executor_.begin_invoke([&]() -> boost::property_tree::wptree\r
{ \r
boost::property_tree::wptree info;\r
- BOOST_FOREACH(auto& port, ports_ | boost::adaptors::map_values)\r
+ BOOST_FOREACH(auto& port, ports_)\r
{\r
- info.add_child(L"consumers.consumer", port.info())\r
- .add(L"index", port.index()); \r
+ info.add_child(L"consumers.consumer", port.second.info())\r
+ .add(L"index", port.first); \r
}\r
return info;\r
}, task_priority::high_priority));\r
--- /dev/null
+#include "../StdAfx.h"\r
+\r
+#include "port.h"\r
+\r
+#include "frame_consumer.h"\r
+#include "../frame/frame.h"\r
+\r
+namespace caspar { namespace core {\r
+\r
+struct port::impl\r
+{\r
+ monitor::basic_subject event_subject_;\r
+ std::shared_ptr<frame_consumer> consumer_;\r
+ int index_;\r
+ int channel_index_;\r
+public:\r
+ impl(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer)\r
+ : event_subject_(monitor::path("port") % index)\r
+ , consumer_(std::move(consumer))\r
+ , index_(index)\r
+ , channel_index_(channel_index)\r
+ {\r
+ consumer_->subscribe(event_subject_);\r
+ }\r
+ \r
+ void video_format_desc(const struct video_format_desc& format_desc)\r
+ {\r
+ consumer_->initialize(format_desc, channel_index_);\r
+ }\r
+ \r
+ bool send(const_frame frame)\r
+ {\r
+ event_subject_ << monitor::event("type") % consumer_->name();\r
+ return consumer_->send(std::move(frame));\r
+ }\r
+ \r
+ int index() const\r
+ {\r
+ return index_;\r
+ }\r
+\r
+ int buffer_depth() const\r
+ {\r
+ return consumer_->buffer_depth();\r
+ }\r
+\r
+ bool has_synchronization_clock() const\r
+ {\r
+ return consumer_->has_synchronization_clock();\r
+ }\r
+\r
+ boost::property_tree::wptree info() const\r
+ {\r
+ return consumer_->info();\r
+ }\r
+};\r
+\r
+port::port(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer) : impl_(new impl(index, channel_index, std::move(consumer))){}\r
+port::port(port&& other) : impl_(std::move(other.impl_)){}\r
+port::~port(){}\r
+port& port::operator=(port&& other){impl_ = std::move(other.impl_); return *this;}\r
+bool port::send(const_frame frame){return impl_->send(std::move(frame));} \r
+void port::subscribe(const monitor::observable::observer_ptr& o){impl_->event_subject_.subscribe(o);}\r
+void port::unsubscribe(const monitor::observable::observer_ptr& o){impl_->event_subject_.unsubscribe(o);}\r
+void port::video_format_desc(const struct video_format_desc& format_desc){impl_->video_format_desc(format_desc);}\r
+int port::buffer_depth() const{return impl_->buffer_depth();}\r
+bool port::has_synchronization_clock() const{return impl_->has_synchronization_clock();}\r
+boost::property_tree::wptree port::info() const{return impl_->info();}\r
+}}
\ No newline at end of file
--- /dev/null
+#pragma once\r
+\r
+#include "../monitor/monitor.h"\r
+\r
+#include <common/memory.h>\r
+\r
+#include <boost/property_tree/ptree_fwd.hpp>\r
+\r
+namespace caspar { namespace core {\r
+\r
+class port : public monitor::observable\r
+{\r
+ port(const port&);\r
+ port& operator=(const port&);\r
+public:\r
+\r
+ // Static Members\r
+\r
+ // Constructors\r
+\r
+ port(int index, int channel_index, spl::shared_ptr<class frame_consumer> consumer);\r
+ port(port&& other);\r
+ ~port();\r
+\r
+ // Member Functions\r
+\r
+ port& operator=(port&& other);\r
+\r
+ bool send(class const_frame frame); \r
+\r
+ // monitor::observable\r
+ \r
+ void subscribe(const monitor::observable::observer_ptr& o) override;\r
+ void unsubscribe(const monitor::observable::observer_ptr& o) override;\r
+\r
+ // Properties\r
+\r
+ void video_format_desc(const struct video_format_desc& format_desc);\r
+ int buffer_depth() const;\r
+ bool has_synchronization_clock() const;\r
+ boost::property_tree::wptree info() const;\r
+private:\r
+ struct impl;\r
+ std::unique_ptr<impl> impl_;\r
+};\r
+\r
+}}
\ No newline at end of file
</Lib>\r
</ItemDefinitionGroup>\r
<ItemGroup>\r
+ <ClInclude Include="consumer\port.h" />\r
<ClInclude Include="frame\draw_frame.h" />\r
<ClInclude Include="frame\frame.h" />\r
<ClInclude Include="frame\frame_factory.h" />\r
<ClInclude Include="StdAfx.h" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <ClCompile Include="consumer\port.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
<ClCompile Include="frame\frame.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<ClInclude Include="frame\frame.h">\r
<Filter>source\frame</Filter>\r
</ClInclude>\r
+ <ClInclude Include="consumer\port.h">\r
+ <Filter>source\consumer</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="producer\transition\transition_producer.cpp">\r
<ClCompile Include="frame\frame.cpp">\r
<Filter>source\frame</Filter>\r
</ClCompile>\r
+ <ClCompile Include="consumer\port.cpp">\r
+ <Filter>source\consumer</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
</Project>
\ No newline at end of file