]> git.sesse.net Git - casparcg/blobdiff - modules/flash/producer/cg_producer.cpp
CG commands that expects an already running flash template no longer starts a flash...
[casparcg] / modules / flash / producer / cg_producer.cpp
index f132de9c4a4886c4c57798cba76b1245bcd3b9e1..35e7c3926d8f681ee1a7b84a1af3bc280366b02b 100644 (file)
@@ -118,15 +118,15 @@ public:
 \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
+               static const boost::wregex add_exp                      (L"ADD (?<LAYER>\\d+) (?<FILENAME>[^\\s]+) (?<PLAY_ON_LOAD>\\d)( (?<DATA>.*))?", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex remove_exp           (L"REMOVE (?<LAYER>\\d+)", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex play_exp                     (L"PLAY (?<LAYER>\\d+)", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex stop_exp                     (L"STOP (?<LAYER>\\d+)", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex next_exp                     (L"NEXT (?<LAYER>\\d+)", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex update_exp           (L"UPDATE (?<LAYER>\\d+) (?<DATA>.+)", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex invoke_exp           (L"INVOKE (?<LAYER>\\d+) (?<LABEL>.+)", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex description_exp      (L"INFO (?<LAYER>\\d+)", boost::regex::perl|boost::regex::icase);\r
+               static const boost::wregex info_exp                     (L"INFO", boost::regex::perl|boost::regex::icase);\r
                \r
                boost::wsmatch what;\r
                if(boost::regex_match(str, what, add_exp))\r
@@ -199,7 +199,10 @@ public:
        }\r
 };\r
        \r
-safe_ptr<cg_producer> get_default_cg_producer(const safe_ptr<core::video_channel>& video_channel, int render_layer)\r
+safe_ptr<cg_producer> get_default_cg_producer(\r
+               const safe_ptr<core::video_channel>& video_channel,\r
+               bool expect_existing,\r
+               int render_layer)\r
 {      \r
        auto flash_producer = video_channel->stage()->foreground(render_layer).get();\r
 \r
@@ -207,10 +210,20 @@ 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
+                       if (expect_existing)\r
+                               BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(\r
+                                               "No flash producer on layer "\r
+                                               + boost::lexical_cast<std::string>(render_layer)));\r
+\r
                        flash_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
+               if (expect_existing && flash_producer->call(L"?").get() == L"0")\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(\r
+                                       "No flash player on layer "\r
+                                       + boost::lexical_cast<std::string>(render_layer)));\r
        }\r
        catch(...)\r
        {\r