#include <boost/make_shared.hpp>\r
#include <boost/filesystem/convenience.hpp>\r
#include <boost/date_time/posix_time/posix_time.hpp>\r
+#include <boost/algorithm/string.hpp>\r
\r
#include <boost/log/core/core.hpp>\r
\r
\r
auto stream_sink = boost::make_shared<stream_sink_type>(stream_backend);\r
\r
+#ifdef NDEBUG\r
+ stream_sink->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= info);\r
+#else\r
+ stream_sink->set_filter(boost::log::filters::attr<severity_level>(boost::log::sources::aux::severity_attribute_name<wchar_t>::get()) >= trace);\r
+#endif\r
+\r
stream_sink->locked_backend()->set_formatter(&my_formatter);\r
\r
boost::log::wcore::get()->add_sink(stream_sink);\r
}\r
}\r
\r
+void set_log_level(const std::wstring& lvl)\r
+{ \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
+ 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
+ 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
+ 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
+ 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
}}
\ No newline at end of file
{CASPAR_LOG(error) << boost::current_exception_diagnostic_information().c_str();}\\r
catch(...){}\r
\r
+void set_log_level(const std::wstring& lvl);\r
+\r
}}\r
\r
#if defined(_MSC_VER)\r
producer = create_color_producer(my_frame_factory, params);\r
\r
if(producer == frame_producer::empty())\r
- BOOST_THROW_EXCEPTION(file_not_found() << msg_info("No match found for supplied commands. Check syntax.") << arg_value_info(params.size() > 0 ? narrow(params[0]) : ""));\r
+ {\r
+ std::wstring str;\r
+ BOOST_FOREACH(auto& param, params)\r
+ str += param + L" ";\r
+ BOOST_THROW_EXCEPTION(file_not_found() << msg_info("No match found for supplied commands. Check syntax.") << arg_value_info(narrow(str)));\r
+ }\r
\r
return producer;\r
}\r
strcpy(prev, line);\r
sanitize((uint8_t*)line);\r
\r
- CASPAR_LOG(trace) << L"[FFMPEG] [" << av_clip(level>>3, 0, 6) << L"] " << line;\r
+ if(level == AV_LOG_DEBUG)\r
+ CASPAR_LOG(debug) << L"[FFMPEG] " << line;\r
+ else if(level == AV_LOG_INFO)\r
+ CASPAR_LOG(info) << L"[FFMPEG] " << line;\r
+ else if(level == AV_LOG_WARNING)\r
+ CASPAR_LOG(warning) << L"[FFMPEG] " << line;\r
+ else if(level == AV_LOG_ERROR)\r
+ CASPAR_LOG(error) << L"[FFMPEG] " << line;\r
+ else if(level == AV_LOG_FATAL)\r
+ CASPAR_LOG(fatal) << L"[FFMPEG] " << line;\r
+ else\r
+ CASPAR_LOG(trace) << L"[FFMPEG] " << line;\r
\r
//colored_fputs(av_clip(level>>3, 0, 6), line);\r
}\r
THROW_ON_ERROR2(avformat_open_input(&weak_format_context_, narrow(filename).c_str(), nullptr, nullptr), print());\r
\r
format_context_.reset(weak_format_context_, av_close_input_file);\r
+\r
+ av_dump_format(weak_format_context_, 0, narrow(filename).c_str(), 0);\r
\r
THROW_ON_ERROR2(avformat_find_stream_info(format_context_.get(), nullptr), print());\r
\r
\r
#include <common/env.h>\r
\r
+#include <common/log/log.h>\r
+\r
#include <core/producer/frame_producer.h>\r
#include <core/video_format.h>\r
-#include <modules/flash/flash.h>\r
-#include <modules/flash/producer/flash_producer.h>\r
-#include <modules/flash/producer/cg_producer.h>\r
#include <core/producer/transition/transition_producer.h>\r
-\r
#include <core/producer/frame/image_transform.h>\r
#include <core/producer/frame/audio_transform.h>\r
#include <core/mixer/mixer.h>\r
#include <core/consumer/output.h>\r
\r
+#include <modules/flash/flash.h>\r
+#include <modules/flash/producer/flash_producer.h>\r
+#include <modules/flash/producer/cg_producer.h>\r
+\r
#include <algorithm>\r
#include <locale>\r
#include <fstream>\r
return true;\r
}\r
\r
+bool LogCommand::DoExecute()\r
+{\r
+ if(_parameters.at(0) == L"LEVEL")\r
+ log::set_log_level(_parameters.at(1));\r
+\r
+ SetReplyString(TEXT("202 LOG OK\r\n"));\r
+\r
+ return true;\r
+}\r
+\r
bool CGCommand::DoExecute()\r
{\r
std::wstring command = _parameters[0];\r
bool DoExecute();\r
};\r
\r
+class LogCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
+{\r
+ std::wstring print() const { return L"LogCommand";}\r
+ bool DoExecute();\r
+};\r
\r
class CGCommand : public AMCPCommandBase<true, AddToQueue, 1>\r
{\r
else if(s == TEXT("STOP")) return std::make_shared<StopCommand>();\r
else if(s == TEXT("CLEAR")) return std::make_shared<ClearCommand>();\r
else if(s == TEXT("PRINT")) return std::make_shared<PrintCommand>();\r
+ else if(s == TEXT("LOG")) return std::make_shared<LogCommand>();\r
else if(s == TEXT("CG")) return std::make_shared<CGCommand>();\r
else if(s == TEXT("DATA")) return std::make_shared<DataCommand>();\r
else if(s == TEXT("CINF")) return std::make_shared<CinfCommand>();\r