]> git.sesse.net Git - casparcg/commitdiff
2.0.2: playlist producer is not [PLAYLIST]. Now possible to start cg producer using...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 26 Nov 2011 12:44:07 +0000 (12:44 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 26 Nov 2011 12:44:07 +0000 (12:44 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.2@1671 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

17 files changed:
common/exception/exceptions.h
core/producer/frame_producer.cpp
core/producer/frame_producer.h
core/producer/layer.cpp
core/producer/layer.h
core/producer/playlist/playlist_producer.cpp
core/producer/stage.cpp
core/producer/stage.h
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/flash/flash.cpp
modules/flash/producer/FlashAxContainer.cpp
modules/flash/producer/cg_producer.cpp
modules/flash/producer/cg_producer.h
modules/flash/producer/flash_producer.cpp
protocol/amcp/AMCPCommandsImpl.cpp
protocol/util/ClientInfo.h
shell/server.cpp

index 538cde569700e16f96d656c10afb9f46acc4e508..2a0f9611fa6a4ed181a914aa7cbb56a5dc9bf6ef 100644 (file)
@@ -52,6 +52,7 @@ struct bad_alloc                              : virtual caspar_exception {};
 \r
 struct invalid_operation               : virtual caspar_exception {};\r
 struct operation_failed                        : virtual caspar_exception {};\r
+struct timed_out                               : virtual caspar_exception {};\r
 \r
 struct not_supported                   : virtual caspar_exception {};\r
 struct not_implemented                 : virtual caspar_exception {};\r
index 382099ac329a1a9c706a4f5396e4592dac93552c..ce986b4fb270f0319dae224b1f4a7101002114dd 100644 (file)
@@ -91,13 +91,13 @@ public:
                }\r
        }\r
 \r
-       virtual safe_ptr<basic_frame>           receive(int hints) override                                                                                             {return (*producer_)->receive(hints);}\r
-       virtual safe_ptr<basic_frame>           last_frame() const override                                                                                             {return (*producer_)->last_frame();}\r
-       virtual std::wstring                            print() const override                                                                                                  {return (*producer_)->print();}\r
-       virtual std::wstring                            call(const std::wstring& str) override                                                                  {return (*producer_)->call(str);}\r
-       virtual safe_ptr<frame_producer>        get_following_producer() const override                                                                 {return (*producer_)->get_following_producer();}\r
-       virtual void                                            set_leading_producer(const safe_ptr<frame_producer>& producer) override {(*producer_)->set_leading_producer(producer);}\r
-       virtual int64_t                                         nb_frames() const override                                                                                              {return (*producer_)->nb_frames();}\r
+       virtual safe_ptr<basic_frame>                           receive(int hints) override                                                                                             {return (*producer_)->receive(hints);}\r
+       virtual safe_ptr<basic_frame>                           last_frame() const override                                                                                             {return (*producer_)->last_frame();}\r
+       virtual std::wstring                                            print() const override                                                                                                  {return (*producer_)->print();}\r
+       virtual boost::unique_future<std::wstring>      call(const std::wstring& str) override                                                                  {return (*producer_)->call(str);}\r
+       virtual safe_ptr<frame_producer>                        get_following_producer() const override                                                                 {return (*producer_)->get_following_producer();}\r
+       virtual void                                                            set_leading_producer(const safe_ptr<frame_producer>& producer) override {(*producer_)->set_leading_producer(producer);}\r
+       virtual int64_t                                                         nb_frames() const override                                                                                              {return (*producer_)->nb_frames();}\r
 };\r
 \r
 safe_ptr<core::frame_producer> create_destroy_proxy(safe_ptr<core::frame_producer>&& producer)\r
index 5e70c458801e300bf98e0f7a3386fc6bf99640f7..d40698b20058258fbbed023ee8d903fad032947a 100644 (file)
@@ -30,6 +30,8 @@
 #include <stdint.h>\r
 #include <numeric>\r
 \r
+#include <boost/thread/future.hpp>\r
+\r
 namespace caspar { \r
        \r
 class executor;\r
@@ -52,7 +54,12 @@ public:
 \r
        virtual std::wstring print() const = 0; // nothrow\r
 \r
-       virtual std::wstring call(const std::wstring&) {return L"";}\r
+       virtual boost::unique_future<std::wstring> call(const std::wstring&) \r
+       {\r
+               boost::promise<std::wstring> promise;\r
+               promise.set_value(L"");\r
+               return promise.get_future();\r
+       }\r
 \r
        virtual safe_ptr<frame_producer> get_following_producer() const {return frame_producer::empty();}  // nothrow\r
        virtual void set_leading_producer(const safe_ptr<frame_producer>&) {}  // nothrow\r
index 0051ef3443e49dc2d2aecc4212aa45716dc2e0a3..9798c08d0c3c8c454252a32e824e7dc9fea30f34 100644 (file)
@@ -133,7 +133,7 @@ public:
                return status;\r
        }\r
 \r
-       std::wstring call(bool foreground, const std::wstring& param)\r
+       boost::unique_future<std::wstring> call(bool foreground, const std::wstring& param)\r
        {\r
                return (foreground ? foreground_ : background_)->call(param);\r
        }\r
@@ -173,5 +173,5 @@ safe_ptr<basic_frame> layer::receive() {return impl_->receive();}
 safe_ptr<frame_producer> layer::foreground() const { return impl_->foreground_;}\r
 safe_ptr<frame_producer> layer::background() const { return impl_->background_;}\r
 bool layer::empty() const {return impl_->empty();}\r
-std::wstring layer::call(bool foreground, const std::wstring& param){return impl_->call(foreground, param);}\r
+boost::unique_future<std::wstring> layer::call(bool foreground, const std::wstring& param){return impl_->call(foreground, param);}\r
 }}
\ No newline at end of file
index 625064f81dd49b71f0f00accf03ec21722e47447..5f412ac8121edaca51ecb81f9f6ba4578ae4b6b0 100644 (file)
@@ -23,6 +23,7 @@
 #include <common/memory/safe_ptr.h>\r
 \r
 #include <boost/noncopyable.hpp>\r
+#include <boost/thread/future.hpp>\r
 \r
 #include <string>\r
 \r
@@ -55,7 +56,7 @@ public:
        void play(); // nothrow\r
        void pause(); // nothrow\r
        void stop(); // nothrow\r
-       std::wstring call(bool foreground, const std::wstring& param);\r
+       boost::unique_future<std::wstring> call(bool foreground, const std::wstring& param);\r
 \r
        bool is_paused() const;\r
        int64_t frame_number() const;\r
index df811646831edc67b9ef5360a69a455b0a5189bb..a4e2d6bd7dd737e985cda835646f1174b40d1df0 100644 (file)
@@ -83,8 +83,17 @@ struct playlist_producer : public frame_producer
        {\r
                return std::numeric_limits<int>::max();\r
        }\r
+       \r
+       virtual boost::unique_future<std::wstring> call(const std::wstring& param) override\r
+       {\r
+               boost::promise<std::wstring> promise;\r
+               promise.set_value(do_call(param));\r
+               return promise.get_future();\r
+       }       \r
 \r
-       virtual std::wstring call(const std::wstring& param) override\r
+       // playlist_producer\r
+\r
+       std::wstring do_call(const std::wstring& param)\r
        {               \r
                static const boost::wregex push_front_exp       (L"PUSH_FRONT (?<PARAM>.+)");           \r
                static const boost::wregex push_back_exp        (L"(PUSH_BACK|PUSH) (?<PARAM>.+)");\r
@@ -120,8 +129,6 @@ struct playlist_producer : public frame_producer
 \r
                BOOST_THROW_EXCEPTION(invalid_argument());\r
        }\r
-\r
-       // playlist_producer\r
        \r
        std::wstring push_front(const std::wstring& str)\r
        {\r
@@ -174,7 +181,7 @@ struct playlist_producer : public frame_producer
 \r
 safe_ptr<frame_producer> create_playlist_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::vector<std::wstring>& params)\r
 {\r
-       if(boost::range::find(params, L"PLAYLIST") == params.end())\r
+       if(boost::range::find(params, L"[PLAYLIST]") == params.end())\r
                return core::frame_producer::empty();\r
 \r
        bool loop = boost::range::find(params, L"LOOP") != params.end();\r
index 00105986d1d35c0f5335ca0de1b2ccb7cdf8d27e..adcca8b064cc5d141926ef2a078af8a669e3e11d 100644 (file)
@@ -154,12 +154,12 @@ public:
                }, high_priority);\r
        }       \r
        \r
-       std::wstring call(int index, bool foreground, const std::wstring& param)\r
+       boost::unique_future<std::wstring> call(int index, bool foreground, const std::wstring& param)\r
        {\r
-               return executor_.invoke([&]\r
+               return std::move(*executor_.invoke([&]() -> std::shared_ptr<boost::unique_future<std::wstring>>\r
                {\r
-                       return layers_[index].call(foreground, param);\r
-               }, high_priority);\r
+                       return std::make_shared<boost::unique_future<std::wstring>>(std::move(layers_[index].call(foreground, param)));\r
+               }, high_priority));\r
        }\r
 \r
        void swap_layer(int index, size_t other_index)\r
@@ -237,5 +237,5 @@ layer_status stage::get_status(int index){return impl_->get_status(index);}
 safe_ptr<frame_producer> stage::foreground(size_t index) {return impl_->foreground(index);}\r
 safe_ptr<frame_producer> stage::background(size_t index) {return impl_->background(index);}\r
 void stage::set_video_format_desc(const video_format_desc& format_desc){impl_->set_video_format_desc(format_desc);}\r
-std::wstring stage::call(int index, bool foreground, const std::wstring& param){return impl_->call(index, foreground, param);}\r
+boost::unique_future<std::wstring> stage::call(int index, bool foreground, const std::wstring& param){return impl_->call(index, foreground, param);}\r
 }}
\ No newline at end of file
index 54f680f2577be579799e18d18d3693655d1ce80a..04e9a29888f822f712553e97ade8511701c72c0e 100644 (file)
@@ -49,7 +49,7 @@ public:
        void stop(int index);\r
        void clear(int index);\r
        void clear();   \r
-       std::wstring call(int index, bool foreground, const std::wstring& param);\r
+       boost::unique_future<std::wstring> call(int index, bool foreground, const std::wstring& param);\r
        void swap_layer(int index, size_t other_index);\r
        void swap_layer(int index, size_t other_index, stage& other);\r
 \r
index 7fd2c1f9ebc9c1b61adbe95de8a9582a932657aa..3289be238d0e59f023902e597f6d6890d2e3bd49 100644 (file)
@@ -184,7 +184,29 @@ public:
                return nb_frames - start_;\r
        }\r
 \r
-       virtual std::wstring call(const std::wstring& param) override\r
+       virtual boost::unique_future<std::wstring> call(const std::wstring& param) override\r
+       {\r
+               boost::promise<std::wstring> promise;\r
+               promise.set_value(do_call(param));\r
+               return promise.get_future();\r
+       }\r
+                               \r
+       virtual std::wstring print() const override\r
+       {\r
+               if(video_decoder_)\r
+               {\r
+                       return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"|" \r
+                                                         + boost::lexical_cast<std::wstring>(video_decoder_->width()) + L"x" + boost::lexical_cast<std::wstring>(video_decoder_->height())\r
+                                                         + (video_decoder_->is_progressive() ? L"p" : L"i")  + boost::lexical_cast<std::wstring>(video_decoder_->is_progressive() ? video_decoder_->fps() : 2.0 * video_decoder_->fps())\r
+                                                         + L"]";\r
+               }\r
+               \r
+               return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"]";\r
+       }\r
+\r
+       // ffmpeg_producer\r
+                               \r
+       std::wstring do_call(const std::wstring& param)\r
        {\r
                static const boost::wregex loop_exp(L"LOOP\\s*(?<VALUE>\\d?)");\r
                static const boost::wregex seek_exp(L"SEEK\\s+(?<VALUE>\\d+)");\r
@@ -204,22 +226,7 @@ public:
 \r
                BOOST_THROW_EXCEPTION(invalid_argument());\r
        }\r
-                               \r
-       virtual std::wstring print() const override\r
-       {\r
-               if(video_decoder_)\r
-               {\r
-                       return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"|" \r
-                                                         + boost::lexical_cast<std::wstring>(video_decoder_->width()) + L"x" + boost::lexical_cast<std::wstring>(video_decoder_->height())\r
-                                                         + (video_decoder_->is_progressive() ? L"p" : L"i")  + boost::lexical_cast<std::wstring>(video_decoder_->is_progressive() ? video_decoder_->fps() : 2.0 * video_decoder_->fps())\r
-                                                         + L"]";\r
-               }\r
-               \r
-               return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"]";\r
-       }\r
 \r
-       // ffmpeg_producer\r
-               \r
        void try_decode_frame(int hints)\r
        {\r
                std::shared_ptr<AVPacket> pkt;\r
index 9378a073d09a3fa7682baf37064d6db0d2b3c744..509ba1cacbbf735365ddb5f79d22dd3ff1b422c3 100644 (file)
@@ -31,6 +31,7 @@ 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 034844559b7d17b376ad391a7341ce3911ca7d21..7d0bbe33067ce2cca02e2ae36bc1eb77800bb84f 100644 (file)
@@ -915,7 +915,8 @@ bool FlashAxContainer::FlashCall(const std::wstring& str, std::wstring& result2)
        for(size_t retries = 0; !bCallSuccessful_ && retries < 4; ++retries)\r
                spFlash->CallFunction(request, &result);\r
 \r
-       result2 = result;\r
+       if(bCallSuccessful_)\r
+               result2 = result;\r
 \r
        return bCallSuccessful_;\r
 }\r
index 5dc08c1a067659369e7dc86520a07228f491a36d..a7d2f938799771309b18aeaf412aba7471e46008 100644 (file)
@@ -42,7 +42,7 @@ public:
                : flash_producer_(frame_producer)\r
        {}\r
        \r
-       std::wstring add(int layer, std::wstring filename,  bool play_on_load, const std::wstring& label, const std::wstring& data)\r
+       boost::unique_future<std::wstring> add(int layer, std::wstring filename,  bool play_on_load, const std::wstring& label, const std::wstring& data)\r
        {\r
                if(filename.size() > 0 && filename[0] == L'/')\r
                        filename = filename.substr(1, filename.size()-1);\r
@@ -53,63 +53,63 @@ public:
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring remove(int layer)\r
+       boost::unique_future<std::wstring> remove(int layer)\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"Delete\" returntype=\"xml\"><arguments><array><property id=\"0\"><number>%1%</number></property></array></arguments></invoke>") % layer).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking remove-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring play(int layer)\r
+       boost::unique_future<std::wstring> play(int layer)\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"Play\" returntype=\"xml\"><arguments><array><property id=\"0\"><number>%1%</number></property></array></arguments></invoke>") % layer).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking play-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring stop(int layer, unsigned int)\r
+       boost::unique_future<std::wstring> stop(int layer, unsigned int)\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"Stop\" returntype=\"xml\"><arguments><array><property id=\"0\"><number>%1%</number></property></array><number>0</number></arguments></invoke>") % layer).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking stop-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring next(int layer)\r
+       boost::unique_future<std::wstring> next(int layer)\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"Next\" returntype=\"xml\"><arguments><array><property id=\"0\"><number>%1%</number></property></array></arguments></invoke>") % layer).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking next-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring update(int layer, const std::wstring& data)\r
+       boost::unique_future<std::wstring> update(int layer, const std::wstring& data)\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"SetData\" returntype=\"xml\"><arguments><array><property id=\"0\"><number>%1%</number></property></array><string><![CDATA[%2%]]></string></arguments></invoke>") % layer % data).str();\r
                CASPAR_LOG(info) << flash_producer_->print() <<" Invoking update-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring invoke(int layer, const std::wstring& label)\r
+       boost::unique_future<std::wstring> invoke(int layer, const std::wstring& label)\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"Invoke\" returntype=\"xml\"><arguments><array><property id=\"0\"><number>%1%</number></property></array><string>%2%</string></arguments></invoke>") % layer % label).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking invoke-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring description(int layer)\r
+       boost::unique_future<std::wstring> description(int layer)\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"GetDescription\" returntype=\"xml\"><arguments><array><property id=\"0\"><number>%1%</number></property></array></arguments></invoke>") % layer).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking description-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring info()\r
+       boost::unique_future<std::wstring> info()\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"GetInfo\" returntype=\"xml\"><arguments></arguments></invoke>")).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking info-command: " << str;\r
                return flash_producer_->call(str);\r
        }\r
 \r
-       std::wstring call(const std::wstring& str)\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
@@ -123,7 +123,7 @@ public:
                \r
                boost::wsmatch what;\r
                if(boost::regex_match(str, what, add_exp))\r
-                       return add(boost::lexical_cast<int>(what["LAYER"].str()), what["FILENAME"].str(), boost::lexical_cast<bool>(what["PLAY_ON_LOAD"].str()), L"", what["DATA"].str()); \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
@@ -156,6 +156,28 @@ public:
        {\r
                return flash_producer_->print();\r
        }\r
+\r
+       std::wstring timed_invoke(int layer, const std::wstring& label)\r
+       {\r
+               auto result = invoke(layer, label);\r
+               if(result.timed_wait(boost::posix_time::seconds(2)))\r
+                       return result.get();\r
+               return L"";\r
+       }\r
+       std::wstring timed_description(int layer)\r
+       {\r
+               auto result = description(layer);\r
+               if(result.timed_wait(boost::posix_time::seconds(2)))\r
+                       return result.get();\r
+               return L"";\r
+       }\r
+       std::wstring timed_info()\r
+       {\r
+               auto result = info();\r
+               if(result.timed_wait(boost::posix_time::seconds(2)))\r
+                       return result.get();\r
+               return L"";\r
+       }\r
 };\r
        \r
 safe_ptr<cg_producer> get_default_cg_producer(const safe_ptr<core::video_channel>& video_channel, int render_layer)\r
@@ -164,12 +186,12 @@ safe_ptr<cg_producer> get_default_cg_producer(const safe_ptr<core::video_channel
 \r
        if(flash_producer->print().find(L"flash[") == std::string::npos) // UGLY hack\r
        {\r
-               flash_producer = flash::create_producer(video_channel->mixer(), boost::assign::list_of<std::wstring>());        \r
+               flash_producer = make_safe<cg_producer>(flash::create_producer(video_channel->mixer(), boost::assign::list_of<std::wstring>()));        \r
                video_channel->stage()->load(render_layer, flash_producer); \r
                video_channel->stage()->play(render_layer);\r
        }\r
 \r
-       return make_safe<cg_producer>(flash_producer);\r
+       return static_pointer_cast<cg_producer>(flash_producer);\r
 }\r
 \r
 safe_ptr<core::frame_producer> create_ct_producer(const safe_ptr<core::frame_factory> frame_factory, const std::vector<std::wstring>& params) \r
@@ -189,6 +211,14 @@ safe_ptr<core::frame_producer> create_ct_producer(const safe_ptr<core::frame_fac
        return producer;\r
 }\r
 \r
+safe_ptr<core::frame_producer> create_cg_producer(const safe_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
+\r
+       return make_safe<cg_producer>(flash::create_producer(frame_factory, boost::assign::list_of<std::wstring>()));   \r
+}\r
+\r
 cg_producer::cg_producer(const safe_ptr<core::frame_producer>& frame_producer) : impl_(new implementation(frame_producer)){}\r
 cg_producer::cg_producer(cg_producer&& other) : impl_(std::move(other.impl_)){}\r
 safe_ptr<core::basic_frame> cg_producer::receive(int hints){return impl_->receive(hints);}\r
@@ -199,10 +229,10 @@ void cg_producer::play(int layer){impl_->play(layer);}
 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::invoke(int layer, const std::wstring& label){return impl_->invoke(layer, label);}\r
 std::wstring cg_producer::print() const{return impl_->print();}\r
-std::wstring cg_producer::call(const std::wstring& str){return impl_->call(str);}\r
-std::wstring cg_producer::description(int layer){return impl_->description(layer);}\r
-std::wstring cg_producer::info(){return impl_->info();}\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::info(){return impl_->timed_info();}\r
 \r
 }}
\ No newline at end of file
index 079fb685132249648eb3a8b29a28f270c747a532..6b6cf224188d23b2b9f4b2b4f3517243d5b00829 100644 (file)
@@ -24,6 +24,8 @@
 #include <core/video_format.h>\r
 #include <core/video_channel.h>\r
 \r
+#include <boost/thread/future.hpp>\r
+\r
 #include <string>\r
 \r
 namespace caspar { namespace flash {\r
@@ -41,7 +43,7 @@ public:
        virtual safe_ptr<core::basic_frame> receive(int) override;\r
        virtual safe_ptr<core::basic_frame> last_frame() const override;\r
        virtual std::wstring print() const override;\r
-       virtual std::wstring call(const std::wstring&) override;\r
+       virtual boost::unique_future<std::wstring> call(const std::wstring&) override;\r
 \r
        //cg_producer\r
 \r
@@ -62,5 +64,6 @@ private:
 safe_ptr<cg_producer> get_default_cg_producer(const safe_ptr<core::video_channel>& video_channel, int layer_index = cg_producer::DEFAULT_LAYER);\r
 \r
 safe_ptr<core::frame_producer> create_ct_producer(const safe_ptr<core::frame_factory> frame_factory, const std::vector<std::wstring>& params);\r
+safe_ptr<core::frame_producer> create_cg_producer(const safe_ptr<core::frame_factory> frame_factory, const std::vector<std::wstring>& params);\r
 \r
 }}
\ No newline at end of file
index 95623badf4d2d095d156b9624f8f0938b7d58924..2d2e5f9c4ade5fe456c7b717d7049b238cce56ff 100644 (file)
@@ -340,9 +340,9 @@ public:
                return last_frame_;\r
        }               \r
        \r
-       virtual std::wstring call(const std::wstring& param) override\r
+       virtual boost::unique_future<std::wstring> call(const std::wstring& param) override\r
        {       \r
-               return context_.invoke([=]() -> std::wstring\r
+               return context_.begin_invoke([=]() -> std::wstring\r
                {\r
                        if(!context_)\r
                                initialize();\r
index b6069929f120a37897b8230ac8e952df51f450da..8d973dfb02584a725871ce4e82274dba3a65f67e 100644 (file)
@@ -225,7 +225,7 @@ bool CallCommand::DoExecute()
                for(auto it = std::begin(_parameters2)+2; it != std::end(_parameters2); ++it)\r
                        param += L" " + *it;\r
                \r
-               std::wstring result;\r
+               boost::unique_future<std::wstring> result;\r
                if(what == L"B")\r
                        result = GetChannel()->stage()->call(GetLayerIndex(), false, param);\r
                else if(what == L"F")\r
@@ -233,10 +233,13 @@ bool CallCommand::DoExecute()
                else\r
                        result = GetChannel()->stage()->call(GetLayerIndex(), true, _parameters.at(0) + L" " + param);\r
        \r
+               if(!result.timed_wait(boost::posix_time::seconds(2)))\r
+                       BOOST_THROW_EXCEPTION(timed_out());\r
+\r
                CASPAR_LOG(info) << "Executed call: " <<  _parameters[0] << TEXT(" successfully");\r
                \r
                std::wstringstream replyString;\r
-               replyString << TEXT("201 CALL OK\r\n") << result << L"\r\n";\r
+               replyString << TEXT("201 CALL OK\r\n") << result.get() << L"\r\n";\r
                \r
                SetReplyString(replyString.str());\r
 \r
index 65e7804f3b575ddc6946826251a734992d4d0600..a50a89c8371a66a9769bbb5acf85a8b5e917c3f0 100644 (file)
@@ -44,7 +44,7 @@ struct ConsoleClientInfo : public caspar::IO::ClientInfo
 {\r
        void Send(const std::wstring& data)\r
        {\r
-               std::wcout << L"#" << data;\r
+               std::wcout << (L"\n--------------------\n" + data + L"--------------------\n");\r
        }\r
        void Disconnect(){}\r
 };\r
index 3b86e2cc97ea62b17ededfba30f4faabb0c9b511..c26e38e99be73cdff0d8cae389258db2e9054748 100644 (file)
@@ -77,10 +77,7 @@ struct server::implementation : boost::noncopyable
                                                          \r
                decklink::init();         \r
                CASPAR_LOG(info) << L"Initialized decklink module.";\r
-                                                         \r
-               flash::init();            \r
-               CASPAR_LOG(info) << L"Initialized flash module.";\r
-                                                         \r
+                                                                                                                 \r
                oal::init();              \r
                CASPAR_LOG(info) << L"Initialized oal module.";\r
                                                          \r
@@ -90,6 +87,9 @@ struct server::implementation : boost::noncopyable
                image::init();            \r
                CASPAR_LOG(info) << L"Initialized image module.";\r
 \r
+               flash::init();            \r
+               CASPAR_LOG(info) << L"Initialized flash module.";\r
+\r
                setup_channels(env::properties());\r
                CASPAR_LOG(info) << L"Initialized channels.";\r
 \r