if(boost::log::extract<boost::log::attributes::current_thread_id::held_type>(L"ThreadID", rec.attribute_values(), lambda::var(thread_id) = lambda::_1))\r
strm << L"[" << thread_id << L"] ";\r
\r
+\r
severity_level severity;\r
if(boost::log::extract<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get(), rec.attribute_values(), lambda::var(severity) = lambda::_1))\r
+ {\r
+ std::stringstream ss;\r
+ ss << severity;\r
strm << L"[" << severity << L"] ";\r
+ for(int n = 0; n < 7-static_cast<int>(ss.str().size()); ++n)\r
+ strm << L" ";\r
+ }\r
\r
strm << rec.message();\r
}\r
\r
void set_log_level(const std::wstring& lvl)\r
{ \r
- if(boost::iequals(lvl, L"trace "))\r
+ if(boost::iequals(lvl, L"trace"))\r
boost::log::wcore::get()->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= trace);\r
- else if(boost::iequals(lvl, L"debug "))\r
+ else if(boost::iequals(lvl, L"debug"))\r
boost::log::wcore::get()->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= debug);\r
- else if(boost::iequals(lvl, L"info "))\r
+ else if(boost::iequals(lvl, L"info"))\r
boost::log::wcore::get()->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= info);\r
else if(boost::iequals(lvl, L"warning"))\r
boost::log::wcore::get()->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= warning);\r
- else if(boost::iequals(lvl, L"error "))\r
+ else if(boost::iequals(lvl, L"error"))\r
boost::log::wcore::get()->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= error);\r
- else if(boost::iequals(lvl, L"fatal "))\r
+ else if(boost::iequals(lvl, L"fatal"))\r
boost::log::wcore::get()->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= fatal);\r
}\r
\r
\r
bool ready() const\r
{\r
- return packets_.size() >= 8;\r
+ return packets_.size() > 10;\r
}\r
\r
uint32_t nb_frames() const\r
{\r
return 0;//std::max<int64_t>(nb_frames_, file_frame_number_);\r
}\r
+\r
+ std::wstring print() const\r
+ { \r
+ return L"[audio_decoder] " + widen(codec_context_->codec->long_name);\r
+ }\r
};\r
\r
audio_decoder::audio_decoder(const safe_ptr<AVFormatContext>& context, const core::video_format_desc& format_desc) : impl_(new implementation(context, format_desc)){}\r
std::shared_ptr<core::audio_buffer> audio_decoder::poll(){return impl_->poll();}\r
uint32_t audio_decoder::nb_frames() const{return impl_->nb_frames();}\r
uint32_t audio_decoder::file_frame_number() const{return impl_->file_frame_number_;}\r
+std::wstring audio_decoder::print() const{return impl_->print();}\r
\r
}}
\ No newline at end of file
uint32_t nb_frames() const;\r
\r
uint32_t file_frame_number() const;\r
+\r
+ std::wstring print() const;\r
private:\r
struct implementation;\r
safe_ptr<implementation> impl_;\r
try\r
{\r
video_decoder_.reset(new video_decoder(input_.context()));\r
+ CASPAR_LOG(info) << print() << L" " << video_decoder_->print();\r
}\r
catch(averror_stream_not_found&)\r
{\r
- CASPAR_LOG(warning) << print() << " No video-stream found. Running without video."; \r
+ //CASPAR_LOG(warning) << print() << " No video-stream found. Running without video."; \r
}\r
catch(...)\r
{\r
try\r
{\r
audio_decoder_.reset(new audio_decoder(input_.context(), frame_factory->get_video_format_desc()));\r
+ CASPAR_LOG(info) << print() << L" " << audio_decoder_->print();\r
}\r
catch(averror_stream_not_found&)\r
{\r
- CASPAR_LOG(warning) << print() << " No audio-stream found. Running without audio."; \r
+ //CASPAR_LOG(warning) << print() << " No audio-stream found. Running without audio."; \r
}\r
catch(...)\r
{\r
, height_(codec_context_->height)\r
{\r
file_frame_number_ = 0;\r
- CASPAR_LOG(debug) << "[video_decoder] " << context->streams[index_]->codec->codec->long_name;\r
}\r
\r
void push(const std::shared_ptr<AVPacket>& packet)\r
{\r
return std::max<uint32_t>(nb_frames_, file_frame_number_);\r
}\r
+\r
+ std::wstring print() const\r
+ { \r
+ return L"[video_decoder] " + widen(codec_context_->codec->long_name);\r
+ }\r
};\r
\r
video_decoder::video_decoder(const safe_ptr<AVFormatContext>& context) : impl_(new implementation(context)){}\r
uint32_t video_decoder::nb_frames() const{return impl_->nb_frames();}\r
uint32_t video_decoder::file_frame_number() const{return impl_->file_frame_number_;}\r
bool video_decoder::is_progressive() const{return impl_->is_progressive_;}\r
+std::wstring video_decoder::print() const{return impl_->print();}\r
\r
}}
\ No newline at end of file
\r
bool is_progressive() const;\r
\r
+ std::wstring print() const;\r
+\r
private:\r
struct implementation;\r
safe_ptr<implementation> impl_;\r
}\r
else if(str.find(TEXT("OnCommand")) != std::wstring::npos) {\r
//this is how templatehost 1.8 reports that a command has been received\r
- CASPAR_LOG(debug) << print_() << L" Command: " << str;\r
+ CASPAR_LOG(debug) << print_() << L" [command] " << str;\r
bCallSuccessful_ = true;\r
}\r
else if(str.find(TEXT("Activity")) != std::wstring::npos)\r
{\r
- CASPAR_LOG(debug) << print_() << L" Activity: " << str;\r
+ CASPAR_LOG(debug) << print_() << L" [activity] " << str;\r
\r
//this is how templatehost 1.7 reports that a command has been received\r
if(str.find(TEXT("Command recieved")) != std::wstring::npos)\r
}\r
else if(str.find(TEXT("OnNotify")) != std::wstring::npos)\r
{\r
- CASPAR_LOG(info) << print_() << L" Notification: " << str;\r
+ CASPAR_LOG(info) << print_() << L" [notification] " << str;\r
\r
//if(pFlashProducer_ != 0 && pFlashProducer_->pMonitor_) {\r
// std::wstring::size_type pos = str.find(TEXT('@'));\r
}\r
else if(str.find(TEXT("IsEmpty")) != std::wstring::npos)\r
{\r
- CASPAR_LOG(info) << print_() << L" Empty.";\r
+ CASPAR_LOG(trace) << print_() << L" Empty.";\r
ATLTRACE(_T("ShockwaveFlash::IsEmpty\n"));\r
bIsEmpty_ = true;\r
}\r
else if(str.find(TEXT("OnError")) != std::wstring::npos)\r
{\r
- CASPAR_LOG(error) << print_() << L" Error: " << str;\r
+ CASPAR_LOG(error) << print_() << L" [error] " << str;\r
}\r
else if(str.find(TEXT("OnDebug")) != std::wstring::npos)\r
{\r
- CASPAR_LOG(error) << print_() << L" Debug: " << str;\r
+ CASPAR_LOG(debug) << print_() << L" [debug] " << str;\r
}\r
//else if(str.find(TEXT("OnTemplateDescription")) != std::wstring::npos)\r
//{\r
AMCPCommandPtr pCommand;\r
MessageParserState state = New;\r
\r
- CASPAR_LOG(info) << L"Received: " << message;\r
-\r
std::size_t tokensInMessage = TokenizeMessage(message, &tokens);\r
\r
//parse the message one token at the time\r
\r
void CIIProtocolStrategy::ProcessMessage(const std::wstring& message)\r
{\r
- CASPAR_LOG(debug) << L"Received: " << message.c_str();\r
-\r
std::vector<std::wstring> tokens;\r
int tokenCount = TokenizeMessage(message, &tokens);\r
\r
\r
#include <common/log/log.h>\r
\r
+#include <boost/algorithm/string/replace.hpp>\r
+\r
#include <string>\r
#include <algorithm>\r
\r
\r
//Convert to widechar\r
if(ConvertMultiByteToWideChar(pProtocolStrategy_->GetCodepage(), pSI->recvBuffer_, recvResult + pSI->recvLeftoverOffset_, pSI->wideRecvBuffer_, pSI->recvLeftoverOffset_))\r
+ {\r
+ auto msg = std::wstring(pSI->wideRecvBuffer_.begin(), pSI->wideRecvBuffer_.end());\r
+ boost::replace_all(msg, L"\n", L"\\n");\r
+ boost::replace_all(msg, L"\r", L"\\r");\r
+\r
+ CASPAR_LOG(info) << L"Received message from " << pSI->host_.c_str() << ": "<< msg;\r
pProtocolStrategy_->Parse(&pSI->wideRecvBuffer_[0], pSI->wideRecvBuffer_.size(), pSI);\r
+ }\r
else \r
CASPAR_LOG(error) << "Read from " << pSI->host_.c_str() << TEXT(" failed, could not convert command to UNICODE");\r
\r
- \r
-\r
maxRecvLength = sizeof(pSI->recvBuffer_)-pSI->recvLeftoverOffset_;\r
recvResult = recv(pSI->socket_, pSI->recvBuffer_+pSI->recvLeftoverOffset_, maxRecvLength, 0);\r
}\r
}\r
else {\r
if(sentBytes == bytesToSend) {\r
+ \r
if(sentBytes < 512)\r
+ {\r
+ boost::replace_all(socketInfo.sendQueue_.front(), L"\n", L"\\n");\r
+ boost::replace_all(socketInfo.sendQueue_.front(), L"\r", L"\\r");\r
CASPAR_LOG(info) << L"Sent message to " << socketInfo.host_.c_str() << L": " << socketInfo.sendQueue_.front().c_str();\r
+ }\r
else\r
CASPAR_LOG(info) << "Sent more than 512 bytes to " << socketInfo.host_.c_str();\r
\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
<IgnoreSpecificDefaultLibraries>LIBC.lib</IgnoreSpecificDefaultLibraries>\r
<GenerateDebugInformation>true</GenerateDebugInformation>\r
- <GenerateMapFile>false</GenerateMapFile>\r
- <MapExports>false</MapExports>\r
+ <GenerateMapFile>true</GenerateMapFile>\r
+ <MapExports>true</MapExports>\r
<SubSystem>Console</SubSystem>\r
<OptimizeReferences>\r
</OptimizeReferences>\r