From: Helge Norberg Date: Thu, 16 Jan 2014 10:17:15 +0000 (+0100) Subject: FFmpeg: reenabled curiously disabled logging suppression during thumbnail genera... X-Git-Tag: 2.0.7_Beta~8 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8187cd6f479fd703bfae4249584a56e05ca027e5;p=casparcg FFmpeg: reenabled curiously disabled logging suppression during thumbnail generation/media info extraction CG commands: avoid logging stacktraces for user related errors, but return 404 CG ERROR instead --- diff --git a/modules/ffmpeg/ffmpeg.cpp b/modules/ffmpeg/ffmpeg.cpp index 28cff6f12..0b94107ed 100644 --- a/modules/ffmpeg/ffmpeg.cpp +++ b/modules/ffmpeg/ffmpeg.cpp @@ -199,7 +199,7 @@ std::shared_ptr temporary_disable_logging_for_thread(bool disable) void log_for_thread(void* ptr, int level, const char* fmt, va_list vl) { win32_exception::ensure_handler_installed_for_thread("ffmpeg-thread"); - //if (get_disable_logging_for_thread().get() == nullptr) // It does not matter what the value of the bool is + if (get_disable_logging_for_thread().get() == nullptr) // It does not matter what the value of the bool is log_callback(ptr, level, fmt, vl); } diff --git a/protocol/amcp/AMCPCommandsImpl.cpp b/protocol/amcp/AMCPCommandsImpl.cpp index dc6642fe5..a1f9c2223 100644 --- a/protocol/amcp/AMCPCommandsImpl.cpp +++ b/protocol/amcp/AMCPCommandsImpl.cpp @@ -1423,7 +1423,15 @@ bool CGCommand::DoExecutePlay() } int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"PLAY %1%") % layer).str()).wait(); + try + { + GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"PLAY %1%") % layer).str()).wait(); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } else { @@ -1446,7 +1454,15 @@ bool CGCommand::DoExecuteStop() } int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"STOP %1%") % layer).str()).wait(); + try + { + GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"STOP %1%") % layer).str()).wait(); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } else { @@ -1470,7 +1486,15 @@ bool CGCommand::DoExecuteNext() int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"NEXT %1%") % layer).str()).wait(); + try + { + GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"NEXT %1%") % layer).str()).wait(); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } else { @@ -1493,7 +1517,16 @@ bool CGCommand::DoExecuteRemove() } int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"REMOVE %1%") % layer).str()).wait(); + + try + { + GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"REMOVE %1%") % layer).str()).wait(); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } else { @@ -1535,7 +1568,15 @@ bool CGCommand::DoExecuteUpdate() int layer = _ttoi(_parameters.at(1).c_str()); - GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"UPDATE %1% \"%2%\"") % layer % dataString).str()).wait(); + try + { + GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"UPDATE %1% \"%2%\"") % layer % dataString).str()).wait(); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } catch(...) { @@ -1559,10 +1600,19 @@ bool CGCommand::DoExecuteInvoke() SetReplyString(TEXT("403 CG ERROR\r\n")); return false; } + int layer = _ttoi(_parameters[1].c_str()); - auto result = GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"INVOKE %1% \"%2%\"") % layer % _parameters.at_original(2)).str()).get(); - replyString << result << TEXT("\r\n"); + try + { + auto result = GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"INVOKE %1% \"%2%\"") % layer % _parameters.at_original(2)).str()).get(); + replyString << result << TEXT("\r\n"); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } else { @@ -1588,14 +1638,31 @@ bool CGCommand::DoExecuteInfo() } int layer = _ttoi(_parameters[1].c_str()); - auto desc = GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"INFO %1%") % layer).str()).get(); + + try + { + auto desc = GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"INFO %1%") % layer).str()).get(); - replyString << desc << TEXT("\r\n"); + replyString << desc << TEXT("\r\n"); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } else { - auto info = GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"INFO")).str()).get(); - replyString << info << TEXT("\r\n"); + try + { + auto info = GetChannel()->stage()->call(GetLayerIndex(9999), true, (boost::wformat(L"INFO")).str()).get(); + replyString << info << TEXT("\r\n"); + } + catch (const caspar::not_supported&) + { + SetReplyString(TEXT("404 CG ERROR\r\n")); + return true; + } } SetReplyString(replyString.str());