]> git.sesse.net Git - casparcg/commitdiff
2.1.0: Merged in trunk.Merged revision(s) 1895-1896 from server/trunk:
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 15 Dec 2011 17:30:38 +0000 (17:30 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 15 Dec 2011 17:30:38 +0000 (17:30 +0000)
- Fixed inconsistent INFO xml with transition producer.
- Fixed LOOP query.
- Send error on failed CALL.
........
- Less verbose logging. Improved received/sent log messages.
- Create path directories if they don't exists.
........

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@1897 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

common/env.cpp
core/producer/frame_producer.h
core/producer/layer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
protocol/amcp/AMCPCommandQueue.cpp
protocol/amcp/AMCPCommandsImpl.cpp
protocol/amcp/AMCPCommandsImpl.h
protocol/amcp/AMCPProtocolStrategy.cpp
protocol/util/AsyncEventServer.cpp

index b9d5fec3af589eca0d8eb96e73172d477bca5694..b4ad9dda49fb665431b84a949e3b2558c741ad06 100644 (file)
@@ -71,6 +71,30 @@ void configure(const std::wstring& filename)
                CASPAR_LOG(error) << L" ### Invalid configuration file. ###";\r
                throw;\r
        }\r
+\r
+       try\r
+       {\r
+               auto media_path = boost::filesystem::wpath(media);\r
+               if(!boost::filesystem::exists(media_path))\r
+                       boost::filesystem::create_directory(media_path);\r
+               \r
+               auto log_path = boost::filesystem::wpath(log);\r
+               if(!boost::filesystem::exists(log_path))\r
+                       boost::filesystem::create_directory(log_path);\r
+               \r
+               auto template_path = boost::filesystem::wpath(ftemplate);\r
+               if(!boost::filesystem::exists(template_path))\r
+                       boost::filesystem::create_directory(template_path);\r
+               \r
+               auto data_path = boost::filesystem::wpath(data);\r
+               if(!boost::filesystem::exists(data_path))\r
+                       boost::filesystem::create_directory(data_path);\r
+       }\r
+       catch(...)\r
+       {\r
+               CASPAR_LOG_CURRENT_EXCEPTION();\r
+               CASPAR_LOG(error) << L"Failed to create configured directories.";\r
+       }\r
 }\r
        \r
 const std::wstring& media_folder()\r
index b1b717b8809c98ea38cbcbbf98671e930411fa4c..a87e6537b8edad881f5d61da6346f9f4de24c95b 100644 (file)
@@ -22,6 +22,7 @@
 #pragma once\r
 \r
 #include <common/memory/safe_ptr.h>\r
+#include <common/exception/exceptions.h>\r
 \r
 #include <boost/noncopyable.hpp>\r
 \r
@@ -61,9 +62,7 @@ public:
 \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
+               BOOST_THROW_EXCEPTION(not_supported());\r
        }\r
 \r
        virtual safe_ptr<frame_producer> get_following_producer() const {return frame_producer::empty();}  // nothrow\r
index f94dee40177e16faf5715d7ddc3d016ea94b2b7c..f7d3253d861d78fa6465036313e808258c7c6b7a 100644 (file)
@@ -148,8 +148,8 @@ public:
 \r
                info.add(L"nb_frames",   nb_frames == std::numeric_limits<int64_t>::max() ? -1 : nb_frames);\r
                info.add(L"frames-left", nb_frames == std::numeric_limits<int64_t>::max() ? -1 : (foreground_->nb_frames() - frame_number_ - auto_play_delta_));\r
-               info.add_child(L"foreground", foreground_->info());\r
-               info.add_child(L"background", background_->info());\r
+               info.add_child(L"foreground.producer", foreground_->info());\r
+               info.add_child(L"background.producer", background_->info());\r
                return info;\r
        }\r
 };\r
index b6a05607410f78e5dc37e936373c8e297d51f5dd..84ab5b9cbbfe0b69dbb0d947639f9c376c7017be 100644 (file)
@@ -234,7 +234,7 @@ public:
                                        \r
        std::wstring do_call(const std::wstring& param)\r
        {\r
-               static const boost::wregex loop_exp(L"LOOP\\s*(?<VALUE>\\d?)", boost::regex::icase);\r
+               static const boost::wregex loop_exp(L"LOOP\\s*(?<VALUE>\\d?)?", boost::regex::icase);\r
                static const boost::wregex seek_exp(L"SEEK\\s+(?<VALUE>\\d+)", boost::regex::icase);\r
                \r
                boost::wsmatch what;\r
index 72b67333e236eccb3da0a379bab0aa49d038ea8d..3a0f4ddad4a574375ea1cad0525af6857a7463c8 100644 (file)
@@ -49,19 +49,19 @@ void AMCPCommandQueue::AddCommand(AMCPCommandPtr pCurrentCommand)
                        try\r
                        {\r
                                if(pCurrentCommand->Execute()) \r
-                                       CASPAR_LOG(info) << "Executed command: " << pCurrentCommand->print();\r
+                                       CASPAR_LOG(trace) << "Executed command: " << pCurrentCommand->print();\r
                                else \r
-                                       CASPAR_LOG(info) << "Failed to execute command: " << pCurrentCommand->print();\r
+                                       CASPAR_LOG(warning) << "Failed to execute command: " << pCurrentCommand->print();\r
                        }\r
                        catch(...)\r
                        {\r
                                CASPAR_LOG_CURRENT_EXCEPTION();\r
-                               CASPAR_LOG(info) << "Failed to execute command:" << pCurrentCommand->print();\r
+                               CASPAR_LOG(error) << "Failed to execute command:" << pCurrentCommand->print();\r
                        }\r
                                \r
                        pCurrentCommand->SendReply();\r
                        \r
-                       CASPAR_LOG(info) << "Ready for a new command";\r
+                       CASPAR_LOG(trace) << "Ready for a new command";\r
                }\r
                catch(...)\r
                {\r
index daffd519f26198c2d4e67297a78cfc2f20862b49..1c73aeda166bb4a3213cfc4e7794e92c2cf1742e 100644 (file)
@@ -227,19 +227,23 @@ bool CallCommand::DoExecute()
        try\r
        {\r
                auto what = _parameters.at(0);\r
-\r
-               std::wstring param = _parameters2.at(1);\r
-               for(auto it = std::begin(_parameters2)+2; it != std::end(_parameters2); ++it)\r
-                       param += L" " + *it;\r
-               \r
+                               \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
-                       result = GetChannel()->stage()->call(GetLayerIndex(), true, param);\r
+               if(what == L"B" || what == L"F")\r
+               {\r
+                       std::wstring param;\r
+                       for(auto it = std::begin(_parameters2)+1; it != std::end(_parameters2); ++it, param += L" ")\r
+                               param += *it;\r
+                       result = GetChannel()->stage()->call(GetLayerIndex(), what == L"F", boost::trim_copy(param));\r
+               }\r
                else\r
-                       result = GetChannel()->stage()->call(GetLayerIndex(), true, _parameters.at(0) + L" " + param);\r
-       \r
+               {\r
+                       std::wstring param;\r
+                       for(auto it = std::begin(_parameters2); it != std::end(_parameters2); ++it, param += L" ")\r
+                               param += *it;\r
+                       result = GetChannel()->stage()->call(GetLayerIndex(), true, boost::trim_copy(param));\r
+               }\r
+\r
                if(!result.timed_wait(boost::posix_time::seconds(2)))\r
                        BOOST_THROW_EXCEPTION(timed_out());\r
 \r
index 1e5be6eb7cf1305b117674a30aee696b0b0f7ff5..c17766880ed5a0e85224ff33614e92cdef2bae40 100644 (file)
@@ -38,7 +38,7 @@ class DiagnosticsCommand : public AMCPCommandBase<false, AddToQueue, 0>
        bool DoExecute();\r
 };\r
 \r
-class CallCommand : public AMCPCommandBase<true, AddToQueue, 2>\r
+class CallCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
 {\r
        std::wstring print() const { return L"CallCommand";}\r
        bool DoExecute();\r
index 46dcfb3217615028c159077740ddec5b92866889..d7ed9a6452bf0ce30292165f7e9a5e3d71cf6291 100644 (file)
@@ -156,7 +156,7 @@ AMCPCommandPtr AMCPProtocolStrategy::InterpretCommandString(const std::wstring&
        AMCPCommandPtr pCommand;\r
        MessageParserState state = New;\r
 \r
-       CASPAR_LOG(info) << message;\r
+       CASPAR_LOG(info) << L"Received: " << message;\r
 \r
        std::size_t tokensInMessage = TokenizeMessage(message, &tokens);\r
 \r
index e326f6e96ee951bca95fabc3990f76b4074faf9b..9c55c89400ac15e38c93bc499f17f0ec8e8c6ebe 100644 (file)
@@ -434,10 +434,10 @@ void AsyncEventServer::DoSend(SocketInfo& socketInfo) {
                        }\r
                        else {\r
                                if(sentBytes == bytesToSend) {\r
-                                       if(sentBytes < 200)\r
-                                               CASPAR_LOG(info) << "Sent " << socketInfo.sendQueue_.front().c_str() << TEXT(" to ") << socketInfo.host_.c_str();\r
+                                       if(sentBytes < 512)\r
+                                               CASPAR_LOG(info) << "Sent: " << socketInfo.sendQueue_.front().c_str() << TEXT(" to ") << socketInfo.host_.c_str();\r
                                        else\r
-                                               CASPAR_LOG(info) << "Sent more than 200 bytes to " << socketInfo.host_.c_str();\r
+                                               CASPAR_LOG(info) << "Sent more than 512 bytes to " << socketInfo.host_.c_str();\r
 \r
                                        socketInfo.currentlySending_.resize(0);\r
                                        socketInfo.currentlySendingOffset_ = 0;\r