]> git.sesse.net Git - casparcg/commitdiff
2.1.0: UTF support for exception printing.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 7 Dec 2011 01:58:34 +0000 (01:58 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 7 Dec 2011 01:58:34 +0000 (01:58 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@1820 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

19 files changed:
common/env.cpp
common/exception/exceptions.h
common/gl/gl_check.cpp
common/log/log.h
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/util/util.cpp
modules/flash/producer/flash_producer.cpp
modules/image/image.cpp
modules/ogl/consumer/ogl_consumer.cpp
protocol/amcp/AMCPCommandsImpl.cpp
shell/server.cpp

index 88df617060fd3ca50f187e5799f6ed3882392cc0..1f3f7bb3ebcfbc0ab6ef193cb220c519c37df9a0 100644 (file)
@@ -25,7 +25,8 @@
 \r
 #include "../version.h"\r
 \r
-#include "exception\exceptions.h"\r
+#include "log/log.h"\r
+#include "exception/exceptions.h"\r
 #include "utility/string.h"\r
 \r
 #include <boost/property_tree/ptree.hpp>\r
@@ -37,9 +38,7 @@
 #include <iostream>\r
 \r
 namespace caspar { namespace env {\r
-\r
-using namespace boost::filesystem2;\r
-\r
+       \r
 std::wstring media;\r
 std::wstring log;\r
 std::wstring ftemplate;\r
@@ -49,27 +48,27 @@ boost::property_tree::wptree pt;
 void check_is_configured()\r
 {\r
        if(pt.empty())\r
-               BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Enviroment properties has not been configured"));\r
+               BOOST_THROW_EXCEPTION(invalid_operation() << wmsg_info(L"Enviroment properties has not been configured"));\r
 }\r
 \r
 void configure(const std::wstring& filename)\r
 {\r
        try\r
        {\r
-               auto initialPath = boost::filesystem::initial_path<boost::filesystem2::wpath>().file_string();\r
+               auto initialPath = boost::filesystem2::initial_path<boost::filesystem2::wpath>().file_string();\r
        \r
                std::wifstream file(initialPath + L"\\" + filename);\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 = 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
+               auto paths      = pt.get_child(L"configuration.paths");\r
+               media           = paths.get(L"media-path", initialPath + L"\\media\\");\r
+               log                     = paths.get(L"log-path", initialPath + L"\\log\\");\r
+               ftemplate       = boost::filesystem2::complete(paths.get(L"template-path", initialPath + L"\\template\\")).string();            \r
+               data            = paths.get(L"data-path", initialPath + L"\\data\\");\r
        }\r
        catch(...)\r
        {\r
-               std::wcout << L" ### Invalid configuration file. ###";\r
+               CASPAR_LOG(error) << L" ### Invalid configuration file. ###";\r
                throw;\r
        }\r
 }\r
index 2c89f14a3a8c617405afe58ca83873b5a11e8ec9..93dc9b2cbaa921a262f92b88f8dd6832a7df3c6a 100644 (file)
 #include <boost/exception/error_info.hpp>\r
 #include <boost/throw_exception.hpp>\r
 \r
+#include "../utility/string.h"\r
+\r
 namespace caspar {\r
 \r
 typedef boost::error_info<struct tag_arg_name_info, std::string>               arg_name_info;\r
 typedef boost::error_info<struct tag_arg_value_info, std::string>              arg_value_info;\r
 typedef boost::error_info<struct tag_msg_info, std::string>                            msg_info;\r
-typedef boost::error_info<struct tag_errorstr, std::string>                            errorstr;\r
 typedef boost::error_info<struct tag_source_info, std::string>                 source_info;\r
+typedef boost::error_info<struct tag_errorstr_info, std::string>               errstr_info;\r
+typedef boost::error_info<struct tag_errinfo_file_name, std::string>   err_file_name_info;\r
+\r
+inline arg_name_info           warg_name_info(const std::wstring& str)         {return arg_name_info(u8(str));}\r
+inline arg_value_info          warg_value_info(const std::wstring& str)        {return arg_value_info(u8(str));}\r
+inline msg_info                                wmsg_info(const std::wstring& str)                      {return msg_info(u8(str));}\r
+inline source_info                     wsource_info(const std::wstring& str)           {return source_info(u8(str));}\r
+inline err_file_name_info      werr_file_name_info(const std::wstring& str){return err_file_name_info(u8(str));}\r
+\r
 typedef boost::error_info<struct tag_line_info, size_t>                                        line_info;\r
 typedef boost::error_info<struct errinfo_nested_exception_, std::exception_ptr> errinfo_nested_exception;\r
 \r
index 8a5e745b0b3e179090f84e9445d65cd6c4cc590c..6d5079f14c85cca507c9b81cf118b1fa8c5f48d2 100644 (file)
@@ -56,49 +56,49 @@ void SMFL_GLCheckError(const std::string& expr, const std::string& file, unsigne
                        case GL_INVALID_ENUM :\r
                                BOOST_THROW_EXCEPTION(ogl_invalid_enum()\r
                                        << msg_info("an unacceptable value has been specified for an enumerated argument")\r
-                                       << errorstr("GL_INVALID_ENUM")\r
+                                       << errstr_info("GL_INVALID_ENUM")\r
                                        << line_info(line)\r
                                        << source_info(file));\r
 \r
                        case GL_INVALID_VALUE :\r
                                BOOST_THROW_EXCEPTION(ogl_invalid_value()\r
                                        << msg_info("a numeric argument is out of range")\r
-                                       << errorstr("GL_INVALID_VALUE")\r
+                                       << errstr_info("GL_INVALID_VALUE")\r
                                        << line_info(line)\r
                                        << source_info(file));\r
 \r
                        case GL_INVALID_OPERATION :\r
                                BOOST_THROW_EXCEPTION(ogl_invalid_operation()\r
                                        << msg_info("the specified operation is not allowed in the current state")\r
-                                       << errorstr("GL_INVALID_OPERATION")\r
+                                       << errstr_info("GL_INVALID_OPERATION")\r
                                        << line_info(line)\r
                                        << source_info(file));\r
 \r
                        case GL_STACK_OVERFLOW :\r
                                BOOST_THROW_EXCEPTION(ogl_stack_overflow()\r
                                        << msg_info("this command would cause a stack overflow")\r
-                                       << errorstr("GL_STACK_OVERFLOW")\r
+                                       << errstr_info("GL_STACK_OVERFLOW")\r
                                        << line_info(line)\r
                                        << source_info(file));\r
 \r
                        case GL_STACK_UNDERFLOW :\r
                                BOOST_THROW_EXCEPTION(ogl_stack_underflow()\r
                                        << msg_info("this command would cause a stack underflow")\r
-                                       << errorstr("GL_STACK_UNDERFLOW")\r
+                                       << errstr_info("GL_STACK_UNDERFLOW")\r
                                        << line_info(line)\r
                                        << source_info(file));\r
 \r
                        case GL_OUT_OF_MEMORY :\r
                                BOOST_THROW_EXCEPTION(ogl_out_of_memory()\r
                                        << msg_info("there is not enough memory left to execute the command")\r
-                                       << errorstr("GL_OUT_OF_MEMORY")\r
+                                       << errstr_info("GL_OUT_OF_MEMORY")\r
                                        << line_info(line)\r
                                        << source_info(file));\r
 \r
                        case GL_INVALID_FRAMEBUFFER_OPERATION_EXT :\r
                                BOOST_THROW_EXCEPTION(ogl_stack_underflow()\r
                                        << msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")\r
-                                       << errorstr("GL_INVALID_FRAMEBUFFER_OPERATION_EXT")\r
+                                       << errstr_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT")\r
                                        << line_info(line)\r
                                        << source_info(file));\r
                }\r
index a850f793b8764c93a36560f2e42e4100c153f981..7cd399286c7b4e884f0201fa627c76e9690ba02c 100644 (file)
@@ -30,6 +30,8 @@
 #pragma warning (disable : 4996) // _CRT_SECURE_NO_WARNINGS\r
 #endif\r
 \r
+#include "../utility/string.h"\r
+\r
 #include <boost/log/detail/prologue.hpp>\r
 #include <boost/log/keywords/severity.hpp>\r
 #include <boost/log/sources/global_logger_storage.hpp>\r
@@ -90,7 +92,7 @@ BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT(logger, caspar_logger)
 \r
 #define CASPAR_LOG_CURRENT_EXCEPTION() \\r
        try\\r
-       {CASPAR_LOG(error) << boost::current_exception_diagnostic_information().c_str();}\\r
+       {CASPAR_LOG(error) << caspar::u16(boost::current_exception_diagnostic_information());}\\r
        catch(...){}\r
 \r
 void set_log_level(const std::wstring& lvl);\r
index bdb6d835a9b4b7c9435c2ccb6092bb52e09a9bd1..80f868b1f9052bca1ded06a57bdee5b011bf8689 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(u8(color2)) << msg_info("Invalid color."));\r
+               BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << warg_value_info(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(u8(color2)) << msg_info("Invalid color."));\r
+               BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << warg_value_info(color2) << msg_info("Invalid color."));\r
 \r
        frame->commit();\r
                \r
index f8d394e652687eca0a80e76dabcdf26ed417c0dd..d2a11fdef3543e86d709c66e15aea07b65ad0926 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(u8(str)));\r
+               BOOST_THROW_EXCEPTION(file_not_found() << msg_info("No match found for supplied commands. Check syntax.") << warg_value_info(str));\r
        }\r
 \r
        return producer;\r
index e7be86c0070318984f0d87aaeb7b9a85b147ee28..0e490d1cf05a6b2e1178dc6e0afba4bfb482c3e8 100644 (file)
@@ -61,7 +61,7 @@ std::wstring get_version()
        if(!BlueVelvetVersion)\r
                return L"Unknown";\r
 \r
-       return u16(std::string(BlueVelvetVersion()));\r
+       return u16(BlueVelvetVersion());\r
 }\r
 \r
 std::vector<std::wstring> get_device_list()\r
index bda9ce23cc1ee3ca3f00b42a3746ceac3bffb2a8..13fb1b58e6529ff6ca88fe40e22c7bdd4a751a8a 100644 (file)
@@ -96,35 +96,35 @@ 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(u8(print()) + " Failed to set videomode."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Failed to set update type."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Failed to enable dual link."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Failed to set dual link format type to 4:2:2:4."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Failed to set memory format."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to set memory format."));\r
                \r
                //Select image orientation\r
                if(BLUE_FAIL(set_card_property(blue_, VIDEO_IMAGE_ORIENTATION, ImageOrientation_Normal)))\r
-                       CASPAR_LOG(warning) << print() << TEXT(" Failed to set image orientation to normal.");  \r
+                       CASPAR_LOG(warning) << print() << L" Failed to set image orientation to normal.";       \r
 \r
                // Select data range\r
                if(BLUE_FAIL(set_card_property(blue_, VIDEO_RGB_DATA_RANGE, CGR_RANGE))) \r
-                       CASPAR_LOG(warning) << print() << TEXT(" Failed to set RGB data range to CGR.");        \r
+                       CASPAR_LOG(warning) << print() << L" Failed to set RGB data range to CGR.";     \r
                \r
                if(BLUE_FAIL(set_card_property(blue_, VIDEO_PREDEFINED_COLOR_MATRIX, vid_fmt_ == VID_FMT_PAL ? MATRIX_601_CGR : MATRIX_709_CGR)))\r
-                       CASPAR_LOG(warning) << print() << TEXT(" Failed to set colormatrix to ") << (vid_fmt_ == VID_FMT_PAL ? TEXT("601 CGR") : TEXT("709 CGR")) << TEXT(".");\r
+                       CASPAR_LOG(warning) << print() << L" Failed to set colormatrix to " << (vid_fmt_ == VID_FMT_PAL ? L"601 CGR" : L"709 CGR") << L".";\r
 \r
                if(!embedded_audio_)\r
                {\r
index c42d34a49432c5364d85c341da70f58978df25c5..b60e1175290ba9068a587b3ece5d7979f406667e 100644 (file)
@@ -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(u8(format_desc.name)));\r
+               BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("video-mode not supported.") << warg_value_info(format_desc.name));\r
 \r
        return vid_fmt;\r
 }\r
index e7d76a28796fa86d90cdd741ba8cca594bf54b7f..a1d89056eb13e23319bd3da29300667effed8982 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(u8(print()) + " Could not enable audio output."));\r
+                               BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Could not enable audio output."));\r
                                \r
                if(FAILED(output_->SetAudioCallback(this)))\r
-                       BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Could not set audio callback."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Could not enable video output."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Could not enable video output."));\r
                \r
                if(FAILED(output_->SetScheduledFrameCompletionCallback(this)))\r
                        BOOST_THROW_EXCEPTION(caspar_exception() \r
-                                                                       << msg_info(u8(print()) + " Failed to set playback completion callback.")\r
+                                                                       << wmsg_info(print() + L" 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(u8(print()) + " Failed to schedule playback."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Is not running."));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Is not running."));\r
                \r
                if(config_.embedded_audio)\r
                        audio_frame_buffer_.push(frame);        \r
index 033941ee905ca58b08c815a87707db4fa5018068..7eb4baa7849d7e59aa67fcb04b1ebca276f40c43 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(u8(print()) + " Could not enable video input.")\r
+                                                                       << wmsg_info(print() + L" 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(u8(print()) + " Could not enable audio input.")\r
+                                                                       << wmsg_info(print() + L" 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(u8(print()) + " Failed to set input callback.")\r
+                                                                       << wmsg_info(print() + L" 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(u8(print()) + " Failed to start input stream.")\r
+                                                                       << wmsg_info(print() + L" Failed to start input stream.")\r
                                                                        << boost::errinfo_api_function("StartStreams"));\r
                \r
                CASPAR_LOG(info) << print() << L" Successfully Initialized.";\r
index 87fb4689c96f6fab8c90d57e6db099c3e63ef388..a15089238c0be7bf3357cf445a4a5c7c31352874 100644 (file)
@@ -63,7 +63,7 @@ namespace caspar { namespace ffmpeg {
        \r
 struct ffmpeg_consumer : boost::noncopyable\r
 {              \r
-       const std::string                                               filename_;\r
+       const std::wstring                                              filename_;\r
                \r
        const std::shared_ptr<AVFormatContext>  oc_;\r
        const core::video_format_desc                   format_desc_;\r
@@ -88,7 +88,7 @@ struct ffmpeg_consumer : boost::noncopyable
        int64_t                                                                 frame_number_;\r
        \r
 public:\r
-       ffmpeg_consumer(const std::string& filename, const core::video_format_desc& format_desc, const std::string& codec, const std::string& options)\r
+       ffmpeg_consumer(const std::wstring& filename, const core::video_format_desc& format_desc, const std::wstring& codec, const std::wstring& options)\r
                : filename_(filename)\r
                , video_outbuf_(1920*1080*8)\r
                , oc_(avformat_alloc_context(), av_free)\r
@@ -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() + u16(filename))); // Delete the file if it exists\r
+               boost::filesystem2::remove(boost::filesystem2::wpath(env::media_folder() + 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
@@ -109,27 +109,27 @@ public:
                executor_.set_capacity(8);\r
                file_write_executor_.set_capacity(8);\r
 \r
-               oc_->oformat = av_guess_format(nullptr, filename_.c_str(), nullptr);\r
+               oc_->oformat = av_guess_format(nullptr, u8(filename_).c_str(), nullptr);\r
                if (!oc_->oformat)\r
                        BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Could not find suitable output format."));\r
                \r
                THROW_ON_ERROR2(av_set_parameters(oc_.get(), nullptr), "[ffmpeg_consumer]");\r
 \r
-               strcpy_s(oc_->filename, filename_.c_str());\r
+               strcpy_s(oc_->filename, u8(filename_).c_str());\r
                \r
-               auto video_codec = avcodec_find_encoder_by_name(codec.c_str());\r
+               auto video_codec = avcodec_find_encoder_by_name(u8(codec).c_str());\r
                if(video_codec == nullptr)\r
-                       BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info(codec));\r
+                       BOOST_THROW_EXCEPTION(invalid_argument() << warg_name_info(codec));\r
 \r
                //  Add the audio and video streams using the default format codecs     and initialize the codecs .\r
-               video_st_ = add_video_stream(video_codec->id, options);\r
+               video_st_ = add_video_stream(video_codec->id, u8(options));\r
                audio_st_ = add_audio_stream();\r
                                \r
-               dump_format(oc_.get(), 0, filename_.c_str(), 1);\r
+               dump_format(oc_.get(), 0, u8(filename_).c_str(), 1);\r
                 \r
                // Open the output ffmpeg, if needed.\r
                if (!(oc_->oformat->flags & AVFMT_NOFILE)) \r
-                       THROW_ON_ERROR2(avio_open(&oc_->pb, filename_.c_str(), URL_WRONLY), "[ffmpeg_consumer]");\r
+                       THROW_ON_ERROR2(avio_open(&oc_->pb, u8(filename_).c_str(), URL_WRONLY), "[ffmpeg_consumer]");\r
                                \r
                THROW_ON_ERROR2(av_write_header(oc_.get()), "[ffmpeg_consumer]");\r
 \r
@@ -157,7 +157,7 @@ public:
                        \r
        std::wstring print() const\r
        {\r
-               return L"ffmpeg[" + u16(filename_) + L"]";\r
+               return L"ffmpeg[" + 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(u8(filename_), format_desc, u8(codec_), u8(options_)));\r
+               consumer_.reset(new ffmpeg_consumer(filename_, format_desc, codec_, options_));\r
        }\r
        \r
        virtual bool send(const safe_ptr<core::read_frame>& frame) override\r
index 645def78dc4b863933c80c2f71babfdf93cd431e..e4337e930751f98a0846d7b1939aa7e68290a513 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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(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(u8(source)) <<                                              \r
+                       source_info(source) <<                                          \r
                        boost::errinfo_api_function(func) <<                                    \r
                        boost::errinfo_errno(AVUNERROR(ret)), local_func, file, line);\r
        }\r
index 96715cb33cf69ea67ba8f26aa5f455fc74433aa4..dd170c15514e7d5903aff2ac5ea9885cbcda7815 100644 (file)
@@ -462,8 +462,6 @@ 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 = u8(filename);\r
-\r
        std::ifstream file(filename);\r
 \r
        std::vector<unsigned char> buf;\r
@@ -474,7 +472,7 @@ bool is_valid_file(const std::wstring filename)
                return nullptr;\r
 \r
        AVProbeData pb;\r
-       pb.filename = filename2.c_str();\r
+       pb.filename = u8(filename).c_str();\r
        pb.buf          = buf.data();\r
        pb.buf_size = buf.size();\r
 \r
index 6b8c0772f3c07cd9ee27a660d140a9d31be6658f..2ff3fc9175cc33ca25baf6f3b43921682ac132e4 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(u8(print()) + " Failed to create FlashAxContainer"));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Failed to Create FlashAxControl"));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to Create FlashAxControl"));\r
                \r
                CComPtr<IShockwaveFlash> spFlash;\r
                if(FAILED(ax_->QueryControl(&spFlash)))\r
-                       BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to Query FlashAxControl"));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to Query FlashAxControl"));\r
                                                                                                \r
                if(FAILED(spFlash->put_Playing(true)) )\r
-                       BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to start playing Flash"));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to start playing Flash"));\r
 \r
                if(FAILED(spFlash->put_Movie(CComBSTR(filename.c_str()))))\r
-                       BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " Failed to Load Template Host"));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(print()) + " Failed to Set Scale Mode"));\r
+                       BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" 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(u8(param)));\r
+                       CASPAR_LOG(warning) << print() << L" Flash call failed:" << param;//BOOST_THROW_EXCEPTION(invalid_operation() << wmsg_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(u8(filename)));      \r
+                       BOOST_THROW_EXCEPTION(file_not_found() << werr_file_name_info(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(u8(print()));\r
+                               graph_->set_text(print());\r
 \r
                                render(renderer);\r
                        }\r
index 5479bf04715234353d002fa2337e156c83860b31..dbc64c70b1aae917e4110bbd1cc9e4fe0fe7a1b7 100644 (file)
@@ -43,7 +43,7 @@ void init()
 \r
 std::wstring get_version()\r
 {\r
-       return u16(std::string(FreeImage_GetVersion()));\r
+       return u16(FreeImage_GetVersion());\r
 }\r
 \r
 }}
\ No newline at end of file
index a5b75554eca7eddff20008deb49fda66f11c1904..8e0e64cad163025dcf08a9ff1f498f7b3f409f4a 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(u8(print())));\r
+                       BOOST_THROW_EXCEPTION(out_of_range() << arg_name_info("screen_index_") << wmsg_info(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(u8(print()) + " EnumDisplaySettings"));\r
+                       BOOST_THROW_EXCEPTION(invalid_operation() << arg_name_info("screen_index") << wmsg_info(print() + L" EnumDisplaySettings"));\r
                \r
                screen_x_               = devmode.dmPosition.x;\r
                screen_y_               = devmode.dmPosition.y;\r
index 2026b852a7d4748352aff3b98a46fd550afb6416..beb097056148daf708ceab49b04e1dea1679071f 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 ? u8(_parameters[0]) : ""));\r
+                       BOOST_THROW_EXCEPTION(file_not_found() << wmsg_info(_parameters.size() > 0 ? _parameters[0] : L""));\r
 \r
                bool auto_play = std::find(_parameters.begin(), _parameters.end(), L"AUTO") != _parameters.end();\r
 \r
index a3f4b43254735ee8b8f56553797f48aa1aedcfa5..1c9397cba5a79d2e66502d7eaf744e8ab44120b7 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(u16(xml_channel.second.get(L"video-mode", L"PAL")));          \r
+                       auto format_desc = video_format_desc::get(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: " << u16(name);       \r
+                                               CASPAR_LOG(warning) << "Invalid consumer: " << 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: " << u16(name);     \r
+                                       CASPAR_LOG(warning) << "Invalid controller: " << 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(u8(name)) << msg_info("Invalid protocol"));\r
+               BOOST_THROW_EXCEPTION(caspar_exception() << warg_name_info(L"name") << warg_value_info(name) << wmsg_info(L"Invalid protocol"));\r
        }\r
 };\r
 \r