<ClInclude Include="utility\string.h" />\r
<ClInclude Include="utility\timer.h" />\r
<ClInclude Include="utility\tweener.h" />\r
- <ClInclude Include="utility\utf8conv.h" />\r
- <ClInclude Include="utility\utf8conv_inl.h" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="diagnostics\graph.cpp">\r
<ClInclude Include="utility\param.h">\r
<Filter>source\utility</Filter>\r
</ClInclude>\r
- <ClInclude Include="utility\utf8conv.h">\r
- <Filter>source\utility</Filter>\r
- </ClInclude>\r
- <ClInclude Include="utility\utf8conv_inl.h">\r
- <Filter>source\utility</Filter>\r
- </ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
\r
public:\r
\r
- explicit executor(const std::wstring& name) : name_(narrow(name)) // noexcept\r
+ explicit executor(const std::wstring& name) : name_(u8(name)) // noexcept\r
{\r
is_running_ = true;\r
thread_ = boost::thread([this]{run();});\r
auto p = impl_;\r
context::begin_invoke([=]\r
{ \r
- set_text(narrow(value));\r
+ set_text(u8(value));\r
}, high_priority);\r
}\r
\r
boost::property_tree::read_xml(file, pt, boost::property_tree::xml_parser::trim_whitespace | boost::property_tree::xml_parser::no_comments);\r
\r
auto paths = pt.get_child(L"configuration.paths");\r
- media = widen(paths.get(L"media-path", initialPath + L"\\media\\"));\r
- log = widen(paths.get(L"log-path", initialPath + L"\\log\\"));\r
- ftemplate = complete(wpath(widen(paths.get(L"template-path", initialPath + L"\\template\\")))).string(); \r
- data = widen(paths.get(L"data-path", initialPath + L"\\data\\"));\r
+ media = u16(paths.get(L"media-path", initialPath + L"\\media\\"));\r
+ log = u16(paths.get(L"log-path", initialPath + L"\\log\\"));\r
+ ftemplate = complete(wpath(u16(paths.get(L"template-path", initialPath + L"\\template\\")))).string(); \r
+ data = u16(paths.get(L"data-path", initialPath + L"\\data\\"));\r
}\r
catch(...)\r
{\r
\r
#include "../stdafx.h"\r
\r
-#include "utf8conv.h"\r
+#pragma warning(push, 1)\r
+\r
+#include <boost/locale.hpp>\r
\r
namespace caspar {\r
\r
-std::wstring widen(const std::string& str)\r
+std::wstring u16(const std::string& str)\r
{\r
- return utf8util::UTF16FromUTF8(str);//std::wstring(str.begin(), str.end());\r
+ return boost::locale::conv::utf_to_utf<wchar_t>(str);//std::wstring(str.begin(), str.end());\r
}\r
\r
-std::wstring widen(const std::wstring& str)\r
+std::wstring u16(const std::wstring& str)\r
{\r
return str;\r
}\r
\r
-std::string narrow(const std::wstring& str)\r
+std::string u8(const std::wstring& str)\r
{\r
- return utf8util::UTF8FromUTF16(str);//std::string(str.begin(), str.end());\r
+ return boost::locale::conv::utf_to_utf<char>(str);//std::string(str.begin(), str.end());\r
}\r
\r
-std::string narrow(const std::string& str)\r
+std::string u8(const std::string& str)\r
{\r
return str ;\r
}\r
\r
namespace caspar {\r
\r
-std::wstring widen(const std::string& str);\r
-std::wstring widen(const std::wstring& str);\r
-std::string narrow(const std::wstring& str); \r
-std::string narrow(const std::string& str);\r
+std::wstring u16(const std::string& str);\r
+std::wstring u16(const std::wstring& str);\r
+std::string u8(const std::wstring& str); \r
+std::string u8(const std::string& str);\r
\r
template <typename T>\r
inline T lexical_cast_or_default(const std::wstring str, T fail_value = T())\r
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////\r
-//\r
-// FILE: utf8conv.h\r
-//\r
-// Header file defining prototypes of helper functions for converting \r
-// strings between Unicode UTF-8 and UTF-16.\r
-// (The implementation file is "utf8conv_inl.h").\r
-//\r
-// UTF-8 text is stored in std::string; \r
-// UTF-16 text is stored in std::wstring.\r
-//\r
-// This code just uses Win32 Platform SDK and C++ standard library; \r
-// so it can be used also with the Express editions of Visual Studio.\r
-//\r
-//\r
-// Original code: February 4th, 2011\r
-// Last update: October 15th, 2011\r
-//\r
-// - Added more information to the utf8_conversion_error class\r
-// (like the return code of ::GetLastError());\r
-// moreover, the class now derives from std::runtime_error.\r
-//\r
-// - Added conversion function overloads taking raw C strings as input.\r
-// (This is more efficient when there are raw C strings already\r
-// available, because it avoids the creation of temporary\r
-// new std::[w]string's.)\r
-//\r
-// - UTF-8 conversion functions now detect invalid UTF-8 sequences\r
-// thanks to MB_ERR_INVALID_CHARS flag, and throw an exception\r
-// in this case.\r
-//\r
-//\r
-// by Giovanni Dicanio <gdicanio@mvps.org>\r
-//\r
-//////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-#pragma once\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// INCLUDES\r
-//------------------------------------------------------------------------\r
-\r
-#include <stdexcept> // std::runtime_error\r
-#include <string> // STL string classes\r
-\r
-\r
-\r
-namespace utf8util {\r
-\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// Exception class representing an error occurred during UTF-8 conversion.\r
-//------------------------------------------------------------------------\r
-class utf8_conversion_error \r
- : public std::runtime_error\r
-{\r
-public:\r
- \r
- //\r
- // Naming convention note:\r
- // -----------------------\r
- //\r
- // This exception class is derived from std::runtime_error class,\r
- // so I chose to use the same naming convention of STL classes\r
- // (e.g. do_something_intersting() instead of DoSomethingInteresting()).\r
- //\r
-\r
-\r
- // Error code type \r
- // (a DWORD, as the return value type from ::GetLastError())\r
- typedef unsigned long error_code_type;\r
-\r
- // Type of conversion\r
- enum conversion_type\r
- {\r
- conversion_utf8_from_utf16, // UTF-16 ---> UTF-8\r
- conversion_utf16_from_utf8 // UTF-8 ---> UTF-16\r
- };\r
-\r
-\r
- // Constructs an UTF-8 conversion error exception \r
- // with a raw C string message, conversion type and error code.\r
- utf8_conversion_error(\r
- const char * message, \r
- conversion_type conversion, \r
- error_code_type error_code\r
- );\r
-\r
-\r
- // Constructs an UTF-8 conversion error exception \r
- // with a std::string message, conversion type and error code.\r
- utf8_conversion_error(\r
- const std::string & message, \r
- conversion_type conversion, \r
- error_code_type error_code\r
- );\r
-\r
-\r
- // Returns the type of conversion (UTF-8 from UTF-16, or vice versa)\r
- conversion_type conversion() const;\r
-\r
-\r
- // Returns the error code occurred during the conversion\r
- // (which is typically the return value of ::GetLastError()).\r
- error_code_type error_code() const;\r
-\r
-\r
-\r
- //\r
- // IMPLEMENTATION\r
- //\r
-private:\r
- conversion_type m_conversion; // kind of conversion\r
- error_code_type m_error_code; // error code\r
-};\r
-\r
-//------------------------------------------------------------------------\r
-\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// Converts a string from UTF-8 to UTF-16.\r
-// On error, can throw an utf8_conversion_error exception.\r
-//------------------------------------------------------------------------\r
-std::wstring UTF16FromUTF8(const std::string & utf8);\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// Converts a raw C string from UTF-8 to UTF-16.\r
-// On error, can throw an utf8_conversion_error exception.\r
-// If the input pointer is NULL, an empty string is returned.\r
-//------------------------------------------------------------------------\r
-std::wstring UTF16FromUTF8(const char * utf8);\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// Converts a string from UTF-16 to UTF-8.\r
-// On error, can throw an utf8_conversion_error exception.\r
-//------------------------------------------------------------------------\r
-std::string UTF8FromUTF16(const std::wstring & utf16);\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// Converts a raw C string from UTF-16 to UTF-8.\r
-// On error, can throw an utf8_conversion_error exception.\r
-// If the input pointer is NULL, an empty string is returned.\r
-//------------------------------------------------------------------------\r
-std::string UTF8FromUTF16(const wchar_t * utf16);\r
-\r
-\r
-} // namespace utf8util\r
-\r
-\r
-\r
-#include "utf8conv_inl.h" // inline implementations\r
-\r
-\r
-//////////////////////////////////////////////////////////////////////////\r
-\r
+++ /dev/null
-//////////////////////////////////////////////////////////////////////////\r
-//\r
-// FILE: utf8conv_inl.h\r
-//\r
-// by Giovanni Dicanio <gdicanio@mvps.org>\r
-//\r
-// Private header file containing implementations of inline functions.\r
-// The public header file for this module is "utf8conv.h"; \r
-// users should *not* #include this private header file directly.\r
-//\r
-//////////////////////////////////////////////////////////////////////////\r
-\r
-#pragma once\r
-\r
-\r
-#include <string.h> // strlen()\r
-\r
-#include <Windows.h> // Win32 Platform SDK main header\r
-\r
-\r
-\r
-namespace utf8util {\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// Implementation of utf8_conversion_error class methods\r
-//------------------------------------------------------------------------\r
-\r
-inline utf8_conversion_error::utf8_conversion_error(\r
- const char * message, \r
- conversion_type conversion, \r
- error_code_type error_code\r
- ) : \r
- std::runtime_error(message),\r
- m_conversion(conversion),\r
- m_error_code(error_code)\r
-{\r
-}\r
-\r
-\r
-inline utf8_conversion_error::utf8_conversion_error(\r
- const std::string & message, \r
- conversion_type conversion, \r
- error_code_type error_code\r
- ) : \r
- std::runtime_error(message),\r
- m_conversion(conversion),\r
- m_error_code(error_code)\r
-{\r
-}\r
-\r
-\r
-inline utf8_conversion_error::conversion_type utf8_conversion_error::conversion() const\r
-{\r
- return m_conversion;\r
-}\r
-\r
-\r
-inline utf8_conversion_error::error_code_type utf8_conversion_error::error_code() const\r
-{\r
- return m_error_code;\r
-}\r
-\r
-\r
-\r
-//------------------------------------------------------------------------\r
-// Implementation of module functions\r
-//------------------------------------------------------------------------\r
-\r
-\r
-inline std::wstring UTF16FromUTF8(const std::string & utf8)\r
-{\r
- //\r
- // Special case of empty input string\r
- //\r
- if (utf8.empty())\r
- return std::wstring();\r
-\r
-\r
- // Fail if an invalid input character is encountered\r
- const DWORD conversionFlags = MB_ERR_INVALID_CHARS;\r
-\r
-\r
- //\r
- // Get length (in wchar_t's) of resulting UTF-16 string\r
- //\r
- const int utf16Length = ::MultiByteToWideChar(\r
- CP_UTF8, // convert from UTF-8\r
- conversionFlags, // flags\r
- utf8.data(), // source UTF-8 string\r
- utf8.length(), // length (in chars) of source UTF-8 string\r
- NULL, // unused - no conversion done in this step\r
- 0 // request size of destination buffer, in wchar_t's\r
- );\r
- if (utf16Length == 0)\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
-\r
- throw utf8_conversion_error(\r
- (error == ERROR_NO_UNICODE_TRANSLATION) ? \r
- "Invalid UTF-8 sequence found in input string." :\r
- "Can't get length of UTF-16 string (MultiByteToWideChar failed).", \r
- utf8_conversion_error::conversion_utf16_from_utf8,\r
- error); \r
- }\r
-\r
-\r
- //\r
- // Allocate destination buffer for UTF-16 string\r
- //\r
- std::wstring utf16;\r
- utf16.resize(utf16Length);\r
-\r
-\r
- //\r
- // Do the conversion from UTF-8 to UTF-16\r
- //\r
- if ( ! ::MultiByteToWideChar(\r
- CP_UTF8, // convert from UTF-8\r
- 0, // validation was done in previous call, \r
- // so speed up things with default flags\r
- utf8.data(), // source UTF-8 string\r
- utf8.length(), // length (in chars) of source UTF-8 string\r
- &utf16[0], // destination buffer\r
- utf16.length() // size of destination buffer, in wchar_t's\r
- ) )\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
- throw utf8_conversion_error(\r
- "Can't convert string from UTF-8 to UTF-16 (MultiByteToWideChar failed).", \r
- utf8_conversion_error::conversion_utf16_from_utf8,\r
- error);\r
- }\r
-\r
-\r
- //\r
- // Return resulting UTF-16 string\r
- //\r
- return utf16;\r
-}\r
-\r
-\r
-\r
-inline std::wstring UTF16FromUTF8(const char * utf8)\r
-{\r
- //\r
- // Special case of empty input string\r
- //\r
- if (utf8 == NULL || *utf8 == '\0')\r
- return std::wstring();\r
-\r
-\r
- // Prefetch the length of the input UTF-8 string\r
- const int utf8Length = static_cast<int>(strlen(utf8));\r
-\r
- // Fail if an invalid input character is encountered\r
- const DWORD conversionFlags = MB_ERR_INVALID_CHARS;\r
-\r
- //\r
- // Get length (in wchar_t's) of resulting UTF-16 string\r
- //\r
- const int utf16Length = ::MultiByteToWideChar(\r
- CP_UTF8, // convert from UTF-8\r
- conversionFlags, // flags\r
- utf8, // source UTF-8 string\r
- utf8Length, // length (in chars) of source UTF-8 string\r
- NULL, // unused - no conversion done in this step\r
- 0 // request size of destination buffer, in wchar_t's\r
- );\r
- if (utf16Length == 0)\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
- throw utf8_conversion_error(\r
- (error == ERROR_NO_UNICODE_TRANSLATION) ? \r
- "Invalid UTF-8 sequence found in input string." :\r
- "Can't get length of UTF-16 string (MultiByteToWideChar failed).", \r
- utf8_conversion_error::conversion_utf16_from_utf8,\r
- error);\r
- }\r
-\r
-\r
- //\r
- // Allocate destination buffer for UTF-16 string\r
- //\r
- std::wstring utf16;\r
- utf16.resize(utf16Length);\r
-\r
-\r
- //\r
- // Do the conversion from UTF-8 to UTF-16\r
- //\r
- if ( ! ::MultiByteToWideChar(\r
- CP_UTF8, // convert from UTF-8\r
- 0, // validation was done in previous call, \r
- // so speed up things with default flags\r
- utf8, // source UTF-8 string\r
- utf8Length, // length (in chars) of source UTF-8 string\r
- &utf16[0], // destination buffer\r
- utf16.length() // size of destination buffer, in wchar_t's\r
- ) )\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
- throw utf8_conversion_error(\r
- "Can't convert string from UTF-8 to UTF-16 (MultiByteToWideChar failed).", \r
- utf8_conversion_error::conversion_utf16_from_utf8,\r
- error);\r
- }\r
-\r
-\r
- //\r
- // Return resulting UTF-16 string\r
- //\r
- return utf16;\r
-}\r
-\r
-\r
-\r
-inline std::string UTF8FromUTF16(const std::wstring & utf16)\r
-{\r
- //\r
- // Special case of empty input string\r
- //\r
- if (utf16.empty())\r
- return std::string();\r
-\r
-\r
- //\r
- // Get length (in chars) of resulting UTF-8 string\r
- //\r
- const int utf8Length = ::WideCharToMultiByte(\r
- CP_UTF8, // convert to UTF-8\r
- 0, // default flags\r
- utf16.data(), // source UTF-16 string\r
- utf16.length(), // source string length, in wchar_t's,\r
- NULL, // unused - no conversion required in this step\r
- 0, // request buffer size\r
- NULL, NULL // unused\r
- );\r
- if (utf8Length == 0)\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
- throw utf8_conversion_error(\r
- "Can't get length of UTF-8 string (WideCharToMultiByte failed).", \r
- utf8_conversion_error::conversion_utf8_from_utf16,\r
- error);\r
- }\r
-\r
-\r
- //\r
- // Allocate destination buffer for UTF-8 string\r
- //\r
- std::string utf8;\r
- utf8.resize(utf8Length);\r
-\r
-\r
- //\r
- // Do the conversion from UTF-16 to UTF-8\r
- //\r
- if ( ! ::WideCharToMultiByte(\r
- CP_UTF8, // convert to UTF-8\r
- 0, // default flags\r
- utf16.data(), // source UTF-16 string\r
- utf16.length(), // source string length, in wchar_t's,\r
- &utf8[0], // destination buffer\r
- utf8.length(), // destination buffer size, in chars\r
- NULL, NULL // unused\r
- ) )\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
- throw utf8_conversion_error(\r
- "Can't convert string from UTF-16 to UTF-8 (WideCharToMultiByte failed).", \r
- utf8_conversion_error::conversion_utf8_from_utf16,\r
- error);\r
- }\r
-\r
-\r
- //\r
- // Return resulting UTF-8 string\r
- //\r
- return utf8;\r
-}\r
-\r
-\r
-\r
-inline std::string UTF8FromUTF16(const wchar_t * utf16)\r
-{\r
- //\r
- // Special case of empty input string\r
- //\r
- if (utf16 == NULL || *utf16 == L'\0')\r
- return std::string();\r
-\r
-\r
- // Prefetch the length of the input UTF-16 string\r
- const int utf16Length = static_cast<int>(wcslen(utf16));\r
- \r
-\r
- //\r
- // Get length (in chars) of resulting UTF-8 string\r
- //\r
- const int utf8Length = ::WideCharToMultiByte(\r
- CP_UTF8, // convert to UTF-8\r
- 0, // default flags\r
- utf16, // source UTF-16 string\r
- utf16Length, // source string length, in wchar_t's,\r
- NULL, // unused - no conversion required in this step\r
- 0, // request buffer size\r
- NULL, NULL // unused\r
- );\r
- if (utf8Length == 0)\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
- throw utf8_conversion_error(\r
- "Can't get length of UTF-8 string (WideCharToMultiByte failed).", \r
- utf8_conversion_error::conversion_utf8_from_utf16,\r
- error);\r
- }\r
-\r
-\r
- //\r
- // Allocate destination buffer for UTF-8 string\r
- //\r
- std::string utf8;\r
- utf8.resize(utf8Length);\r
-\r
-\r
- //\r
- // Do the conversion from UTF-16 to UTF-8\r
- //\r
- if ( ! ::WideCharToMultiByte(\r
- CP_UTF8, // convert to UTF-8\r
- 0, // default flags\r
- utf16, // source UTF-16 string\r
- utf16Length, // source string length, in wchar_t's,\r
- &utf8[0], // destination buffer\r
- utf8.length(), // destination buffer size, in chars\r
- NULL, NULL // unused\r
- ) )\r
- {\r
- // Error\r
- DWORD error = ::GetLastError();\r
- throw utf8_conversion_error(\r
- "Can't convert string from UTF-16 to UTF-8 (WideCharToMultiByte failed).", \r
- utf8_conversion_error::conversion_utf8_from_utf16,\r
- error);\r
- }\r
-\r
-\r
- //\r
- // Return resulting UTF-8 string\r
- //\r
- return utf8;\r
-}\r
-\r
-\r
-\r
-} // namespace utf8util\r
-\r
-\r
-//////////////////////////////////////////////////////////////////////////\r
-\r
static std::wstring ver = L"Not found";\r
try\r
{\r
- ver = widen(invoke([]{return std::string(reinterpret_cast<const char*>(glGetString(GL_VERSION)));})\r
+ ver = u16(invoke([]{return std::string(reinterpret_cast<const char*>(glGetString(GL_VERSION)));})\r
+ " " + invoke([]{return std::string(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));})); \r
}\r
catch(...){}\r
{\r
auto color2 = get_hex_color(color);\r
if(color2.length() != 9 || color2[0] != '#')\r
- BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(narrow(color2)) << msg_info("Invalid color."));\r
+ BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(u8(color2)) << msg_info("Invalid color."));\r
\r
core::pixel_format_desc desc;\r
desc.pix_fmt = pixel_format::bgra;\r
auto& value = *reinterpret_cast<uint32_t*>(frame->image_data().begin());\r
std::wstringstream str(color2.substr(1));\r
if(!(str >> std::hex >> value) || !str.eof())\r
- BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(narrow(color2)) << msg_info("Invalid color."));\r
+ BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(u8(color2)) << msg_info("Invalid color."));\r
\r
frame->commit();\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
+ BOOST_THROW_EXCEPTION(file_not_found() << msg_info("No match found for supplied commands. Check syntax.") << arg_value_info(u8(str)));\r
}\r
\r
return producer;\r
if(!BlueVelvetVersion)\r
return L"Unknown";\r
\r
- return widen(std::string(BlueVelvetVersion()));\r
+ return u16(std::string(BlueVelvetVersion()));\r
}\r
\r
std::vector<std::wstring> get_device_list()\r
\r
//Setting output Video mode\r
if(BLUE_FAIL(set_card_property(blue_, VIDEO_MODE, vid_fmt_))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to set videomode."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to set videomode."));\r
\r
//Select Update Mode for output\r
if(BLUE_FAIL(set_card_property(blue_, VIDEO_UPDATE_TYPE, UPD_FMT_FRAME))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to set update type."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to set update type."));\r
\r
disable_video_output();\r
\r
//Enable dual link output\r
if(BLUE_FAIL(set_card_property(blue_, VIDEO_DUAL_LINK_OUTPUT, 1)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to enable dual link."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to enable dual link."));\r
\r
if(BLUE_FAIL(set_card_property(blue_, VIDEO_DUAL_LINK_OUTPUT_SIGNAL_FORMAT_TYPE, Signal_FormatType_4224)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to set dual link format type to 4:2:2:4."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to set dual link format type to 4:2:2:4."));\r
\r
//Select output memory format\r
if(BLUE_FAIL(set_card_property(blue_, VIDEO_MEMORY_FORMAT, MEM_FMT_ARGB_PC))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to set memory format."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to set memory format."));\r
\r
//Select image orientation\r
if(BLUE_FAIL(set_card_property(blue_, VIDEO_IMAGE_ORIENTATION, ImageOrientation_Normal)))\r
std::string module_str = "BlueVelvet3.dll";\r
#endif\r
\r
- auto module = LoadLibrary(widen(module_str).c_str());\r
+ auto module = LoadLibrary(u16(module_str).c_str());\r
if(!module)\r
- LoadLibrary(widen(std::string(getenv("SystemDrive")) + "\\Program Files\\Bluefish444\\Driver\\" + module_str).c_str());\r
+ LoadLibrary(u16(std::string(getenv("SystemDrive")) + "\\Program Files\\Bluefish444\\Driver\\" + module_str).c_str());\r
if(!module)\r
- LoadLibrary(widen(std::string(getenv("SystemDrive")) + "\\Program Files (x86)\\BlueFish444\\Driver\\" + module_str).c_str());\r
+ LoadLibrary(u16(std::string(getenv("SystemDrive")) + "\\Program Files (x86)\\BlueFish444\\Driver\\" + module_str).c_str());\r
if(!module)\r
BOOST_THROW_EXCEPTION(file_not_found() << msg_info("Could not find BlueVelvet3.dll. Required drivers are not installed."));\r
static std::shared_ptr<void> lib(module, FreeLibrary);\r
std::string module_str = "BlueHancUtils.dll";\r
#endif\r
\r
- auto module = LoadLibrary(widen(module_str).c_str());\r
+ auto module = LoadLibrary(u16(module_str).c_str());\r
if(!module)\r
- LoadLibrary(widen(std::string(getenv("SystemDrive")) + "\\Program Files\\Bluefish444\\Driver\\" + module_str).c_str());\r
+ LoadLibrary(u16(std::string(getenv("SystemDrive")) + "\\Program Files\\Bluefish444\\Driver\\" + module_str).c_str());\r
if(!module)\r
- LoadLibrary(widen(std::string(getenv("SystemDrive")) + "\\Program Files (x86)\\BlueFish444\\Driver\\" + module_str).c_str());\r
+ LoadLibrary(u16(std::string(getenv("SystemDrive")) + "\\Program Files (x86)\\BlueFish444\\Driver\\" + module_str).c_str());\r
if(!module)\r
BOOST_THROW_EXCEPTION(file_not_found() << msg_info("Could not find BlueHancUtils.dll. Required drivers are not installed."));\r
static std::shared_ptr<void> lib(module, FreeLibrary);\r
vid_fmt = videoMode; \r
}\r
if(vid_fmt == VID_FMT_INVALID)\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("video-mode not supported.") << arg_value_info(narrow(format_desc.name)));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("video-mode not supported.") << arg_value_info(u8(format_desc.name)));\r
\r
return vid_fmt;\r
}\r
void enable_audio()\r
{\r
if(FAILED(output_->EnableAudioOutput(bmdAudioSampleRate48kHz, bmdAudioSampleType32bitInteger, 2, bmdAudioOutputStreamTimestamped)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Could not enable audio output."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Could not enable audio output."));\r
\r
if(FAILED(output_->SetAudioCallback(this)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Could not set audio callback."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Could not set audio callback."));\r
\r
CASPAR_LOG(info) << print() << L" Enabled embedded-audio.";\r
}\r
void enable_video(BMDDisplayMode display_mode)\r
{\r
if(FAILED(output_->EnableVideoOutput(display_mode, bmdVideoOutputFlagDefault))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Could not enable video output."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Could not enable video output."));\r
\r
if(FAILED(output_->SetScheduledFrameCompletionCallback(this)))\r
BOOST_THROW_EXCEPTION(caspar_exception() \r
- << msg_info(narrow(print()) + " Failed to set playback completion callback.")\r
+ << msg_info(u8(print()) + " Failed to set playback completion callback.")\r
<< boost::errinfo_api_function("SetScheduledFrameCompletionCallback"));\r
}\r
\r
void start_playback()\r
{\r
if(FAILED(output_->StartScheduledPlayback(0, format_desc_.time_scale, 1.0))) \r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to schedule playback."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to schedule playback."));\r
}\r
\r
STDMETHOD (QueryInterface(REFIID, LPVOID*)) {return E_NOINTERFACE;}\r
}\r
\r
if(!is_running_)\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Is not running."));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Is not running."));\r
\r
if(config_.embedded_audio)\r
audio_frame_buffer_.push(frame); \r
// NOTE: bmdFormat8BitARGB is currently not supported by any decklink card. (2011-05-08)\r
if(FAILED(input_->EnableVideoInput(display_mode, bmdFormat8BitYUV, 0))) \r
BOOST_THROW_EXCEPTION(caspar_exception() \r
- << msg_info(narrow(print()) + " Could not enable video input.")\r
+ << msg_info(u8(print()) + " Could not enable video input.")\r
<< boost::errinfo_api_function("EnableVideoInput"));\r
\r
if(FAILED(input_->EnableAudioInput(bmdAudioSampleRate48kHz, bmdAudioSampleType32bitInteger, format_desc_.audio_channels))) \r
BOOST_THROW_EXCEPTION(caspar_exception() \r
- << msg_info(narrow(print()) + " Could not enable audio input.")\r
+ << msg_info(u8(print()) + " Could not enable audio input.")\r
<< boost::errinfo_api_function("EnableAudioInput"));\r
\r
if (FAILED(input_->SetCallback(this)) != S_OK)\r
BOOST_THROW_EXCEPTION(caspar_exception() \r
- << msg_info(narrow(print()) + " Failed to set input callback.")\r
+ << msg_info(u8(print()) + " Failed to set input callback.")\r
<< boost::errinfo_api_function("SetCallback"));\r
\r
if(FAILED(input_->StartStreams()))\r
BOOST_THROW_EXCEPTION(caspar_exception() \r
- << msg_info(narrow(print()) + " Failed to start input stream.")\r
+ << msg_info(u8(print()) + " Failed to start input stream.")\r
<< boost::errinfo_api_function("StartStreams"));\r
\r
CASPAR_LOG(info) << print() << L" Successfully Initialized.";\r
, frame_number_(0)\r
{\r
// TODO: Ask stakeholders about case where file already exists.\r
- boost::filesystem2::remove(boost::filesystem2::wpath(env::media_folder() + widen(filename))); // Delete the file if it exists\r
+ boost::filesystem2::remove(boost::filesystem2::wpath(env::media_folder() + u16(filename))); // Delete the file if it exists\r
\r
graph_->add_guide("frame-time", 0.5);\r
graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
\r
std::wstring print() const\r
{\r
- return L"ffmpeg[" + widen(filename_) + L"]";\r
+ return L"ffmpeg[" + u16(filename_) + L"]";\r
}\r
\r
std::shared_ptr<AVStream> add_video_stream(enum CodecID codec_id, const std::string& options)\r
virtual void initialize(const core::video_format_desc& format_desc, int)\r
{\r
consumer_.reset();\r
- consumer_.reset(new ffmpeg_consumer(narrow(filename_), format_desc, narrow(codec_), narrow(options_)));\r
+ consumer_.reset(new ffmpeg_consumer(u8(filename_), format_desc, u8(codec_), u8(options_)));\r
}\r
\r
virtual bool send(const safe_ptr<core::read_frame>& frame) override\r
case AVERROR_BSF_NOT_FOUND:\r
::boost::exception_detail::throw_exception_(averror_bsf_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line); \r
case AVERROR_DECODER_NOT_FOUND:\r
::boost::exception_detail::throw_exception_(averror_decoder_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_DEMUXER_NOT_FOUND:\r
::boost::exception_detail::throw_exception_(averror_demuxer_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_ENCODER_NOT_FOUND:\r
::boost::exception_detail::throw_exception_(averror_encoder_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line); \r
case AVERROR_EOF: \r
::boost::exception_detail::throw_exception_(averror_eof()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_EXIT: \r
::boost::exception_detail::throw_exception_(averror_exit()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_FILTER_NOT_FOUND: \r
::boost::exception_detail::throw_exception_(averror_filter_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_MUXER_NOT_FOUND: \r
::boost::exception_detail::throw_exception_(averror_muxer_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_OPTION_NOT_FOUND: \r
::boost::exception_detail::throw_exception_(averror_option_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_PATCHWELCOME: \r
::boost::exception_detail::throw_exception_(averror_patchwelcome()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_PROTOCOL_NOT_FOUND: \r
::boost::exception_detail::throw_exception_(averror_protocol_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
case AVERROR_STREAM_NOT_FOUND:\r
::boost::exception_detail::throw_exception_(averror_stream_not_found()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
default:\r
::boost::exception_detail::throw_exception_(ffmpeg_error()<< \r
msg_info(av_error_str(ret)) << \r
- source_info(narrow(source)) << \r
+ source_info(u8(source)) << \r
boost::errinfo_api_function(func) << \r
boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
}\r
\r
static void throw_on_ffmpeg_error(int ret, const std::wstring& source, const char* func, const char* local_func, const char* file, int line)\r
{\r
- throw_on_ffmpeg_error(ret, narrow(source).c_str(), func, local_func, file, line);\r
+ throw_on_ffmpeg_error(ret, u8(source).c_str(), func, local_func, file, line);\r
}\r
\r
\r
inputs->pad_idx = 0;\r
inputs->next = nullptr;\r
\r
- std::string filters = boost::to_lower_copy(narrow(filters_));\r
+ std::string filters = boost::to_lower_copy(u8(filters_));\r
THROW_ON_ERROR2(avfilter_graph_parse(graph_.get(), filters.c_str(), &inputs, &outputs, NULL), "[filter]");\r
\r
auto yadif_filter = boost::adaptors::filtered([&](AVFilterContext* p){return strstr(p->name, "yadif") != 0;});\r
safe_ptr<AVFormatContext> open_input(const std::wstring& filename)\r
{\r
AVFormatContext* weak_context = nullptr;\r
- THROW_ON_ERROR2(avformat_open_input(&weak_context, narrow(filename).c_str(), nullptr, nullptr), filename);\r
+ THROW_ON_ERROR2(avformat_open_input(&weak_context, u8(filename).c_str(), nullptr, nullptr), filename);\r
safe_ptr<AVFormatContext> context(weak_context, av_close_input_file); \r
THROW_ON_ERROR2(avformat_find_stream_info(weak_context, nullptr), filename);\r
fix_meta_data(*context);\r
\r
bool is_valid_file(const std::wstring filename)\r
{ \r
- auto filename2 = narrow(filename);\r
+ auto filename2 = u8(filename);\r
\r
std::ifstream file(filename);\r
\r
graph_->set_color("skip-sync", diagnostics::color(0.8f, 0.3f, 0.2f)); \r
\r
if(FAILED(CComObject<caspar::flash::FlashAxContainer>::CreateInstance(&ax_)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to create FlashAxContainer"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to create FlashAxContainer"));\r
\r
ax_->set_print([this]{return L"flash_renderer";});\r
\r
if(FAILED(ax_->CreateAxControl()))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Create FlashAxControl"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to Create FlashAxControl"));\r
\r
CComPtr<IShockwaveFlash> spFlash;\r
if(FAILED(ax_->QueryControl(&spFlash)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Query FlashAxControl"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to Query FlashAxControl"));\r
\r
if(FAILED(spFlash->put_Playing(true)) )\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to start playing Flash"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to start playing Flash"));\r
\r
if(FAILED(spFlash->put_Movie(CComBSTR(filename.c_str()))))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Load Template Host"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to Load Template Host"));\r
\r
if(FAILED(spFlash->put_ScaleMode(2))) //Exact fit. Scale without respect to the aspect ratio.\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Set Scale Mode"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to Set Scale Mode"));\r
\r
ax_->SetSize(width_, height_); \r
\r
std::wstring result;\r
\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
+ 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(u8(param)));\r
graph_->add_tag("param");\r
\r
return result;\r
, context_(L"flash_producer")\r
{ \r
if(!boost::filesystem::exists(filename))\r
- BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(narrow(filename))); \r
+ BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(u8(filename))); \r
\r
fps_ = 0;\r
\r
\r
graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity())); \r
fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0)); \r
- graph_->set_text(narrow(print()));\r
+ graph_->set_text(u8(print()));\r
\r
render(renderer);\r
}\r
{\r
try\r
{\r
- auto filename = narrow(env::data_folder()) + boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) + ".png";\r
+ auto filename = u8(env::data_folder()) + boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) + ".png";\r
\r
auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_Allocate(format_desc.width, format_desc.height, 32), FreeImage_Unload);\r
memcpy(FreeImage_GetBits(bitmap.get()), frame->image_data().begin(), frame->image_size());\r
\r
std::wstring get_version()\r
{\r
- return widen(std::string(FreeImage_GetVersion()));\r
+ return u16(std::string(FreeImage_GetVersion()));\r
}\r
\r
}}
\ No newline at end of file
\r
std::shared_ptr<FIBITMAP> load_image(const std::wstring& filename)\r
{\r
- return load_image(narrow(filename));\r
+ return load_image(u8(filename));\r
}\r
\r
}}
\ No newline at end of file
displayDevices.push_back(d_device);\r
\r
if(config_.screen_index >= displayDevices.size())\r
- BOOST_THROW_EXCEPTION(out_of_range() << arg_name_info("screen_index_") << msg_info(narrow(print())));\r
+ BOOST_THROW_EXCEPTION(out_of_range() << arg_name_info("screen_index_") << msg_info(u8(print())));\r
\r
DEVMODE devmode = {};\r
if(!EnumDisplaySettings(displayDevices[config_.screen_index].DeviceName, ENUM_CURRENT_SETTINGS, &devmode))\r
- BOOST_THROW_EXCEPTION(invalid_operation() << arg_name_info("screen_index") << msg_info(narrow(print()) + " EnumDisplaySettings"));\r
+ BOOST_THROW_EXCEPTION(invalid_operation() << arg_name_info("screen_index") << msg_info(u8(print()) + " EnumDisplaySettings"));\r
\r
screen_x_ = devmode.dmPosition.x;\r
screen_y_ = devmode.dmPosition.y;\r
if(!GLEW_VERSION_2_1)\r
BOOST_THROW_EXCEPTION(not_supported() << msg_info("Missing OpenGL 2.1 support."));\r
\r
- window_.Create(sf::VideoMode(screen_width_, screen_height_, 32), narrow(print()), config_.windowed ? sf::Style::Resize | sf::Style::Close : sf::Style::Fullscreen);\r
+ window_.Create(sf::VideoMode(screen_width_, screen_height_, 32), u8(print()), config_.windowed ? sf::Style::Resize | sf::Style::Close : sf::Style::Fullscreen);\r
window_.ShowMouseCursor(false);\r
window_.SetPosition(screen_x_, screen_y_);\r
window_.SetSize(screen_width_, screen_height_);\r
_parameters[0] = _parameters[0];\r
auto pFP = create_producer(GetChannel()->mixer(), _parameters);\r
if(pFP == frame_producer::empty())\r
- BOOST_THROW_EXCEPTION(file_not_found() << msg_info(_parameters.size() > 0 ? narrow(_parameters[0]) : ""));\r
+ BOOST_THROW_EXCEPTION(file_not_found() << msg_info(_parameters.size() > 0 ? u8(_parameters[0]) : ""));\r
\r
bool auto_play = std::find(_parameters.begin(), _parameters.end(), L"AUTO") != _parameters.end();\r
\r
auto filename = flash::find_template(env::template_folder() + _parameters.at(1));\r
\r
std::wstringstream str;\r
- str << widen(flash::read_template_meta_info(filename));\r
+ str << u16(flash::read_template_meta_info(filename));\r
boost::property_tree::wptree info;\r
boost::property_tree::xml_parser::read_xml(str, info, boost::property_tree::xml_parser::trim_whitespace | boost::property_tree::xml_parser::no_comments);\r
\r
using boost::property_tree::wptree;\r
BOOST_FOREACH(auto& xml_channel, pt.get_child(L"configuration.channels"))\r
{ \r
- auto format_desc = video_format_desc::get(widen(xml_channel.second.get(L"video-mode", L"PAL"))); \r
+ auto format_desc = video_format_desc::get(u16(xml_channel.second.get(L"video-mode", L"PAL"))); \r
if(format_desc.format == video_format::invalid)\r
BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Invalid video-mode."));\r
\r
else if(name == L"system-audio")\r
channels_.back()->output()->add(oal::create_consumer()); \r
else if(name != L"<xmlcomment>")\r
- CASPAR_LOG(warning) << "Invalid consumer: " << widen(name); \r
+ CASPAR_LOG(warning) << "Invalid consumer: " << u16(name); \r
}\r
catch(...)\r
{\r
async_servers_.push_back(asyncbootstrapper);\r
}\r
else\r
- CASPAR_LOG(warning) << "Invalid controller: " << widen(name); \r
+ CASPAR_LOG(warning) << "Invalid controller: " << u16(name); \r
}\r
catch(...)\r
{\r
else if(boost::iequals(name, L"CLOCK"))\r
return make_safe<CLK::CLKProtocolStrategy>(channels_);\r
\r
- BOOST_THROW_EXCEPTION(caspar_exception() << arg_name_info("name") << arg_value_info(narrow(name)) << msg_info("Invalid protocol"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << arg_name_info("name") << arg_value_info(u8(name)) << msg_info("Invalid protocol"));\r
}\r
};\r
\r