]> git.sesse.net Git - casparcg/commitdiff
2.1: Refactored UTF string handling.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 7 Dec 2011 00:03:17 +0000 (00:03 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 7 Dec 2011 00:03:17 +0000 (00:03 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@1819 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

28 files changed:
common/common.vcxproj
common/common.vcxproj.filters
common/concurrency/executor.h
common/diagnostics/graph.cpp
common/env.cpp
common/utility/string.cpp
common/utility/string.h
common/utility/utf8conv.h [deleted file]
common/utility/utf8conv_inl.h [deleted file]
core/mixer/gpu/ogl_device.cpp
core/producer/color/color_producer.cpp
core/producer/frame_producer.cpp
modules/bluefish/bluefish.cpp
modules/bluefish/consumer/bluefish_consumer.cpp
modules/bluefish/util/blue_velvet.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/ffmpeg_error.h
modules/ffmpeg/producer/filter/filter.cpp
modules/ffmpeg/producer/util/util.cpp
modules/flash/producer/flash_producer.cpp
modules/image/consumer/image_consumer.cpp
modules/image/image.cpp
modules/image/util/image_loader.cpp
modules/ogl/consumer/ogl_consumer.cpp
protocol/amcp/AMCPCommandsImpl.cpp
shell/server.cpp

index fecb1cad9ce984363a1c6936e5d2206dbeb8bdef..98c2b1750c157dae6ad5c5ab0e71dcb51f8b7848 100644 (file)
     <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
index 8d1362df984288324a4ac0535bb310584caf63d7..a6a80de9c8faffb049f4d819b75d5f771cda77f1 100644 (file)
     <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
index c65bf760f8821cd771d91e69281a1d50c02d5722..b4678e3d779b01404cbd4ff015a45f29e7cbca8d 100644 (file)
@@ -111,7 +111,7 @@ class executor : boost::noncopyable
 \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
index b71606f93f85a1d892f2a3e4607dab72ae12fec6..a57cac1325b319fcb75ac36554c5ba9125df5b83 100644 (file)
@@ -399,7 +399,7 @@ void graph::set_text(const std::wstring& value)
        auto p = impl_;\r
        context::begin_invoke([=]\r
        {       \r
-               set_text(narrow(value));\r
+               set_text(u8(value));\r
        }, high_priority);\r
 }\r
 \r
index 3616397e46e0c04d97973dbf702479dbe059a862..88df617060fd3ca50f187e5799f6ed3882392cc0 100644 (file)
@@ -62,10 +62,10 @@ void configure(const std::wstring& filename)
                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
index 76954b89b7c5c056c1fc6b23fdc752f5aa9434f3..fe5c5c8aff2a5d6472621f15685dc113c953d6d0 100644 (file)
 \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
index a7aee7a8195d7f90f31a067defe26b91deedb16c..45ce4217922b00593e593176f2b14e4699b1788a 100644 (file)
           \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
diff --git a/common/utility/utf8conv.h b/common/utility/utf8conv.h
deleted file mode 100644 (file)
index 8194247..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-//////////////////////////////////////////////////////////////////////////\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
diff --git a/common/utility/utf8conv_inl.h b/common/utility/utf8conv_inl.h
deleted file mode 100644 (file)
index 234c79d..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-//////////////////////////////////////////////////////////////////////////\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
index 4c7f32e3c4579a859ffaa1513285354bb0e71caa..6f187f043335636c67301eb7fc6eb1c70344955c 100644 (file)
@@ -271,7 +271,7 @@ std::wstring ogl_device::version()
        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
index f91c1072783dd4af92c8ad9105a6007324386b7e..bdb6d835a9b4b7c9435c2ccb6092bb52e09a9bd1 100644 (file)
@@ -128,7 +128,7 @@ safe_ptr<core::write_frame> create_color_frame(void* tag, const safe_ptr<core::f
 {\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
@@ -140,7 +140,7 @@ safe_ptr<core::write_frame> create_color_frame(void* tag, const safe_ptr<core::f
        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
index 308c10d17abff9d45c29258c78b0a3078328a166..f8d394e652687eca0a80e76dabcdf26ed417c0dd 100644 (file)
@@ -237,7 +237,7 @@ safe_ptr<core::frame_producer> create_producer(const safe_ptr<frame_factory>& my
                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
index 3c06a32bcc4f39c0e8524c0641c15bd50fd23da9..e7be86c0070318984f0d87aaeb7b9a85b147ee28 100644 (file)
@@ -61,7 +61,7 @@ std::wstring get_version()
        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
index 6beadf6beda9724ff6d6c05992e5874e6401f3f5..bda9ce23cc1ee3ca3f00b42a3746ceac3bffb2a8 100644 (file)
@@ -96,24 +96,24 @@ public:
                        \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
index d6771ab37f1dba0b94513d03c6a8cbdeca219001..c42d34a49432c5364d85c341da70f58978df25c5 100644 (file)
@@ -43,11 +43,11 @@ void blue_velvet_initialize()
        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
@@ -64,11 +64,11 @@ void blue_hanc_initialize()
        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
@@ -179,7 +179,7 @@ EVideoMode get_video_mode(CBlueVelvet4& blue, const core::video_format_desc& for
                        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
index ad8573c9ad64dd4e3e42bc69d4e3019c8f47ad17..e7d76a28796fa86d90cdd741ba8cca594bf54b7f 100644 (file)
@@ -272,10 +272,10 @@ public:
        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
@@ -283,18 +283,18 @@ public:
        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
@@ -419,7 +419,7 @@ public:
                }\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
index d0871fea9f0eb7ea6356b39b19c4f27d129d589a..033941ee905ca58b08c815a87707db4fa5018068 100644 (file)
@@ -128,22 +128,22 @@ public:
                // 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
index f6796db233073de46ab53561e469ad8aa33ede88..87fb4689c96f6fab8c90d57e6db099c3e63ef388 100644 (file)
@@ -98,7 +98,7 @@ public:
                , 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
@@ -157,7 +157,7 @@ public:
                        \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
@@ -405,7 +405,7 @@ public:
        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
index 3d7fa6727607859218c881b8b81fb0718f5804b9..645def78dc4b863933c80c2f71babfdf93cd431e 100644 (file)
@@ -70,79 +70,79 @@ static void throw_on_ffmpeg_error(int ret, const char* source, const char* func,
        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
@@ -150,7 +150,7 @@ static void throw_on_ffmpeg_error(int ret, const char* source, const char* func,
 \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
index 9c2ef158a3cd37aff26d90d319dedac7a9cfd180..d8f8f864c06bf4eb3d31318ae6675cd44e9ca4e4 100644 (file)
@@ -182,7 +182,7 @@ struct filter::implementation
                                        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
index ede72036a1ce19e7f34a774df02db62183a8efbb..96715cb33cf69ea67ba8f26aa5f455fc74433aa4 100644 (file)
@@ -445,7 +445,7 @@ safe_ptr<AVCodecContext> open_codec(AVFormatContext& context, enum AVMediaType t
 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
@@ -462,7 +462,7 @@ std::wstring print_mode(size_t width, size_t height, double fps, bool interlaced
 \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
index 4239e1be783912639e29123acd2ef13a616c8a98..6b8c0772f3c07cd9ee27a660d140a9d31be6658f 100644 (file)
@@ -179,25 +179,25 @@ public:
                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
@@ -219,7 +219,7 @@ public:
                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
@@ -307,7 +307,7 @@ public:
                , 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
@@ -437,7 +437,7 @@ public:
 \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
index d88bdf35563d6418e681ab67585d388c48099a46..b64dd81985489373e49c537c55871f63cb2585bb 100644 (file)
@@ -60,7 +60,7 @@ public:
                {\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
index 63b6e3d489306cb0c820299ddf371b211df70a3a..5479bf04715234353d002fa2337e156c83860b31 100644 (file)
@@ -43,7 +43,7 @@ void init()
 \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
index 42f1f3c7dc73766fa4d718ed526d53a639737fed..82408cdb3be590a7d8511882c1de19ce035bfbac 100644 (file)
@@ -60,7 +60,7 @@ std::shared_ptr<FIBITMAP> load_image(const std::string& filename)
 \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
index 32233d2cdb7bc7fb0f8e7ae25efa4490c869f013..a5b75554eca7eddff20008deb49fda66f11c1904 100644 (file)
@@ -156,11 +156,11 @@ public:
                        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
@@ -183,7 +183,7 @@ public:
                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
index c16087b205039d95e209be068e4c386b939479b9..2026b852a7d4748352aff3b98a46fd550afb6416 100644 (file)
@@ -702,7 +702,7 @@ bool LoadbgCommand::DoExecute()
                _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
@@ -1314,7 +1314,7 @@ bool InfoCommand::DoExecute()
                        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
index f1419cc91b1fbe5a8011cd65381918fd987ba6dc..a3f4b43254735ee8b8f56553797f48aa1aedcfa5 100644 (file)
@@ -112,7 +112,7 @@ struct server::implementation : boost::noncopyable
                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
@@ -134,7 +134,7 @@ struct server::implementation : boost::noncopyable
                                        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
@@ -162,7 +162,7 @@ struct server::implementation : boost::noncopyable
                                        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
@@ -180,7 +180,7 @@ struct server::implementation : boost::noncopyable
                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