]> git.sesse.net Git - casparcg/commitdiff
2.1.0: - frame_producer: Refactored. -cg_producer: Refactored. Remade into simply...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 6 Feb 2012 21:00:57 +0000 (21:00 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 6 Feb 2012 21:00:57 +0000 (21:00 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2282 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

21 files changed:
core/producer/color/color_producer.cpp
core/producer/frame_producer.cpp
core/producer/frame_producer.h
core/producer/layer.cpp
core/producer/separated/separated_producer.cpp
core/producer/transition/transition_producer.cpp
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/flash/flash.cpp
modules/flash/flash.vcxproj
modules/flash/flash.vcxproj.filters
modules/flash/producer/cg_proxy.cpp [moved from modules/flash/producer/cg_producer.cpp with 57% similarity]
modules/flash/producer/cg_proxy.h [moved from modules/flash/producer/cg_producer.h with 66% similarity]
modules/flash/producer/flash_producer.cpp
modules/image/producer/image_producer.cpp
modules/image/producer/image_scroll_producer.cpp
modules/reroute/producer/reroute_producer.cpp
protocol/amcp/AMCPCommandsImpl.cpp
protocol/cii/CIICommandsImpl.cpp
protocol/clk/CLKProtocolStrategy.cpp
shell/casparcg.config

index e6e7115a8e114f92756f73c0bc93098506ac92a5..f414d971f01e5bfc365e04e6c73783a28202aafc 100644 (file)
@@ -124,7 +124,7 @@ spl::shared_ptr<frame_producer> create_color_producer(const spl::shared_ptr<fram
        if(color2.length() != 9 || color2[0] != '#')\r
                return core::frame_producer::empty();\r
 \r
-       return spl::make_shared<color_producer>(frame_factory, color2);\r
+       return core::wrap_producer(spl::make_shared<color_producer>(frame_factory, color2));\r
 }\r
 spl::shared_ptr<write_frame> create_color_frame(void* tag, const spl::shared_ptr<frame_factory>& frame_factory, const std::wstring& color)\r
 {\r
index 8ab9184154540b842b05b870a55dc547cb34a7e8..77f8d25e72346a396d8b3cd1d5301b2126317650 100644 (file)
@@ -39,6 +39,11 @@ namespace caspar { namespace core {
        \r
 std::vector<const producer_factory_t> g_factories;\r
 \r
+void register_producer_factory(const producer_factory_t& factory)\r
+{\r
+       g_factories.push_back(factory);\r
+}\r
+\r
 boost::unique_future<std::wstring> frame_producer::call(const std::wstring&) \r
 {\r
        BOOST_THROW_EXCEPTION(not_supported());\r
@@ -66,29 +71,6 @@ const spl::shared_ptr<frame_producer>& frame_producer::empty() // nothrow
        return producer;\r
 }      \r
 \r
-spl::shared_ptr<draw_frame> receive_and_follow(spl::shared_ptr<frame_producer>& producer, int hints)\r
-{      \r
-       auto frame = producer->receive(hints);\r
-       if(frame == draw_frame::eof())\r
-       {\r
-               CASPAR_LOG(info) << producer->print() << " End Of File.";\r
-               auto following = producer->get_following_producer();\r
-               if(following != frame_producer::empty())\r
-               {\r
-                       following->set_leading_producer(producer);\r
-                       producer = std::move(following);\r
-               }\r
-\r
-               return receive_and_follow(producer, hints);\r
-       }\r
-       return frame;\r
-}\r
-\r
-void register_producer_factory(const producer_factory_t& factory)\r
-{\r
-       g_factories.push_back(factory);\r
-}\r
-\r
 class destroy_producer_proxy : public frame_producer\r
 {      \r
        std::unique_ptr<std::shared_ptr<frame_producer>> producer_;\r
@@ -165,6 +147,50 @@ public:
        virtual uint32_t                                                                                        nb_frames() const override                                                                                                              {return producer_->nb_frames();}\r
 };\r
 \r
+class follow_producer_proxy : public frame_producer\r
+{      \r
+       spl::shared_ptr<frame_producer> producer_;\r
+public:\r
+       follow_producer_proxy(spl::shared_ptr<frame_producer>&& producer) \r
+               : producer_(std::move(producer))\r
+       {\r
+       }\r
+\r
+       virtual spl::shared_ptr<draw_frame>     receive(int hints) override                                                                                                             \r
+       {\r
+               auto frame = producer_->receive(hints);\r
+               if(frame == draw_frame::eof())\r
+               {\r
+                       CASPAR_LOG(info) << producer_->print() << " End Of File.";\r
+                       auto following = producer_->get_following_producer();\r
+                       if(following != frame_producer::empty())\r
+                       {\r
+                               following->set_leading_producer(producer_);\r
+                               producer_ = std::move(following);\r
+                       }\r
+\r
+                       return receive(hints);\r
+               }\r
+               return frame;\r
+       }\r
+\r
+       virtual spl::shared_ptr<draw_frame>                                                     last_frame() const override                                                                                                             {return producer_->last_frame();}\r
+       virtual std::wstring                                                                            print() const override                                                                                                                  {return producer_->print();}\r
+       virtual boost::property_tree::wptree                                            info() const override                                                                                                                   {return producer_->info();}\r
+       virtual boost::unique_future<std::wstring>                                      call(const std::wstring& str) override                                                                                  {return producer_->call(str);}\r
+       virtual spl::shared_ptr<frame_producer>                                         get_following_producer() const override                                                                                 {return producer_->get_following_producer();}\r
+       virtual void                                                                                            set_leading_producer(const spl::shared_ptr<frame_producer>& producer) override  {return producer_->set_leading_producer(producer);}\r
+       virtual uint32_t                                                                                        nb_frames() const override                                                                                                              {return producer_->nb_frames();}\r
+};\r
+\r
+spl::shared_ptr<core::frame_producer> wrap_producer(spl::shared_ptr<core::frame_producer> producer)\r
+{\r
+       return spl::make_shared<follow_producer_proxy>(\r
+                       spl::make_shared<destroy_producer_proxy>(\r
+                        spl::make_shared<print_producer_proxy>(\r
+                         std::move(producer))));\r
+}\r
+\r
 spl::shared_ptr<core::frame_producer> do_create_producer(const spl::shared_ptr<frame_factory>& my_frame_factory, const std::vector<std::wstring>& params)\r
 {\r
        if(params.empty())\r
@@ -190,9 +216,7 @@ spl::shared_ptr<core::frame_producer> do_create_producer(const spl::shared_ptr<f
        if(producer == frame_producer::empty())\r
                return producer;\r
                \r
-       return spl::make_shared<destroy_producer_proxy>(\r
-                       spl::make_shared<print_producer_proxy>(\r
-                        std::move(producer)));\r
+       return producer;\r
 }\r
 \r
 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<frame_factory>& my_frame_factory, const std::vector<std::wstring>& params)\r
index 7b364acee9c4e5eea2f97246a8008ad375b6498f..48f7bc72fe588c139e4fb35107ff28368f3a4dd1 100644 (file)
@@ -71,12 +71,12 @@ struct frame_producer : boost::noncopyable
        static const spl::shared_ptr<frame_producer>& empty(); // nothrow\r
 };\r
 \r
-spl::shared_ptr<class draw_frame> receive_and_follow(spl::shared_ptr<frame_producer>& producer, int flags);\r
-\r
 typedef std::function<spl::shared_ptr<core::frame_producer>(const spl::shared_ptr<struct frame_factory>&, const std::vector<std::wstring>&)> producer_factory_t;\r
 void register_producer_factory(const producer_factory_t& factory); // Not thread-safe.\r
 \r
 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<frame_factory>&, const std::vector<std::wstring>& params);\r
 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<frame_factory>&, const std::wstring& params);\r
+\r
+spl::shared_ptr<core::frame_producer> wrap_producer(spl::shared_ptr<core::frame_producer> producer);\r
                \r
 }}\r
index 136696148c115b806ae944d61d5825e5be51a7f2..ef901b0bd5ebb37cdf5fa6e9eb2b1eecc967d55b 100644 (file)
@@ -99,7 +99,7 @@ public:
                        if(is_paused_)\r
                                return draw_frame::mute(foreground_->last_frame());\r
                \r
-                       auto frame = receive_and_follow(foreground_, flags.value());\r
+                       auto frame = foreground_->receive(flags.value());\r
                        if(frame == core::draw_frame::late())\r
                                return draw_frame::mute(foreground_->last_frame());\r
                        \r
index 5636bdb32d44bc10a28f5c5102ae556527ee3f28..0f39b0800ea95cbba3159a9e5d33d9812d7f7368 100644 (file)
@@ -55,12 +55,12 @@ struct separated_producer : public frame_producer
                [&]\r
                {\r
                        if(fill_ == core::draw_frame::late())\r
-                               fill_ = receive_and_follow(fill_producer_, flags);\r
+                               fill_ = fill_producer_->receive(flags);\r
                },\r
                [&]\r
                {\r
                        if(key_ == core::draw_frame::late())\r
-                               key_ = receive_and_follow(key_producer_, flags | frame_producer::flags::alpha_only);\r
+                               key_ = key_producer_->receive(flags | frame_producer::flags::alpha_only);\r
                });\r
 \r
                if(fill_ == draw_frame::eof() || key_ == draw_frame::eof())\r
@@ -104,7 +104,7 @@ struct separated_producer : public frame_producer
 \r
 spl::shared_ptr<frame_producer> create_separated_producer(const spl::shared_ptr<frame_producer>& fill, const spl::shared_ptr<frame_producer>& key)\r
 {\r
-       return spl::make_shared<separated_producer>(fill, key);\r
+       return core::wrap_producer(spl::make_shared<separated_producer>(fill, key));\r
 }\r
 \r
 }}\r
index f6ab65e7df78c9b830770a5d52fb424f942bfa09..c6332e6f874ade318f316331aee3e5a1819883dd 100644 (file)
@@ -74,13 +74,13 @@ struct transition_producer : public frame_producer
                tbb::parallel_invoke(\r
                [&]\r
                {\r
-                       dest = receive_and_follow(dest_producer_, flags);\r
+                       dest = dest_producer_->receive(flags);\r
                        if(dest == core::draw_frame::late())\r
                                dest = dest_producer_->last_frame();\r
                },\r
                [&]\r
                {\r
-                       source = receive_and_follow(source_producer_, flags);\r
+                       source = source_producer_->receive(flags);\r
                        if(source == core::draw_frame::late())\r
                                source = source_producer_->last_frame();\r
                });\r
@@ -176,7 +176,7 @@ struct transition_producer : public frame_producer
 \r
 spl::shared_ptr<frame_producer> create_transition_producer(const field_mode& mode, const spl::shared_ptr<frame_producer>& destination, const transition_info& info)\r
 {\r
-       return spl::make_shared<transition_producer>(mode, destination, info);\r
+       return core::wrap_producer(spl::make_shared<transition_producer>(mode, destination, info));\r
 }\r
 \r
 }}\r
index a816a136433c82917ed99a16f0274b28c55ccc37..b0adec90df62e0307d65896b8989174714222af9 100644 (file)
@@ -343,7 +343,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        if(format_desc.format == core::video_format::invalid)\r
                format_desc = frame_factory->get_video_format_desc();\r
                        \r
-       return spl::make_shared<decklink_producer_proxy>(frame_factory, format_desc, device_index, filter_str, length);\r
+       return core::wrap_producer(spl::make_shared<decklink_producer_proxy>(frame_factory, format_desc, device_index, filter_str, length));\r
 }\r
 \r
 }}
\ No newline at end of file
index b19ebb885d7961971dee696455f7dbfba1b60440..37a355c31127caf1148c4fd92cf76dee2075de83 100644 (file)
@@ -322,7 +322,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        boost::replace_all(filter_str, L"DEINTERLACE", L"YADIF=0:-1");\r
        boost::replace_all(filter_str, L"DEINTERLACE_BOB", L"YADIF=1:-1");\r
        \r
-       return spl::make_shared<ffmpeg_producer>(frame_factory, filename, filter_str, loop, start, length);\r
+       return core::wrap_producer(spl::make_shared<ffmpeg_producer>(frame_factory, filename, filter_str, loop, start, length));\r
 }\r
 \r
 }}
\ No newline at end of file
index 8c072b7b8bd455fc29b22ab45226af6b9aaa4b0a..4e3d35dc31d227a371c443195d67eb54827e3064 100644 (file)
@@ -23,7 +23,7 @@
 \r
 #include "flash.h"\r
 \r
-#include "producer/cg_producer.h"\r
+#include "producer/cg_proxy.h"\r
 #include "producer/flash_producer.h"\r
 \r
 #include <common/env.h>\r
@@ -33,7 +33,6 @@ namespace caspar { namespace flash {
 void init()\r
 {\r
        core::register_producer_factory(create_ct_producer);\r
-       core::register_producer_factory(create_cg_producer);\r
 }\r
 \r
 std::wstring get_cg_version()\r
index c091e2f2d7df6fb9be72ca1ec1aa1abf29ecaae3..be5024c2fc6b53862463fc9482b2af86f0466f6c 100644 (file)
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>\r
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>\r
     </ClCompile>\r
-    <ClCompile Include="producer\cg_producer.cpp">\r
+    <ClCompile Include="producer\cg_proxy.cpp">\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
     </ClCompile>\r
     <ClInclude Include="flash.h" />\r
     <ClInclude Include="interop\axflash.h" />\r
     <ClInclude Include="interop\TimerHelper.h" />\r
-    <ClInclude Include="producer\cg_producer.h" />\r
+    <ClInclude Include="producer\cg_proxy.h" />\r
     <ClInclude Include="producer\FlashAxContainer.h" />\r
     <ClInclude Include="producer\flash_producer.h" />\r
     <ClInclude Include="StdAfx.h" />\r
index 4d5c878807c72887a28947550a7322dae4818083..eadfbce87cfc7bf90578f6b8fe910d702c8f61db 100644 (file)
@@ -29,9 +29,6 @@
     <ClCompile Include="producer\FlashAxContainer.cpp">\r
       <Filter>source\producer</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="producer\cg_producer.cpp">\r
-      <Filter>source\producer</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="StdAfx.cpp" />\r
     <ClCompile Include="flash.cpp">\r
       <Filter>source</Filter>\r
@@ -39,6 +36,9 @@
     <ClCompile Include="util\swf.cpp">\r
       <Filter>source\util</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="producer\cg_proxy.cpp">\r
+      <Filter>source\producer</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="interop\TimerHelper.h">\r
@@ -47,9 +47,6 @@
     <ClInclude Include="interop\axflash.h">\r
       <Filter>source\interop</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="producer\cg_producer.h">\r
-      <Filter>source\producer</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="producer\flash_producer.h">\r
       <Filter>source\producer</Filter>\r
     </ClInclude>\r
@@ -63,5 +60,8 @@
     <ClInclude Include="util\swf.h">\r
       <Filter>source\util</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="producer\cg_proxy.h">\r
+      <Filter>source\producer</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
similarity index 57%
rename from modules/flash/producer/cg_producer.cpp
rename to modules/flash/producer/cg_proxy.cpp
index 57fb5f913c15b165a9503a2c3a02262596a3ce9c..0c515b1339a53a3121390127899ac0864680e3ba 100644 (file)
@@ -21,7 +21,7 @@
 \r
 #include "../StdAfx.h"\r
 \r
-#include "cg_producer.h"\r
+#include "cg_proxy.h"\r
 \r
 #include "flash_producer.h"\r
 \r
@@ -37,7 +37,7 @@
                \r
 namespace caspar { namespace flash {\r
        \r
-struct cg_producer::impl : boost::noncopyable\r
+struct cg_proxy::impl : boost::noncopyable\r
 {\r
        spl::shared_ptr<core::frame_producer> flash_producer_;\r
 public:\r
@@ -114,62 +114,7 @@ public:
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking info-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
-\r
-       boost::unique_future<std::wstring> call(const std::wstring& str)\r
-       {               \r
-               static const boost::wregex add_exp                      (L"ADD (?<LAYER>\\d+) (?<FILENAME>[^\\s]+) (?<PLAY_ON_LOAD>\\d)( (?<DATA>.*))?");\r
-               static const boost::wregex remove_exp           (L"REMOVE (?<LAYER>\\d+)");\r
-               static const boost::wregex play_exp                     (L"PLAY (?<LAYER>\\d+)");\r
-               static const boost::wregex stop_exp                     (L"STOP (?<LAYER>\\d+)");\r
-               static const boost::wregex next_exp                     (L"NEXT (?<LAYER>\\d+)");\r
-               static const boost::wregex update_exp           (L"UPDATE (?<LAYER>\\d+) (?<DATA>.+)");\r
-               static const boost::wregex invoke_exp           (L"INVOKE (?<LAYER>\\d+) (?<LABEL>.+)");\r
-               static const boost::wregex description_exp      (L"INFO (?<LAYER>\\d+)");\r
-               static const boost::wregex info_exp                     (L"INFO");\r
                \r
-               boost::wsmatch what;\r
-               if(boost::regex_match(str, what, add_exp))\r
-                       return add(boost::lexical_cast<int>(what["LAYER"].str()), flash::find_template(env::template_folder() + what["FILENAME"].str()), boost::lexical_cast<bool>(what["PLAY_ON_LOAD"].str()), L"", what["DATA"].str()); \r
-               else if(boost::regex_match(str, what, remove_exp))\r
-                       return remove(boost::lexical_cast<int>(what["LAYER"].str())); \r
-               else if(boost::regex_match(str, what, stop_exp))\r
-                       return stop(boost::lexical_cast<int>(what["LAYER"].str()), 0); \r
-               else if(boost::regex_match(str, what, next_exp))\r
-                       return next(boost::lexical_cast<int>(what["LAYER"].str())); \r
-               else if(boost::regex_match(str, what, update_exp))\r
-                       return update(boost::lexical_cast<int>(what["LAYER"].str()), what["DATA"].str()); \r
-               else if(boost::regex_match(str, what, next_exp))\r
-                       return invoke(boost::lexical_cast<int>(what["LAYER"].str()), what["LABEL"].str()); \r
-               else if(boost::regex_match(str, what, description_exp))\r
-                       return description(boost::lexical_cast<int>(what["LAYER"].str())); \r
-               else if(boost::regex_match(str, what, invoke_exp))\r
-                       return template_host_info(); \r
-\r
-               return flash_producer_->call(str);\r
-       }\r
-\r
-       spl::shared_ptr<core::draw_frame> receive(int flags)\r
-       {\r
-               return flash_producer_->receive(flags);\r
-       }\r
-\r
-       spl::shared_ptr<core::draw_frame> last_frame() const\r
-       {\r
-               return flash_producer_->last_frame();\r
-       }               \r
-                       \r
-       std::wstring print() const\r
-       {\r
-               return flash_producer_->print();\r
-       }\r
-\r
-       boost::property_tree::wptree info() const\r
-       {\r
-               boost::property_tree::wptree info;\r
-               info.add(L"type", L"cg-producer");\r
-               return info;\r
-       }\r
-\r
        std::wstring timed_invoke(int layer, const std::wstring& label)\r
        {\r
                auto result = invoke(layer, label);\r
@@ -193,7 +138,7 @@ public:
        }\r
 };\r
        \r
-spl::shared_ptr<cg_producer> get_default_cg_producer(const spl::shared_ptr<core::video_channel>& video_channel, int render_layer)\r
+cg_proxy create_cg_proxy(const spl::shared_ptr<core::video_channel>& video_channel, int render_layer)\r
 {      \r
        auto flash_producer = video_channel->stage()->foreground(render_layer).get();\r
 \r
@@ -212,7 +157,7 @@ spl::shared_ptr<cg_producer> get_default_cg_producer(const spl::shared_ptr<core:
                throw;\r
        }\r
 \r
-       return spl::make_shared<cg_producer>(flash_producer);\r
+       return cg_proxy(std::move(flash_producer));\r
 }\r
 \r
 spl::shared_ptr<core::frame_producer> create_ct_producer(const spl::shared_ptr<core::frame_factory> frame_factory, const std::vector<std::wstring>& params) \r
@@ -226,35 +171,22 @@ spl::shared_ptr<core::frame_producer> create_ct_producer(const spl::shared_ptr<c
        filename = path.wstring();\r
 \r
        auto flash_producer = flash::create_producer(frame_factory, boost::assign::list_of<std::wstring>());    \r
-       auto producer = spl::make_shared<cg_producer>(flash_producer);\r
-       producer->add(0, filename, 1);\r
-\r
-       return producer;\r
-}\r
-\r
-spl::shared_ptr<core::frame_producer> create_cg_producer(const spl::shared_ptr<core::frame_factory> frame_factory, const std::vector<std::wstring>& params) \r
-{\r
-       if(params.empty() || params.at(0) != L"[CG]")\r
-               return core::frame_producer::empty();\r
+       auto producer = flash_producer;\r
+       cg_proxy(producer).add(0, filename, 1);\r
 \r
-       return spl::make_shared<cg_producer>(flash::create_producer(frame_factory, boost::assign::list_of<std::wstring>()));    \r
+       return core::wrap_producer(producer);\r
 }\r
 \r
-cg_producer::cg_producer(const spl::shared_ptr<core::frame_producer>& frame_producer) : impl_(new impl(frame_producer)){}\r
-cg_producer::cg_producer(cg_producer&& other) : impl_(std::move(other.impl_)){}\r
-spl::shared_ptr<core::draw_frame> cg_producer::receive(int flags){return impl_->receive(flags);}\r
-spl::shared_ptr<core::draw_frame> cg_producer::last_frame() const{return impl_->last_frame();}\r
-void cg_producer::add(int layer, const std::wstring& template_name,  bool play_on_load, const std::wstring& startFromLabel, const std::wstring& data){impl_->add(layer, template_name, play_on_load, startFromLabel, data);}\r
-void cg_producer::remove(int layer){impl_->remove(layer);}\r
-void cg_producer::play(int layer){impl_->play(layer);}\r
-void cg_producer::stop(int layer, unsigned int mix_out_duration){impl_->stop(layer, mix_out_duration);}\r
-void cg_producer::next(int layer){impl_->next(layer);}\r
-void cg_producer::update(int layer, const std::wstring& data){impl_->update(layer, data);}\r
-std::wstring cg_producer::print() const{return impl_->print();}\r
-boost::unique_future<std::wstring> cg_producer::call(const std::wstring& str){return impl_->call(str);}\r
-std::wstring cg_producer::invoke(int layer, const std::wstring& label){return impl_->timed_invoke(layer, label);}\r
-std::wstring cg_producer::description(int layer){return impl_->timed_description(layer);}\r
-std::wstring cg_producer::template_host_info(){return impl_->timed_template_host_info();}\r
-boost::property_tree::wptree cg_producer::info() const{return impl_->info();}\r
+cg_proxy::cg_proxy(const spl::shared_ptr<core::frame_producer>& frame_producer) : impl_(new impl(frame_producer)){}\r
+cg_proxy::cg_proxy(cg_proxy&& other) : impl_(std::move(other.impl_)){}\r
+void cg_proxy::add(int layer, const std::wstring& template_name,  bool play_on_load, const std::wstring& startFromLabel, const std::wstring& data){impl_->add(layer, template_name, play_on_load, startFromLabel, data);}\r
+void cg_proxy::remove(int layer){impl_->remove(layer);}\r
+void cg_proxy::play(int layer){impl_->play(layer);}\r
+void cg_proxy::stop(int layer, unsigned int mix_out_duration){impl_->stop(layer, mix_out_duration);}\r
+void cg_proxy::next(int layer){impl_->next(layer);}\r
+void cg_proxy::update(int layer, const std::wstring& data){impl_->update(layer, data);}\r
+std::wstring cg_proxy::invoke(int layer, const std::wstring& label){return impl_->timed_invoke(layer, label);}\r
+std::wstring cg_proxy::description(int layer){return impl_->timed_description(layer);}\r
+std::wstring cg_proxy::template_host_info(){return impl_->timed_template_host_info();}\r
 \r
 }}
\ No newline at end of file
similarity index 66%
rename from modules/flash/producer/cg_producer.h
rename to modules/flash/producer/cg_proxy.h
index b42c229a8a387fab8441c859e32265361b28aa5a..9fdb0b13f067f5e2943fbc3e8e850ee5a65412e7 100644 (file)
 \r
 namespace caspar { namespace flash {\r
                \r
-class cg_producer : public core::frame_producer\r
+class cg_proxy\r
 {\r
 public:\r
        static const unsigned int DEFAULT_LAYER = 9999;\r
 \r
-       explicit cg_producer(const spl::shared_ptr<core::frame_producer>& producer);\r
-       cg_producer(cg_producer&& other);\r
+       explicit cg_proxy(const spl::shared_ptr<core::frame_producer>& producer);\r
+       cg_proxy(cg_proxy&& other);\r
        \r
-       // frame_producer\r
-\r
-       virtual spl::shared_ptr<core::draw_frame> receive(int) override;\r
-       virtual spl::shared_ptr<core::draw_frame> last_frame() const override;\r
-       virtual std::wstring print() const override;\r
-       virtual boost::unique_future<std::wstring> call(const std::wstring&) override;\r
-       virtual boost::property_tree::wptree info() const override;\r
-\r
-       //cg_producer\r
+       //cg_proxy\r
 \r
        void add(int layer, const std::wstring& template_name,  bool play_on_load, const std::wstring& start_from_label = L"", const std::wstring& data = L"");\r
        void remove(int layer);\r
@@ -64,9 +56,8 @@ private:
        struct impl;\r
        std::shared_ptr<impl> impl_;\r
 };\r
-spl::shared_ptr<cg_producer> get_default_cg_producer(const spl::shared_ptr<core::video_channel>& video_channel, int layer_index = cg_producer::DEFAULT_LAYER);\r
+cg_proxy create_cg_proxy(const spl::shared_ptr<core::video_channel>& video_channel, int layer_index = cg_proxy::DEFAULT_LAYER);\r
 \r
 spl::shared_ptr<core::frame_producer> create_ct_producer(const spl::shared_ptr<core::frame_factory> frame_factory, const std::vector<std::wstring>& params);\r
-spl::shared_ptr<core::frame_producer> create_cg_producer(const spl::shared_ptr<core::frame_factory> frame_factory, const std::vector<std::wstring>& params);\r
 \r
 }}
\ No newline at end of file
index 0c4a163a7c4bce93a837fe9469feabbec52925e6..ba30dfc9f042e50b48afb3fd54b9445381c48880 100644 (file)
@@ -495,7 +495,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        if(!boost::filesystem::exists(filename))\r
                BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(u8(filename)));      \r
 \r
-       return spl::make_shared<flash_producer>(frame_factory, filename, template_host.width, template_host.height);\r
+       return core::wrap_producer(spl::make_shared<flash_producer>(frame_factory, filename, template_host.width, template_host.height));\r
 }\r
 \r
 std::wstring find_template(const std::wstring& template_name)\r
index 2c78e718c3184c5aea8fac9189a54b741dd0b96e..69b2c783a505c6c5a5daf2a6d2667a5df13a29e9 100644 (file)
@@ -102,7 +102,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        if(ext == extensions.end())\r
                return core::frame_producer::empty();\r
 \r
-       return spl::make_shared<image_producer>(frame_factory, filename + *ext);\r
+       return core::wrap_producer(spl::make_shared<image_producer>(frame_factory, filename + *ext));\r
 }\r
 \r
 \r
index accdae3fa40cc131449f5407957f117fbb7dc946..3dbaafe5677ba73735f8d5e68b806117df68e877 100644 (file)
@@ -249,7 +249,7 @@ spl::shared_ptr<core::frame_producer> create_scroll_producer(const spl::shared_p
        if(speed == 0)\r
                return core::frame_producer::empty();\r
 \r
-       return spl::make_shared<image_scroll_producer>(frame_factory, filename + L"." + *ext, speed);\r
+       return core::wrap_producer(spl::make_shared<image_scroll_producer>(frame_factory, filename + L"." + *ext, speed));\r
 }\r
 \r
 }}
\ No newline at end of file
index 66957b2071562f81dde33212ca04839b8602f3b9..479bc0af50d1f62bcbdf7040c1c2ec278ff5233c 100644 (file)
@@ -140,7 +140,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
 {\r
        auto producer = spl::make_shared<reroute_producer>(frame_factory);\r
        o.subscribe(producer);\r
-       return producer;\r
+       return core::wrap_producer(producer);\r
 }\r
 \r
 }}
\ No newline at end of file
index e30710ede04117c2ba4a934c8ff1d21aa9a95ae4..dddba91cf66a38bfc83bc03b1005a209a189d86f 100644 (file)
@@ -50,7 +50,7 @@
 #include <modules/flash/flash.h>\r
 #include <modules/flash/util/swf.h>\r
 #include <modules/flash/producer/flash_producer.h>\r
-#include <modules/flash/producer/cg_producer.h>\r
+#include <modules/flash/producer/cg_proxy.h>\r
 #include <modules/ffmpeg/producer/util/util.h>\r
 #include <modules/image/image.h>\r
 #include <modules/screen/screen.h>\r
@@ -688,7 +688,7 @@ bool LoadCommand::DoExecute()
 //             std::wstring filename = templatename;\r
 //             filename.append(extension);\r
 //\r
-//             flash::flash::get_default_cg_producer(info.video_channel, std::max<int>(DEFAULT_CHANNEL_LAYER+1, info.layer_index))\r
+//             flash::flash::create_cg_proxy(info.video_channel, std::max<int>(DEFAULT_CHANNEL_LAYER+1, info.layer_index))\r
 //                     ->add(flash_layer_index, filename, play_on_load, start_label, data);\r
 //\r
 //             CASPAR_LOG(info) << L"Executed [amcp_channel_cg_add]";\r
@@ -997,7 +997,7 @@ bool CGCommand::DoExecuteAdd() {
                std::wstring filename = _parameters[2];\r
                filename.append(extension);\r
 \r
-               flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->add(layer, filename, bDoStart, label, (pDataString!=0) ? pDataString : TEXT(""));\r
+               flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).add(layer, filename, bDoStart, label, (pDataString!=0) ? pDataString : TEXT(""));\r
                SetReplyString(TEXT("202 CG OK\r\n"));\r
        }\r
        else\r
@@ -1018,7 +1018,7 @@ bool CGCommand::DoExecutePlay()
                        return false;\r
                }\r
                int layer = _ttoi(_parameters[1].c_str());\r
-               flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->play(layer);\r
+               flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).play(layer);\r
        }\r
        else\r
        {\r
@@ -1040,7 +1040,7 @@ bool CGCommand::DoExecuteStop()
                        return false;\r
                }\r
                int layer = _ttoi(_parameters[1].c_str());\r
-               flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->stop(layer, 0);\r
+               flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).stop(layer, 0);\r
        }\r
        else \r
        {\r
@@ -1063,7 +1063,7 @@ bool CGCommand::DoExecuteNext()
                }\r
 \r
                int layer = _ttoi(_parameters[1].c_str());\r
-               flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->next(layer);\r
+               flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).next(layer);\r
        }\r
        else \r
        {\r
@@ -1086,7 +1086,7 @@ bool CGCommand::DoExecuteRemove()
                }\r
 \r
                int layer = _ttoi(_parameters[1].c_str());\r
-               flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->remove(layer);\r
+               flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).remove(layer);\r
        }\r
        else \r
        {\r
@@ -1100,7 +1100,7 @@ bool CGCommand::DoExecuteRemove()
 \r
 bool CGCommand::DoExecuteClear() \r
 {\r
-       GetChannel()->stage()->clear(GetLayerIndex(flash::cg_producer::DEFAULT_LAYER));\r
+       GetChannel()->stage()->clear(GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER));\r
        SetReplyString(TEXT("202 CG OK\r\n"));\r
        return true;\r
 }\r
@@ -1138,7 +1138,7 @@ bool CGCommand::DoExecuteUpdate()
                }               \r
 \r
                int layer = _ttoi(_parameters.at(1).c_str());\r
-               flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->update(layer, dataString);\r
+               flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).update(layer, dataString);\r
        }\r
        catch(...)\r
        {\r
@@ -1163,7 +1163,7 @@ bool CGCommand::DoExecuteInvoke()
                        return false;\r
                }\r
                int layer = _ttoi(_parameters[1].c_str());\r
-               auto result = flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->invoke(layer, _parameters2[2]);\r
+               auto result = flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).invoke(layer, _parameters2[2]);\r
                replyString << result << TEXT("\r\n"); \r
        }\r
        else \r
@@ -1190,13 +1190,13 @@ bool CGCommand::DoExecuteInfo()
                }\r
 \r
                int layer = _ttoi(_parameters[1].c_str());\r
-               auto desc = flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->description(layer);\r
+               auto desc = flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).description(layer);\r
                \r
                replyString << desc << TEXT("\r\n"); \r
        }\r
        else \r
        {\r
-               auto info = flash::get_default_cg_producer(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->template_host_info();\r
+               auto info = flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_proxy::DEFAULT_LAYER)).template_host_info();\r
                replyString << info << TEXT("\r\n"); \r
        }       \r
 \r
index f921dd19bf5115428a09c3785a37f3ee09dc69f4..23c07fcca5ab77b76be29549d7284c51d7a50417 100644 (file)
@@ -28,7 +28,7 @@
 #include "CIICommandsImpl.h"\r
 #include <sstream>\r
 #include <algorithm>\r
-#include <modules/flash/producer/cg_producer.h>\r
+#include <modules/flash/producer/cg_proxy.h>\r
 #include <boost/locale.hpp>\r
 \r
 namespace caspar { namespace protocol { namespace cii {\r
@@ -152,7 +152,7 @@ void MiscellaneousCommand::Execute()
        {\r
                // HACK fix. The data sent is UTF8, however the protocol is implemented for ISO-8859-1. Instead of doing risky changes we simply convert into proper encoding when leaving protocol code.\r
                auto xmlData2 = boost::locale::conv::utf_to_utf<wchar_t, char>(std::string(xmlData_.begin(), xmlData_.end()));\r
-               flash::get_default_cg_producer(pCIIStrategy_->GetChannel())->add(layer_, filename_, false, TEXT(""), xmlData2);\r
+               flash::create_cg_proxy(pCIIStrategy_->GetChannel()).add(layer_, filename_, false, TEXT(""), xmlData2);\r
        }\r
 }\r
 \r
@@ -167,11 +167,11 @@ void KeydataCommand::Execute()
 \r
        //TODO: Need to be checked for validity\r
        else if(state_ == 1)\r
-               flash::get_default_cg_producer(pCIIStrategy_->GetChannel())->stop(layer_, 0);\r
+               flash::create_cg_proxy(pCIIStrategy_->GetChannel()).stop(layer_, 0);\r
        else if(state_ == 2)\r
-               pCIIStrategy_->GetChannel()->stage()->clear(flash::cg_producer::DEFAULT_LAYER);\r
+               pCIIStrategy_->GetChannel()->stage()->clear(flash::cg_proxy::DEFAULT_LAYER);\r
        else if(state_ == 3)\r
-               flash::get_default_cg_producer(pCIIStrategy_->GetChannel())->play(layer_);\r
+               flash::create_cg_proxy(pCIIStrategy_->GetChannel()).play(layer_);\r
 }\r
 \r
 void KeydataCommand::Setup(const std::vector<std::wstring>& parameters) {\r
index 8e9b15383c9d617f54f7e435de78c8df895e33aa..8c2e9fde80c237a84f03447965b83034d5f5ad00 100644 (file)
@@ -24,7 +24,7 @@
 \r
 #include "CLKProtocolStrategy.h"\r
 \r
-#include <modules/flash/producer/cg_producer.h>\r
+#include <modules/flash/producer/cg_proxy.h>\r
 \r
 #include <string>\r
 #include <sstream>\r
@@ -117,7 +117,7 @@ void CLKProtocolStrategy::Parse(const TCHAR* pData, int charCount, IO::ClientInf
 \r
                        if(currentCommand_.command_ == CLKCommand::CLKReset) \r
                        {\r
-                               pChannel_->stage()->clear(flash::cg_producer::DEFAULT_LAYER);\r
+                               pChannel_->stage()->clear(flash::cg_proxy::DEFAULT_LAYER);\r
                                bClockLoaded_ = false;\r
                                \r
                                CASPAR_LOG(info) << L"CLK: Recieved and executed reset-command";\r
@@ -126,11 +126,11 @@ void CLKProtocolStrategy::Parse(const TCHAR* pData, int charCount, IO::ClientInf
                        {\r
                                if(!bClockLoaded_) \r
                                {\r
-                                       flash::get_default_cg_producer(pChannel_)->add(0, TEXT("hawrysklocka/clock.ft"), true, TEXT(""), currentCommand_.GetData());\r
+                                       flash::create_cg_proxy(pChannel_).add(0, TEXT("hawrysklocka/clock.ft"), true, TEXT(""), currentCommand_.GetData());\r
                                        bClockLoaded_ = true;\r
                                }\r
                                else \r
-                                       flash::get_default_cg_producer(pChannel_)->update(0, currentCommand_.GetData());\r
+                                       flash::create_cg_proxy(pChannel_).update(0, currentCommand_.GetData());\r
                                \r
                                CASPAR_LOG(debug) << L"CLK: Clockdata sent: " << currentCommand_.GetData();\r
                                CASPAR_LOG(debug) << L"CLK: Executed valid command: " << currentCommandString_.str();\r
index cf078b25c58073ef767bdd2637b01a7d8506c143..811d5cb94c8165d342050985be3a5a2d9d27b644 100644 (file)
   <log-level>trace</log-level>\r
   <channels>\r
     <channel>\r
-      <video-mode>720p5000</video-mode>\r
+      <video-mode>PAL</video-mode>\r
       <consumers>\r
         <screen>\r
-          <device>2</device>\r
         </screen>\r
+        <system-audio></system-audio>\r
       </consumers>\r
     </channel>\r
   </channels>\r