]> git.sesse.net Git - casparcg/commitdiff
* Code changes required by Visual Studio 2015 including some local disabling of some...
authorHelge Norberg <helge.norberg@svt.se>
Thu, 17 Sep 2015 13:44:20 +0000 (15:44 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Thu, 17 Sep 2015 13:44:20 +0000 (15:44 +0200)
* Removed some workarounds previously required for Visual Studio 2013 but not for 2015.
* win32_exception is now a caspar_exception to allow complete stack trace information to be attached.
* streaming_consumer.cpp is now more backwards compatible with ffmpeg_consumer.cpp. Will hopefully be able to completely replace it.
* Fixed race condition in io_service shutdown.
* tbb_malloc does not work on vc14 yet. Disabled for now.

31 files changed:
CMakeLists.txt
accelerator/cpu/image/image_mixer.cpp
common/CMakeLists.txt
common/compiler/vs/StackWalker.cpp
common/compiler/vs/StackWalker.h
common/os/windows/win32_exception.cpp
common/os/windows/win32_exception.h
common/scope_exit.h
common/thread_info.cpp
common/tweener.cpp
core/CMakeLists.txt
core/diagnostics/osd_graph.cpp
core/monitor/monitor.cpp [deleted file]
core/producer/layer.h
core/producer/scene/expression_parser.h
core/producer/stage.h
core/producer/text/text_producer.cpp
core/producer/text/utils/texture_atlas.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/consumer/streaming_consumer.cpp
modules/flash/producer/FlashAxContainer.h
modules/flash/util/swf.cpp
modules/html/html.cpp
modules/html/producer/html_producer.cpp
modules/image/producer/image_scroll_producer.cpp
modules/psd/descriptor.cpp
modules/psd/util/pdf_reader.cpp
protocol/osc/oscpack/OscPrintReceivedElements.cpp
shell/main.cpp
shell/server.cpp

index 3683c49fc95900a3b8daa1a6d9b70afa31cf6add..b2861c8f5e98553fcd358ca1d17094529bb68ee9 100644 (file)
@@ -71,9 +71,10 @@ add_definitions( -DTBB_USE_CAPTURED_EXCEPTION=0 )
 add_definitions( -DUNICODE )
 add_definitions( -D_UNICODE )
 add_definitions( -DGLEW_NO_GLU )
+add_definitions( "-DBOOST_ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept(true)" ) # Workaround macro redefinition in boost
 
 if (MSVC)
-       set(CMAKE_CXX_FLAGS                                     "${CMAKE_CXX_FLAGS}                                     /EHa /Zi /W4 /WX /MP /fp:fast /FIcommon/compiler/vs/disable_silly_warnings.h")
+       set(CMAKE_CXX_FLAGS                                     "${CMAKE_CXX_FLAGS}                                     /EHa /Zi /W4 /WX /MP /fp:fast /Zm192 /FIcommon/compiler/vs/disable_silly_warnings.h")
        set(CMAKE_CXX_FLAGS_DEBUG                       "${CMAKE_CXX_FLAGS_DEBUG}                       /D TBB_USE_ASSERT=1 /D TBB_USE_DEBUG /bigobj")
        set(CMAKE_CXX_FLAGS_RELEASE                     "${CMAKE_CXX_FLAGS_RELEASE}                     /Oi /Ot /Gy /bigobj")
        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}      /Oi /Ot /Gy /bigobj /Ob2")
index 3491d226eaff8e6d1d3bfb91b0c54da5abc28a69..3b0c2e4a80a28d2b63a9489294e4a5bcab4594e8 100644 (file)
@@ -141,7 +141,7 @@ static void kernel(uint8_t* dest, const uint8_t* source, size_t count)
 {                      
        using namespace xmm;
 
-       if(reinterpret_cast<long>(dest) % 16 != 0 || reinterpret_cast<long>(source) % 16 != 0)
+       if(reinterpret_cast<std::uint64_t>(dest) % 16 != 0 || reinterpret_cast<std::uint64_t>(source) % 16 != 0)
                kernel<temporal_tag, unaligned_tag>(dest, source, count);
        else
                kernel<temporal_tag, aligned_tag>(dest, source, count);
index 27938f4ba14a7da3fd0d611935957aa8d39d69ed..b441b27b5c592e60f850e28eb93ecc17b092e97d 100644 (file)
@@ -156,10 +156,12 @@ if(MSVC)
        casparcg_add_runtime_dependency("${GLEW_BIN_PATH}/glew32.dll")
        casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb.dll")
        casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb_debug.dll")
-       casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc.dll")
-       casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_debug.dll")
-       casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy.dll")
-       casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy_debug.dll")
+
+       # Reenable when tbb gets official support for vc14
+       # casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc.dll")
+       # casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_debug.dll")
+       # casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy.dll")
+       # casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy_debug.dll")
 else()
        casparcg_add_runtime_dependency("${GLEW_BIN_PATH}/libGLEW.so.1.12")
        casparcg_add_runtime_dependency("${TBB_BIN_PATH}/libtbb.so.2")
index 904b13f32240cd22d8d65be79538050f4480f6d3..9af8223803e0a20ad14710b62613faaac325cb4e 100644 (file)
@@ -92,6 +92,7 @@
 // If VC7 and later, then use the shipped 'dbghelp.h'-file
 #pragma pack(push,8)
 #if _MSC_VER >= 1300
+#pragma warning(disable:4091)
 #include <dbghelp.h>
 #else
 // inline the important dbghelp.h-declarations...
index 4b9337b7c3662f2d6e5d75f7d692fe4e10fd3275..75e4ff4ca13c860883d893a413b9945aaba34bd8 100644 (file)
@@ -139,7 +139,7 @@ protected:
     CHAR loadedImageName[STACKWALK_MAX_NAMELEN];
   } CallstackEntry;
 
-  typedef enum CallstackEntryType {firstEntry, nextEntry, lastEntry};
+  enum CallstackEntryType {firstEntry, nextEntry, lastEntry};
 
   virtual void OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUserName);
   virtual void OnLoadModule(LPCSTR img, LPCSTR mod, DWORD64 baseAddr, DWORD size, DWORD result, LPCSTR symType, LPCSTR pdbName, ULONGLONG fileVersion);
index cd3428b884aa7d32415b4d7586af3e942fc3795d..75006bc25ad5e044edea19df8edd082aa0fcb393 100644 (file)
@@ -3,6 +3,7 @@
 #include "win32_exception.h"
 
 #include <boost/thread.hpp>
+#include <boost/lexical_cast.hpp>
 
 #include "../../thread_info.h"
 #include "windows.h"
@@ -73,43 +74,34 @@ void ensure_gpf_handler_installed_for_thread(
        }
 }
 
-void win32_exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo) {
-       switch(errorCode)
+msg_info_t generate_message(const EXCEPTION_RECORD& info)
+{
+       switch (info.ExceptionCode)
        {
        case EXCEPTION_ACCESS_VIOLATION:
-               throw win32_access_violation(*(pInfo->ExceptionRecord));
-               break;
+               {
+                       bool is_write = info.ExceptionInformation[0] == 1;
+                       auto bad_address = reinterpret_cast<const void*>(info.ExceptionInformation[1]);
+                       auto location = info.ExceptionAddress;
 
+                       return "Access violation at " + boost::lexical_cast<std::string>(location) + " trying to " + (is_write ? "write " : "read ") + boost::lexical_cast<std::string>(bad_address);
+               }
+       case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+       case EXCEPTION_INT_DIVIDE_BY_ZERO:
+               return "Divide by zero";
        default:
-               throw win32_exception(*(pInfo->ExceptionRecord));
+               return "Win32 exception";
        }
 }
 
-win32_exception::win32_exception(const EXCEPTION_RECORD& info) : message_("Win32 exception"), location_(info.ExceptionAddress), errorCode_(info.ExceptionCode)
-{
-       switch(info.ExceptionCode)
+void win32_exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo) {
+       switch(errorCode)
        {
        case EXCEPTION_ACCESS_VIOLATION:
-               message_ = "Access violation";
-               break;
-       case EXCEPTION_FLT_DIVIDE_BY_ZERO:
-       case EXCEPTION_INT_DIVIDE_BY_ZERO:
-               message_ = "Divide by zero";
-               break;
+               CASPAR_THROW_EXCEPTION(win32_access_violation() << generate_message(*(pInfo->ExceptionRecord)));
+       default:
+               CASPAR_THROW_EXCEPTION(win32_exception() << generate_message(*(pInfo->ExceptionRecord)));
        }
 }
 
-win32_access_violation::win32_access_violation(const EXCEPTION_RECORD& info) : win32_exception(info), isWrite_(false), badAddress_(0) 
-{
-       isWrite_ = info.ExceptionInformation[0] == 1;
-       badAddress_ = reinterpret_cast<win32_exception::address>(info.ExceptionInformation[1]);
-}
-
-const char* win32_access_violation::what() const
-{
-       sprintf_s<>(messageBuffer_, "Access violation at %p, trying to %s %p", location(), isWrite_?"write":"read", badAddress_);
-
-       return messageBuffer_;
-}
-
 }
index ca1869fd705a1948abfe66c30e2d7d59ffa533a3..a9311682bc89d6575bf586a3f70326659384169d 100644 (file)
@@ -31,43 +31,12 @@ typedef _EXCEPTION_POINTERS EXCEPTION_POINTERS;
 
 namespace caspar {
 
-class win32_exception : public std::exception
+struct win32_exception : virtual caspar_exception
 {
-public:
-       typedef const void* address;
-
-       address location() const { return location_; }
-       unsigned int error_code() const { return errorCode_; }
-       virtual const char* what() const throw() override { return message_; }
        static void Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo);
-
-protected:
-       win32_exception(const EXCEPTION_RECORD& info);
-
-private:
-       const char* message_;
-
-       address location_;
-       unsigned int errorCode_;
 };
 
-class win32_access_violation : public win32_exception
-{
-       mutable char messageBuffer_[256];
-
-public:
-       bool is_write() const { return isWrite_; }
-       address bad_address() const { return badAddress_;}
-       virtual const char* what() const throw() override;
-
-protected:
-       win32_access_violation(const EXCEPTION_RECORD& info);
-       friend void win32_exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo);
-
-private:
-       bool isWrite_;
-       address badAddress_;
-};
+struct win32_access_violation : virtual win32_exception { };
 
 }
 
index 39dc0f3e8f4c6c5bee46b2bc6b8ceae516337794..f433f1e1fff26a3cef5b43f699f3e4068cfdfe2f 100644 (file)
@@ -49,7 +49,10 @@ namespace detail
                        catch(...)
                        {
                                if(!std::uncaught_exception()) 
+#pragma warning(push)
+#pragma warning(disable: 4297)
                                        throw;
+#pragma warning(pop)
                                else
                                        CASPAR_LOG_CURRENT_EXCEPTION();
                        }
index 39377626586517b8fc896571970f9d4e77147533..9277dd43164b8f68a12cb4fce1453768f9288da0 100644 (file)
@@ -55,11 +55,11 @@ public:
 
                for (auto it = enumerable_.begin(); it != enumerable_.end();)
                {
-                       auto lock = it->second.lock();
+                       auto strong = it->second.lock();
 
-                       if (lock)
+                       if (strong)
                        {
-                               result.push_back(spl::make_shared_ptr(lock));
+                               result.push_back(spl::make_shared_ptr(strong));
                                ++it;
                        }
                        else
index bb2fc72a7b005e192671266b5beb217bae573d46..abfdac533b07a87dd71ef3fc34663f7324c5984a 100644 (file)
@@ -487,12 +487,12 @@ const std::vector<std::wstring>& tweener::names()
 
        static const auto result = []
        {
-               std::vector<std::wstring> result;
+               std::vector<std::wstring> tweens;
 
                for (auto& tween : get_tweens())
-                       result.push_back(tween.first);
+                       tweens.push_back(tween.first);
 
-               return result;
+               return tweens;
        }();
        //static const std::vector<std::wstring> result;
 
index 677ec6df71325ec025ac63d5ecccf131680d0aab..744e28857635597d8f13db400b86ab54185efa31 100644 (file)
@@ -22,8 +22,6 @@ set(SOURCES
                mixer/image/blend_modes.cpp
                mixer/mixer.cpp
 
-               monitor/monitor.cpp
-
                producer/color/color_producer.cpp
 
                producer/draw/freehand_producer.cpp
index 42d9377544da89580f9357e7c0ddcc3266cbbbb2..1753284c48562a1d9e5c55d10f26b21fe8744ff1 100644 (file)
@@ -61,10 +61,10 @@ sf::Color get_sfml_color(int color)
        auto c = caspar::diagnostics::color(color);
 
        return {
-               (color >> 24) & 255,
-               (color >> 16) & 255,
-               (color >> 8) & 255,
-               (color >> 0) & 255
+               static_cast<sf::Uint8>((color >> 24) & 255),
+               static_cast<sf::Uint8>((color >> 16) & 255),
+               static_cast<sf::Uint8>((color >> 8) & 255),
+               static_cast<sf::Uint8>((color >> 0) & 255)
        };
 }
 
diff --git a/core/monitor/monitor.cpp b/core/monitor/monitor.cpp
deleted file mode 100644 (file)
index f2ad450..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* Copyright 2013 Sveriges Television AB http://casparcg.com/
-*
-* This file is part of CasparCG (www.casparcg.com).
-*
-* CasparCG is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* CasparCG is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
-*
-* Author: Robert Nagy, ronag89@gmail.com
-*/
-#include "../StdAfx.h"
-
-#include "monitor.h"
-
-namespace caspar { namespace core { namespace monitor {
-
-/*class in_callers_thread_schedule_group : public Concurrency::ScheduleGroup
-{
-       virtual void ScheduleTask(Concurrency::TaskProc proc, void* data) override
-       {
-               proc(data);
-       }
-
-    virtual unsigned int Id() const override
-       {
-               return 1;
-       }
-
-    virtual unsigned int Reference() override
-       {
-               return 1;
-       }
-
-    virtual unsigned int Release() override
-       {
-               return 1;
-       }
-};
-
-Concurrency::ScheduleGroup& get_in_callers_thread_schedule_group()
-{
-       static in_callers_thread_schedule_group group;
-
-       return group;
-}*/
-
-}}}
index 34e44fbf06b14cce08e382661c00bdc0b943874e..2fb114f0381beb78b70fbeaf3feb97ac59df055f 100644 (file)
 #include <common/memory.h>
 
 #include <boost/property_tree/ptree_fwd.hpp>
+#include <boost/optional.hpp>
 
 #include <string>
 
-FORWARD1(boost, template<typename T> class optional);
-
 namespace caspar { namespace core {
        
 class layer final : public interaction_sink
@@ -57,7 +56,7 @@ public:
 
        void swap(layer& other);  
                
-       void load(spl::shared_ptr<frame_producer> producer, bool preview, const boost::optional<int32_t>& auto_play_delta = nullptr);
+       void load(spl::shared_ptr<frame_producer> producer, bool preview, const boost::optional<int32_t>& auto_play_delta = boost::optional<int32_t>());
        void play();
        void pause();
        void resume();
index bce1f9ce540691bc3363b0d22d09959204fbec85..6e54ee254d475499bb82d05ce609261582c2103c 100644 (file)
@@ -59,15 +59,9 @@ static binding<T> parse_expression(
                                + u16(expr.type().name())));
 }
 
-#if defined(_MSC_VER)
-template<>
-static binding<std::wstring> parse_expression(
-       const std::wstring& str, const variable_repository& var_repo)
-#else
 template<>
 binding<std::wstring> parse_expression(
        const std::wstring& str, const variable_repository& var_repo)
-#endif
 {
        auto cursor = str.cbegin();
        auto expr = parse_expression(cursor, str, var_repo);
index 25445c70be44004caaf37ba3eaaf1f6a73206666..a25d72e99e15b76780d0ead12e53227e9f466a10 100644 (file)
@@ -68,7 +68,7 @@ public:
        std::future<void>                               clear_transforms(int index);
        std::future<void>                               clear_transforms();
        std::future<frame_transform>    get_current_transform(int index);
-       std::future<void>                               load(int index, const spl::shared_ptr<frame_producer>& producer, bool preview = false, const boost::optional<int32_t>& auto_play_delta = nullptr);
+       std::future<void>                               load(int index, const spl::shared_ptr<frame_producer>& producer, bool preview = false, const boost::optional<int32_t>& auto_play_delta = boost::optional<int32_t>());
        std::future<void>                               pause(int index);
        std::future<void>                               resume(int index);
        std::future<void>                               play(int index);
index 2c1f22e0824b95a8cee59f44eb0cfe5c7c6ba1e1..27424f5c7b65b08db3a9bc7eae2e195fff1862f8 100644 (file)
@@ -69,7 +69,7 @@ namespace caspar { namespace core { namespace text {
 
 using namespace boost::filesystem;
 
-std::map<std::wstring, std::wstring> fonts;
+std::map<std::wstring, std::wstring> g_fonts;
 
 std::map<std::wstring, std::wstring> enumerate_fonts()
 {
@@ -113,15 +113,15 @@ spl::shared_ptr<frame_producer> create_text_producer(const frame_producer_depend
 
 void init(module_dependencies dependencies)
 {
-       fonts = enumerate_fonts();
+       g_fonts = enumerate_fonts();
        dependencies.producer_registry->register_producer_factory(L"Text Producer", create_text_producer, describe_text_producer);
 }
 
 text_info& find_font_file(text_info& info)
 {
        auto& font_name = info.font;
-       auto it = std::find_if(fonts.begin(), fonts.end(), font_comparer(font_name));
-       info.font_file = (it != fonts.end()) ? (*it).second : L"";
+       auto it = std::find_if(g_fonts.begin(), g_fonts.end(), font_comparer(font_name));
+       info.font_file = (it != g_fonts.end()) ? (*it).second : L"";
        return info;
 }
 
index fde688f071f9fbe88620a16966147f880a546591..f56dbb91f95b324e3cfb6460427ab49572532f62 100644 (file)
@@ -77,8 +77,7 @@ public:
                int best_width = INT_MAX;
                node_iterator best_it = nodes_.end();
 
-               auto it = nodes_.begin();
-               for(; it != nodes_.end(); ++it)
+               for(auto it = nodes_.begin(); it != nodes_.end(); ++it)
                {
                        int y = fit(it, width, height);
                        if( y >= 0 )
index 07acf075934e51a49de7685cb19d6323bfb07567..41b49d66dea45eeead936ef72a9dafb603984900 100644 (file)
@@ -113,8 +113,7 @@ void set_keyer(
                configuration::keyer_t keyer,
                const std::wstring& print)
 {
-       if (keyer == configuration::keyer_t::internal_keyer
-                       || keyer == configuration::keyer_t::external_separate_device_keyer)
+       if (keyer == configuration::keyer_t::internal_keyer)
        {
                BOOL value = true;
                if (SUCCEEDED(attributes->GetFlag(BMDDeckLinkSupportsInternalKeying, &value)) && !value)
index 13371b0b3054c015e7bc87efcaf24d8a7d9bb21c..4a5aa2ecd47c7bb09072b4573abe31d3926abab5 100644 (file)
@@ -419,8 +419,8 @@ private:
                c->codec_type           = AVMEDIA_TYPE_VIDEO;
                c->width                        = output_format_.width;
                c->height                       = output_format_.height - output_format_.croptop - output_format_.cropbot;
-               c->time_base.den        = format_desc_.time_scale;
-               c->time_base.num        = format_desc_.duration;
+               st->time_base.den       = format_desc_.time_scale;
+               st->time_base.num       = format_desc_.duration;
                c->gop_size                     = 25;
                c->flags                   |= format_desc_.field_mode == core::field_mode::progressive ? 0 : (CODEC_FLAG_INTERLACED_ME | CODEC_FLAG_INTERLACED_DCT);
                c->pix_fmt                      = c->pix_fmt != PIX_FMT_NONE ? c->pix_fmt : PIX_FMT_YUV420P;
@@ -509,8 +509,8 @@ private:
                c->sample_rate          = 48000;
                c->channels                     = 2;
                c->sample_fmt           = AV_SAMPLE_FMT_S16;
-               c->time_base.num        = 1;
-               c->time_base.den        = c->sample_rate;
+               st->time_base.num       = 1;
+               st->time_base.den       = c->sample_rate;
 
                if(output_format_.vcodec == CODEC_ID_FLV1)              
                        c->sample_rate  = 44100;                
@@ -541,7 +541,7 @@ private:
                auto av_frame                           = convert_video(frame, enc);
                av_frame->interlaced_frame      = format_desc_.field_mode != core::field_mode::progressive;
                av_frame->top_field_first       = format_desc_.field_mode == core::field_mode::upper;
-               av_frame->pts                           = frame_number_++;
+               av_frame->pts = frame_number_++;
 
                monitor_subject_ << core::monitor::message("/frame")
                                % static_cast<int64_t>(frame_number_)
@@ -687,6 +687,10 @@ private:
                                  out_frame->data, 
                                  out_frame->linesize);
 
+               out_frame->format       = c->pix_fmt;
+               out_frame->width        = c->width;
+               out_frame->height       = c->height;
+
                return out_frame;
        }
        
@@ -764,7 +768,7 @@ public:
        ffmpeg_consumer_proxy(const std::wstring& filename, const std::vector<option>& options, bool separate_key)
                : filename_(filename)
                , options_(options)
-               , separate_key_(separate_key_)
+               , separate_key_(separate_key)
        {
        }
        
index 0c29df80f9baa7280fcdd47c5254f8cd8869859f..8de055b19c3c136e36b29bc324cfb2c620c58341 100644 (file)
@@ -81,6 +81,7 @@ private:
        int                                                                                     consumer_index_offset_;
 
        std::map<std::string, std::string>                      options_;
+       bool                                                                            compatibility_mode_;
                                                                                                
        core::video_format_desc                                         in_video_format_;
 
@@ -119,9 +120,11 @@ public:
 
        streaming_consumer(
                        std::string path, 
-                       std::string options)
+                       std::string options,
+                       bool compatibility_mode)
                : path_(path)
                , consumer_index_offset_(crc16(path))
+               , compatibility_mode_(compatibility_mode)
                , video_pts_(0)
                , audio_pts_(0)
                , executor_(print())
@@ -196,7 +199,7 @@ public:
                        const auto overwrite = 
                                try_remove_arg<std::string>(
                                        options_,
-                                       boost::regex("y")) != nullptr;
+                                       boost::regex("y")) != boost::none;
 
                        if(!boost::regex_match(
                                        path_.string(), 
@@ -212,7 +215,7 @@ public:
                        
                                if(boost::filesystem::exists(path_))
                                {
-                                       if(!overwrite)
+                                       if(!overwrite && !compatibility_mode_)
                                                BOOST_THROW_EXCEPTION(invalid_argument() << msg_info("File exists"));
                                                
                                        boost::filesystem::remove(path_);
@@ -454,7 +457,7 @@ public:
 
        int index() const override
        {
-               return 100000 + consumer_index_offset_;
+               return compatibility_mode_ ? 200 : 100000 + consumer_index_offset_;
        }
 
        int64_t presentation_frame_age_millis() const override
@@ -490,22 +493,23 @@ private:
                switch(enc->codec_type)
                {
                        case AVMEDIA_TYPE_VIDEO:
-                       {                               
-                               enc->time_base                    = video_graph_out_->inputs[0]->time_base;
-                               enc->pix_fmt                      = static_cast<AVPixelFormat>(video_graph_out_->inputs[0]->format);
-                               enc->sample_aspect_ratio  = st->sample_aspect_ratio = video_graph_out_->inputs[0]->sample_aspect_ratio;
-                               enc->width                                = video_graph_out_->inputs[0]->w;
-                               enc->height                               = video_graph_out_->inputs[0]->h;
+                       {
+                               st->time_base                           = video_graph_out_->inputs[0]->time_base;
+                               enc->pix_fmt                            = static_cast<AVPixelFormat>(video_graph_out_->inputs[0]->format);
+                               enc->sample_aspect_ratio        = st->sample_aspect_ratio = video_graph_out_->inputs[0]->sample_aspect_ratio;
+                               enc->width                                      = video_graph_out_->inputs[0]->w;
+                               enc->height                                     = video_graph_out_->inputs[0]->h;
+                               enc->bit_rate_tolerance         = 400 * 1000000;
                        
                                break;
                        }
                        case AVMEDIA_TYPE_AUDIO:
                        {
-                               enc->time_base                    = audio_graph_out_->inputs[0]->time_base;
-                               enc->sample_fmt                   = static_cast<AVSampleFormat>(audio_graph_out_->inputs[0]->format);
-                               enc->sample_rate                  = audio_graph_out_->inputs[0]->sample_rate;
-                               enc->channel_layout               = audio_graph_out_->inputs[0]->channel_layout;
-                               enc->channels                     = audio_graph_out_->inputs[0]->channels;
+                               st->time_base                           = audio_graph_out_->inputs[0]->time_base;
+                               enc->sample_fmt                         = static_cast<AVSampleFormat>(audio_graph_out_->inputs[0]->format);
+                               enc->sample_rate                        = audio_graph_out_->inputs[0]->sample_rate;
+                               enc->channel_layout                     = audio_graph_out_->inputs[0]->channel_layout;
+                               enc->channels                           = audio_graph_out_->inputs[0]->channels;
                        
                                break;
                        }
@@ -1277,13 +1281,14 @@ void describe_streaming_consumer(core::help_sink& sink, const core::help_reposit
 spl::shared_ptr<core::frame_consumer> create_streaming_consumer(
                const std::vector<std::wstring>& params, core::interaction_sink*)
 {       
-       if (params.size() < 1 || params.at(0) != L"STREAM")
+       if (params.size() < 1 || (!boost::iequals(params.at(0), L"STREAM") && !boost::iequals(params.at(0), L"FILE")))
                return core::frame_consumer::empty();
 
-       auto path = u8(params.at(1));
+       auto compatibility_mode = boost::iequals(params.at(0), L"FILE");
+       auto path = u8(params.size() > 1 ? params.at(1) : L"");
        auto args = u8(boost::join(params, L" "));
 
-       return spl::make_shared<streaming_consumer>(path, args);
+       return spl::make_shared<streaming_consumer>(path, args, compatibility_mode);
 }
 
 spl::shared_ptr<core::frame_consumer> create_preconfigured_streaming_consumer(
@@ -1291,7 +1296,8 @@ spl::shared_ptr<core::frame_consumer> create_preconfigured_streaming_consumer(
 {                      
        return spl::make_shared<streaming_consumer>(
                        u8(ptree.get<std::wstring>(L"path")), 
-                       u8(ptree.get<std::wstring>(L"args", L"")));
+                       u8(ptree.get<std::wstring>(L"args", L"")),
+                       false);
 }
 
 }}
index 274cf98727ccf068be0e18a03afe68df51c3381f..7579fabbbc450e977abcd086c28224dd42b2d1f2 100644 (file)
@@ -126,8 +126,8 @@ public:
        END_COM_MAP()
 
        BEGIN_SINK_MAP(FlashAxContainer)
-               SINK_ENTRY_INFO(0, DIID__IShockwaveFlashEvents, 0xc5, OnFlashCall, &fnInfoFlashCallEvent)
-               SINK_ENTRY_INFO(0, DIID__IShockwaveFlashEvents, 0xfffffd9f, OnReadyStateChange, &fnInfoReadyStateChangeEvent)
+               SINK_ENTRY_INFO(0, DIID__IShockwaveFlashEvents, static_cast<DISPID>(0xc5), OnFlashCall, &fnInfoFlashCallEvent)
+               SINK_ENTRY_INFO(0, DIID__IShockwaveFlashEvents, static_cast<DISPID>(0xfffffd9f), OnReadyStateChange, &fnInfoReadyStateChangeEvent)
        END_SINK_MAP()
 
        void STDMETHODCALLTYPE OnFlashCall(BSTR request);
index 8132624f9257a957a7735b7d881b19ea574d2a22..cd976e7cac569f47333261aa31963843a39876cd 100644 (file)
@@ -113,16 +113,16 @@ swf_t::header_t::header_t(const std::wstring& filename)
        std::vector<char> file_data;
        std::copy((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>(), std::back_inserter(file_data));
 
-       std::array<char, 32> data;
+       std::array<char, 32> uncompressed_data;
        uLongf file_size = 32;
-       auto ret = uncompress(reinterpret_cast<Bytef*>(data.data()), &file_size, reinterpret_cast<const Bytef*>(file_data.data()), static_cast<uLong>(file_data.size()));
+       auto ret = uncompress(reinterpret_cast<Bytef*>(uncompressed_data.data()), &file_size, reinterpret_cast<const Bytef*>(file_data.data()), static_cast<uLong>(file_data.size()));
 
        if (ret == Z_DATA_ERROR)
                CASPAR_THROW_EXCEPTION(io_error());
        
        // http://thenobody.blog.matfyz.sk/p13084-how-to-get-dimensions-of-a-swf-file
 
-       unsigned char nbits = reinterpret_cast<unsigned char*>(data.data())[0];
+       unsigned char nbits = reinterpret_cast<unsigned char*>(uncompressed_data.data())[0];
 
        unsigned int size = nbits >> 3;                    // remove overlaping 3 bits
 
@@ -141,7 +141,7 @@ swf_t::header_t::header_t(const std::wstring& filename)
                for (unsigned int j = 0; j < by_offset; ++j)
                {
                        ibuf <<= 8;
-                       ibuf +=  reinterpret_cast<unsigned char*>(data.data())[1+ioffset+j];
+                       ibuf +=  reinterpret_cast<unsigned char*>(uncompressed_data.data())[1+ioffset+j];
                }
 
                dims[i] = (ibuf >> (3 + bi_offset + (i * bi_offset))) / 20;    // coordinates in twips, so divide by 20 for pixels
index 5a12a2fce37f5889245e377eec5cdf8f849c460b..a537ed6c15ba23a940b18e7a79077024a8e1e690 100644 (file)
 #include <boost/lexical_cast.hpp>
 #include <boost/log/trivial.hpp>
 
+#pragma warning(push)
+#pragma warning(disable: 4458)
 #include <cef_app.h>
+#pragma warning(pop)
 
 #pragma comment(lib, "libcef.lib")
 #pragma comment(lib, "libcef_dll_wrapper.lib")
index a1babe41b5ee77629154d95e5d3680a47e7a8b07..896f6e2793bfe6a56090ffadb933727fe0e24cd0 100644 (file)
 #include <tbb/atomic.h>
 #include <tbb/concurrent_queue.h>
 
+#pragma warning(push)
+#pragma warning(disable: 4458)
 #include <cef_task.h>
 #include <cef_app.h>
 #include <cef_client.h>
 #include <cef_render_handler.h>
+#pragma warning(pop)
 
 #include <asmlib.h>
 
index c5f6a42e02bbc6dc2376d5c05f4e3339c7523d2d..ebbde5e1a207de93e436659d63a7a66b3473e793 100644 (file)
@@ -52,6 +52,7 @@
 
 #include <algorithm>
 #include <array>
+#include <cstdint>
 
 namespace caspar { namespace image {
                
@@ -173,7 +174,7 @@ struct image_scroll_producer : public core::frame_producer_base
                        {
                                core::pixel_format_desc desc = core::pixel_format::bgra;
                                desc.planes.push_back(core::pixel_format_desc::plane(width_, format_desc_.height, 4));
-                               auto frame = frame_factory->create_frame(reinterpret_cast<void*>(rand()), desc);
+                               auto frame = frame_factory->create_frame(this, desc);
 
                                if(count >= frame.image_data(0).size())
                                {       
@@ -202,7 +203,7 @@ struct image_scroll_producer : public core::frame_producer_base
                        {
                                core::pixel_format_desc desc = core::pixel_format::bgra;
                                desc.planes.push_back(core::pixel_format_desc::plane(format_desc_.width, height_, 4));
-                               auto frame = frame_factory->create_frame(reinterpret_cast<void*>(rand()), desc);
+                               auto frame = frame_factory->create_frame(this, desc);
                                if(count >= frame.image_data(0).size())
                                {       
                                        for(int y = 0; y < height_; ++y)
index 1d8d939c9756388cab08cb58e0884c8a33f017ad..56a3ed6681976010241b6046ab7fbe5c8a24bfaa 100644 (file)
@@ -81,9 +81,9 @@ void descriptor::populate(bigendian_file_input_stream& stream)
 
 void descriptor::read_value(const std::wstring& key, bigendian_file_input_stream& stream)
 {
-       auto type = stream.read_long();
+       auto value_type = stream.read_long();
 
-       switch(type)
+       switch(value_type)
        {
        case 'Objc': 
                {
index ee63bae181100c6350e6ac2ed3b5e44abcdb23ef..fb5d784328dfdc7c48adb450c04aebdd86ac20b2 100644 (file)
 
 #include <common/log.h>
 
+#pragma warning(push)
+#pragma warning(disable: 4459)
+#pragma warning(disable: 4244)
 #include <boost/spirit/home/qi.hpp>
+#pragma warning(pop)
+
 #include <boost/lexical_cast.hpp>
 
 #include <cstdint>
index 128cc59ff8bce02a6d78ed807f8987db3a1e69a2..c7492f53fcf2b13520e856190c4ebb122172e7a3 100644 (file)
@@ -211,8 +211,8 @@ std::ostream& operator<<( std::ostream & os, const ReceivedBundle& b )
     for( ReceivedBundle::const_iterator i = b.ElementsBegin();
             i != b.ElementsEnd(); ++i ){
         if( i->IsBundle() ){
-            ReceivedBundle b(*i);
-            os << b << "\n";
+            ReceivedBundle b2(*i);
+            os << b2 << "\n";
         }else{
             ReceivedMessage m(*i);
             for( int j=0; j < indent; ++j )
index 3fb48ba3f55a6e73f2fe44246768ba877d09caab..9c1f6b36307877629635f0071a13890831f698a9 100644 (file)
@@ -33,7 +33,8 @@
        #include <stdlib.h>
        #include <crtdbg.h>
 #else
-       #include <tbb/tbbmalloc_proxy.h>
+       // Reenable when tbb gets official support for vc14
+       //#include <tbb/tbbmalloc_proxy.h>
 #endif
 
 #include "server.h"
index 57bd4fc86a2435eb877201ab9ff8393e97c71c3f..ecc3add8547f757d2c5ac57516c5a13635fc1c30 100644 (file)
@@ -89,7 +89,7 @@ std::shared_ptr<boost::asio::io_service> create_running_io_service()
        {
                ensure_gpf_handler_installed_for_thread("asio-thread");
 
-               while (weak_work.lock())
+               while (auto strong = weak_work.lock())
                {
                        try
                        {