]> git.sesse.net Git - casparcg/commitdiff
#222 Fixed broken flash CG support
authorHelge Norberg <helge.norberg@gmail.com>
Wed, 15 Jan 2014 19:23:15 +0000 (20:23 +0100)
committerHelge Norberg <helge.norberg@gmail.com>
Wed, 15 Jan 2014 19:23:15 +0000 (20:23 +0100)
modules/flash/producer/cg_producer.cpp
modules/flash/producer/flash_producer.cpp
protocol/amcp/AMCPCommandsImpl.cpp

index b0acbebc827f87594532efda0d6eb26b69aa9bfe..7d95cd49a7fc0cd525886a2bd58031e6cc4eacd1 100644 (file)
@@ -130,7 +130,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()), flash::find_template(env::template_folder() + 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()), 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
index b5a34aae97c21979d9d66a02e3fcbad18b1f111a..33c1e1012c7052007bdff1ba34d9bd278a1cdaa3 100644 (file)
@@ -263,6 +263,10 @@ public:
 \r
                if(!ax_->FlashCall(param, result))\r
                        CASPAR_LOG(warning) << print() << L" Flash call failed:" << param;//BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Flash function call failed.") << arg_name_info("param") << arg_value_info(narrow(param)));\r
+\r
+               if (boost::starts_with(result, L"<exception>"))\r
+                       CASPAR_LOG(warning) << print() << L" Flash call failed:" << result;\r
+\r
                graph_->set_tag("param");\r
 \r
                return result;\r
index 7285a4368266467946802b8ee8955defdabdd5ee..dc6642fe5fd89b5ed8975f79207a39aca996e713 100644 (file)
@@ -59,6 +59,7 @@
 #include <modules/html/producer/html_producer.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/ffmpeg/producer/util/util.h>\r
 #include <modules/image/image.h>\r
 #include <modules/ogl/ogl.h>\r
@@ -1351,19 +1352,28 @@ bool CGCommand::DoExecuteAdd() {
        std::wstring fullFilename = flash::find_template(env::template_folder() + _parameters[2]);\r
        std::wstring extension = boost::filesystem::wpath(fullFilename).extension();\r
        std::wstring filename = _parameters[2];\r
-       filename.append(extension);\r
 \r
        if(!fullFilename.empty())\r
        {\r
-                               \r
+               auto call = (boost::wformat(L"ADD %1% %2% %3% %4% %5%") % layer % filename % bDoStart % label % (std::wstring() + (pDataString ? pDataString : L""))).str();\r
                auto producer = GetChannel()->stage()->foreground(GetLayerIndex(9999)).get();\r
 \r
                if(producer->print().find(L"flash") == std::string::npos)\r
                { \r
-                       producer = flash::create_producer(GetChannel()->mixer(), boost::assign::list_of<std::wstring>());       \r
+                       producer = flash::create_producer(GetChannel()->mixer(), boost::assign::list_of<std::wstring>());\r
+\r
+                       if (producer != core::frame_producer::empty())\r
+                       {\r
+                               producer = make_safe<flash::cg_producer>(producer);\r
+                               producer->call(call).wait();\r
+                               GetChannel()->stage()->load(GetLayerIndex(9999), producer);\r
+                               GetChannel()->stage()->play(GetLayerIndex(9999));\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       GetChannel()->stage()->call(GetLayerIndex(9999), true, call).wait();\r
                }\r
-                       \r
-               GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"ADD %1% %2% %3% %4% %5%") % layer % filename % bDoStart % label % (std::wstring() + L"\"" + (pDataString ? pDataString : L"") + L"\"")).str()).wait();\r
                \r
                SetReplyString(TEXT("202 CG OK\r\n"));\r
 \r
@@ -1371,6 +1381,7 @@ bool CGCommand::DoExecuteAdd() {
        }\r
        else\r
        {                       \r
+               filename.append(extension);\r
                std::vector<std::wstring> parameters = boost::assign::list_of<std::wstring>(filename);\r
                auto producer = html::create_producer(GetChannel()->mixer(), core::parameters(parameters));     \r
                                \r