<ClInclude Include="concurrency\executor.h" />\r
<ClInclude Include="concurrency\lock.h" />\r
<ClInclude Include="diagnostics\graph.h" />\r
- <ClInclude Include="exception\exceptions.h" />\r
- <ClInclude Include="exception\win32_exception.h" />\r
+ <ClInclude Include="except.h" />\r
<ClInclude Include="forward.h" />\r
<ClInclude Include="gl\gl_check.h" />\r
<ClInclude Include="log.h" />\r
<ClInclude Include="os\windows\windows.h" />\r
<ClInclude Include="reactive.h" />\r
<ClInclude Include="stdafx.h" />\r
+ <ClInclude Include="tweener.h" />\r
<ClInclude Include="utf.h" />\r
<ClInclude Include="prec_timer.h" />\r
<ClInclude Include="utility\move_on_copy.h" />\r
<ClInclude Include="utility\param.h" />\r
- <ClInclude Include="utility\tweener.h" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="diagnostics\graph.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
- <ClCompile Include="exception\win32_exception.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
+ <ClCompile Include="except.cpp" />\r
<ClCompile Include="gl\gl_check.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">Create</PrecompiledHeader>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">Create</PrecompiledHeader>\r
</ClCompile>\r
- <ClCompile Include="utf.cpp" />\r
- <ClCompile Include="prec_timer.cpp" />\r
- <ClCompile Include="utility\tweener.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../stdafx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../stdafx.h</PrecompiledHeaderFile>\r
+ <ClCompile Include="tweener.cpp">\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">Use</PrecompiledHeader>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">../stdafx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|x64'">StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">Use</PrecompiledHeader>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">../stdafx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
+ <ClCompile Include="utf.cpp" />\r
+ <ClCompile Include="prec_timer.cpp" />\r
</ItemGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
<Filter Include="source\gl">\r
<UniqueIdentifier>{0d94bbc2-e196-4618-a90b-19392a3a0a8e}</UniqueIdentifier>\r
</Filter>\r
- <Filter Include="source\exception">\r
- <UniqueIdentifier>{35ca385e-c4db-4fe7-858b-0a0bb678675f}</UniqueIdentifier>\r
- </Filter>\r
<Filter Include="source\diagnostics">\r
<UniqueIdentifier>{29a29bcc-a9a0-4083-b713-c3773d18e177}</UniqueIdentifier>\r
</Filter>\r
</Filter>\r
</ItemGroup>\r
<ItemGroup>\r
- <ClCompile Include="exception\win32_exception.cpp">\r
- <Filter>source\exception</Filter>\r
- </ClCompile>\r
<ClCompile Include="diagnostics\graph.cpp">\r
<Filter>source\diagnostics</Filter>\r
</ClCompile>\r
<ClCompile Include="env.cpp">\r
<Filter>source</Filter>\r
</ClCompile>\r
- <ClCompile Include="utility\tweener.cpp">\r
- <Filter>source\utility</Filter>\r
- </ClCompile>\r
<ClCompile Include="utf.cpp">\r
<Filter>source</Filter>\r
</ClCompile>\r
<ClCompile Include="log.cpp">\r
<Filter>source</Filter>\r
</ClCompile>\r
+ <ClCompile Include="except.cpp">\r
+ <Filter>source</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="tweener.cpp">\r
+ <Filter>source</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
- <ClInclude Include="exception\exceptions.h">\r
- <Filter>source\exception</Filter>\r
- </ClInclude>\r
- <ClInclude Include="exception\win32_exception.h">\r
- <Filter>source\exception</Filter>\r
- </ClInclude>\r
<ClInclude Include="compiler\vs\disable_silly_warnings.h">\r
<Filter>source\compiler\vs</Filter>\r
</ClInclude>\r
<Filter>source\diagnostics</Filter>\r
</ClInclude>\r
<ClInclude Include="stdafx.h" />\r
- <ClInclude Include="utility\tweener.h">\r
- <Filter>source\utility</Filter>\r
- </ClInclude>\r
<ClInclude Include="os\windows\current_version.h">\r
<Filter>source\os\windows</Filter>\r
</ClInclude>\r
<ClInclude Include="concurrency\defer.h">\r
<Filter>source\concurrency</Filter>\r
</ClInclude>\r
+ <ClInclude Include="except.h">\r
+ <Filter>source</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="tweener.h">\r
+ <Filter>source</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
\r
#pragma once\r
\r
-#include "../exception/win32_exception.h"\r
-#include "../utility/move_on_copy.h"\r
+#include "../except.h"\r
#include "../log.h"\r
+#include "../utility/move_on_copy.h"\r
\r
#include <Windows.h>\r
\r
\r
#include "../version.h"\r
\r
+#include "except.h"\r
#include "log.h"\r
-#include "exception/exceptions.h"\r
#include "string.h"\r
\r
#include <boost/property_tree/ptree.hpp>\r
-/*\r
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
-*\r
-* This file is part of CasparCG (www.casparcg.com).\r
-*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-* Author: Robert Nagy, ronag89@gmail.com\r
-*/\r
+#include "stdafx.h"\r
\r
-#include "../stdafx.h"\r
+#include "except.h"\r
\r
-#include "win32_exception.h"\r
-\r
-#include "../os/windows/windows.h"\r
+#include "os/windows/windows.h"\r
\r
namespace caspar {\r
-\r
+ \r
void win32_exception::install_handler() \r
{\r
//#ifndef _DEBUG\r
\r
#pragma once\r
\r
-#include "../utf.h"\r
+#include "utf.h"\r
\r
#include <exception>\r
#include <boost/exception/all.hpp>\r
#include <boost/exception/error_info.hpp>\r
#include <boost/throw_exception.hpp>\r
\r
+struct _EXCEPTION_RECORD;\r
+struct _EXCEPTION_POINTERS;\r
+\r
+typedef _EXCEPTION_RECORD EXCEPTION_RECORD;\r
+typedef _EXCEPTION_POINTERS EXCEPTION_POINTERS;\r
+\r
namespace caspar {\r
\r
typedef boost::error_info<struct tag_arg_name_info, std::string> arg_name_info_t;\r
struct not_supported : virtual caspar_exception {};\r
struct not_implemented : virtual caspar_exception {};\r
\r
+class win32_exception : public std::exception\r
+{\r
+public:\r
+ typedef const void* address;\r
+ static void install_handler();\r
+\r
+ address location() const { return location_; }\r
+ unsigned int error_code() const { return errorCode_; }\r
+ virtual const char* what() const { return message_; }\r
+\r
+protected:\r
+ win32_exception(const EXCEPTION_RECORD& info);\r
+ static void Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo);\r
+\r
+private:\r
+ const char* message_;\r
+\r
+ address location_;\r
+ unsigned int errorCode_;\r
+};\r
+\r
+class win32_access_violation : public win32_exception\r
+{\r
+ mutable char messageBuffer_[256];\r
+\r
+public:\r
+ bool is_write() const { return isWrite_; }\r
+ address bad_address() const { return badAddress_;}\r
+ virtual const char* what() const;\r
+\r
+protected:\r
+ win32_access_violation(const EXCEPTION_RECORD& info);\r
+ friend void win32_exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo);\r
+\r
+private:\r
+ bool isWrite_;\r
+ address badAddress_;\r
+};\r
+\r
}\r
\r
namespace std\r
+++ /dev/null
-/*\r
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
-*\r
-* This file is part of CasparCG (www.casparcg.com).\r
-*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-* Author: Robert Nagy, ronag89@gmail.com\r
-*/\r
-\r
-#pragma once\r
-\r
-#include "exceptions.h"\r
-\r
-struct _EXCEPTION_RECORD;\r
-struct _EXCEPTION_POINTERS;\r
-\r
-typedef _EXCEPTION_RECORD EXCEPTION_RECORD;\r
-typedef _EXCEPTION_POINTERS EXCEPTION_POINTERS;\r
-\r
-namespace caspar {\r
-\r
-class win32_exception : public std::exception\r
-{\r
-public:\r
- typedef const void* address;\r
- static void install_handler();\r
-\r
- address location() const { return location_; }\r
- unsigned int error_code() const { return errorCode_; }\r
- virtual const char* what() const { return message_; }\r
-\r
-protected:\r
- win32_exception(const EXCEPTION_RECORD& info);\r
- static void Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo);\r
-\r
-private:\r
- const char* message_;\r
-\r
- address location_;\r
- unsigned int errorCode_;\r
-};\r
-\r
-class win32_access_violation : public win32_exception\r
-{\r
- mutable char messageBuffer_[256];\r
-\r
-public:\r
- bool is_write() const { return isWrite_; }\r
- address bad_address() const { return badAddress_;}\r
- virtual const char* what() const;\r
-\r
-protected:\r
- win32_access_violation(const EXCEPTION_RECORD& info);\r
- friend void win32_exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo);\r
-\r
-private:\r
- bool isWrite_;\r
- address badAddress_;\r
-};\r
-\r
-}
\ No newline at end of file
\r
#pragma once\r
\r
-#include "../exception/exceptions.h"\r
+#include "../except.h"\r
\r
namespace caspar { namespace gl {\r
\r
// * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.\r
//\r
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-#include "../stdafx.h"\r
+#include "stdafx.h"\r
\r
#include "tweener.h"\r
\r
+#include "except.h"\r
+\r
#include <boost/assign/list_of.hpp>\r
#include <boost/regex.hpp>\r
#include <boost/lexical_cast.hpp>\r
#include <functional>\r
#include <vector>\r
\r
-namespace caspar {\r
+namespace caspar { namespace core {\r
\r
typedef std::function<double(double, double, double, double)> tweener_t;\r
\r
\r
auto it = tweens.find(name);\r
if(it == tweens.end())\r
- it = tweens.find(L"linear");\r
+ BOOST_THROW_EXCEPTION(invalid_argument() << msg_info("Could not find tween.") << arg_value_info(name));\r
\r
return [=](double t, double b, double c, double d)\r
{\r
};\r
};\r
\r
-}
\ No newline at end of file
+tweener::tweener(const std::wstring& name)\r
+ : func_(get_tweener(name))\r
+{\r
+}\r
+\r
+tweener::tweener(const wchar_t* name)\r
+ : func_(get_tweener(name))\r
+{\r
+}\r
+\r
+double tweener::operator()(double t, double b , double c, double d) const\r
+{\r
+ return func_(t, b, c, d);\r
+}\r
+\r
+}}
\ No newline at end of file
\r
#include <functional>\r
\r
-namespace caspar {\r
+namespace caspar { namespace core {\r
\r
-typedef std::function<double(double, double, double, double)> tweener_t;\r
-tweener_t get_tweener(std::wstring name = L"linear");\r
+class tweener\r
+{\r
+public:\r
+ tweener(const std::wstring& name = L"linear");\r
+ tweener(const wchar_t* name);\r
+ double operator()(double t, double b , double c, double d) const;\r
+private:\r
+ std::function<double(double, double, double, double)> func_;\r
+};\r
\r
-}
\ No newline at end of file
+}}
\ No newline at end of file
//#include "../common/concurrency/executor.h" // Can't include this due to MSVC lambda bug\r
\r
#include <common/log.h>\r
-#include <common/exception/exceptions.h>\r
-#include <common/exception/win32_exception.h>\r
+#include <common/except.h>\r
\r
#include <common/env.h>\r
#include <common/memory/safe_ptr.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <core/video_format.h>\r
#include <core/frame/data_frame.h>\r
\r
return frame_transform(*this) *= other;\r
}\r
\r
-frame_transform tween(double time, const frame_transform& source, const frame_transform& dest, double duration, const tweener_t& tweener)\r
+frame_transform frame_transform::tween(double time, const frame_transform& source, const frame_transform& dest, double duration, const tweener& tween)\r
{ \r
- auto do_tween = [](double time, double source, double dest, double duration, const tweener_t& tweener)\r
+ auto do_tween = [](double time, double source, double dest, double duration, const tweener& tween)\r
{\r
- return tweener(time, source, dest-source, duration);\r
+ return tween(time, source, dest-source, duration);\r
};\r
\r
frame_transform result; \r
- result.volume = do_tween(time, source.volume, dest.volume, duration, tweener);\r
- result.brightness = do_tween(time, source.brightness, dest.brightness, duration, tweener);\r
- result.contrast = do_tween(time, source.contrast, dest.contrast, duration, tweener);\r
- result.saturation = do_tween(time, source.saturation, dest.saturation, duration, tweener);\r
- result.opacity = do_tween(time, source.opacity, dest.opacity, duration, tweener); \r
- result.fill_translation[0] = do_tween(time, source.fill_translation[0], dest.fill_translation[0], duration, tweener), \r
- result.fill_translation[1] = do_tween(time, source.fill_translation[1], dest.fill_translation[1], duration, tweener); \r
- result.fill_scale[0] = do_tween(time, source.fill_scale[0], dest.fill_scale[0], duration, tweener), \r
- result.fill_scale[1] = do_tween(time, source.fill_scale[1], dest.fill_scale[1], duration, tweener); \r
- result.clip_translation[0] = do_tween(time, source.clip_translation[0], dest.clip_translation[0], duration, tweener), \r
- result.clip_translation[1] = do_tween(time, source.clip_translation[1], dest.clip_translation[1], duration, tweener); \r
- result.clip_scale[0] = do_tween(time, source.clip_scale[0], dest.clip_scale[0], duration, tweener), \r
- result.clip_scale[1] = do_tween(time, source.clip_scale[1], dest.clip_scale[1], duration, tweener);\r
- result.levels.max_input = do_tween(time, source.levels.max_input, dest.levels.max_input, duration, tweener);\r
- result.levels.min_input = do_tween(time, source.levels.min_input, dest.levels.min_input, duration, tweener); \r
- result.levels.max_output = do_tween(time, source.levels.max_output, dest.levels.max_output, duration, tweener);\r
- result.levels.min_output = do_tween(time, source.levels.min_output, dest.levels.min_output, duration, tweener);\r
- result.levels.gamma = do_tween(time, source.levels.gamma, dest.levels.gamma, duration, tweener);\r
- result.field_mode = static_cast<field_mode>(source.field_mode & dest.field_mode);\r
+ result.volume = do_tween(time, source.volume, dest.volume, duration, tween);\r
+ result.brightness = do_tween(time, source.brightness, dest.brightness, duration, tween);\r
+ result.contrast = do_tween(time, source.contrast, dest.contrast, duration, tween);\r
+ result.saturation = do_tween(time, source.saturation, dest.saturation, duration, tween);\r
+ result.opacity = do_tween(time, source.opacity, dest.opacity, duration, tween); \r
+ result.fill_translation[0] = do_tween(time, source.fill_translation[0], dest.fill_translation[0], duration, tween), \r
+ result.fill_translation[1] = do_tween(time, source.fill_translation[1], dest.fill_translation[1], duration, tween); \r
+ result.fill_scale[0] = do_tween(time, source.fill_scale[0], dest.fill_scale[0], duration, tween), \r
+ result.fill_scale[1] = do_tween(time, source.fill_scale[1], dest.fill_scale[1], duration, tween); \r
+ result.clip_translation[0] = do_tween(time, source.clip_translation[0], dest.clip_translation[0], duration, tween), \r
+ result.clip_translation[1] = do_tween(time, source.clip_translation[1], dest.clip_translation[1], duration, tween); \r
+ result.clip_scale[0] = do_tween(time, source.clip_scale[0], dest.clip_scale[0], duration, tween), \r
+ result.clip_scale[1] = do_tween(time, source.clip_scale[1], dest.clip_scale[1], duration, tween);\r
+ result.levels.max_input = do_tween(time, source.levels.max_input, dest.levels.max_input, duration, tween);\r
+ result.levels.min_input = do_tween(time, source.levels.min_input, dest.levels.min_input, duration, tween); \r
+ result.levels.max_output = do_tween(time, source.levels.max_output, dest.levels.max_output, duration, tween);\r
+ result.levels.min_output = do_tween(time, source.levels.min_output, dest.levels.min_output, duration, tween);\r
+ result.levels.gamma = do_tween(time, source.levels.gamma, dest.levels.gamma, duration, tween);\r
+ result.field_mode = source.field_mode & dest.field_mode;\r
result.is_key = source.is_key | dest.is_key;\r
result.is_mix = source.is_mix | dest.is_mix;\r
\r
\r
#pragma once\r
\r
-#include <common/utility/tweener.h>\r
+#include <common/tweener.h>\r
#include <core/video_format.h>\r
\r
#include <boost/array.hpp>\r
\r
frame_transform& frame_transform::operator*=(const frame_transform &other);\r
frame_transform frame_transform::operator*(const frame_transform &other) const;\r
-};\r
\r
-frame_transform tween(double time, const frame_transform& source, const frame_transform& dest, double duration, const tweener_t& tweener);\r
+ static frame_transform tween(double time, const frame_transform& source, const frame_transform& dest, double duration, const tweener& tween);\r
+};\r
\r
bool operator<(const frame_transform& lhs, const frame_transform& rhs);\r
bool operator==(const frame_transform& lhs, const frame_transform& rhs);\r
bool operator!=(const frame_transform& lhs, const frame_transform& rhs);\r
\r
+class tweened_transform\r
+{\r
+ frame_transform source_;\r
+ frame_transform dest_;\r
+ int duration_;\r
+ int time_;\r
+ tweener tweener_;\r
+public: \r
+ tweened_transform()\r
+ : duration_(0)\r
+ , time_(0)\r
+ {\r
+ }\r
+\r
+ tweened_transform(const frame_transform& source, const frame_transform& dest, int duration, const tweener& tween)\r
+ : source_(source)\r
+ , dest_(dest)\r
+ , duration_(duration)\r
+ , time_(0)\r
+ , tweener_(tween)\r
+ {\r
+ }\r
+ \r
+ frame_transform fetch()\r
+ {\r
+ return time_ == duration_ ? dest_ : frame_transform::tween(static_cast<double>(time_), source_, dest_, static_cast<double>(duration_), tweener_);\r
+ }\r
+\r
+ frame_transform fetch_and_tick(int num)\r
+ { \r
+ time_ = std::min(time_+num, duration_);\r
+ return fetch();\r
+ }\r
+};\r
+\r
}}
\ No newline at end of file
\r
#include "shader.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/assert.h>\r
#include <common/gl/gl_check.h>\r
\r
#include "device_buffer.h"\r
#include "accelerator.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/gl/gl_check.h>\r
\r
#include <gl/glew.h>\r
#include "device_buffer.h"\r
#include "accelerator.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/gl/gl_check.h>\r
\r
#include <gl/glew.h>\r
#include "../device_buffer.h"\r
#include "../accelerator.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/gl/gl_check.h>\r
#include <common/env.h>\r
\r
#include "host_buffer.h"\r
#include "device_buffer.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <core/frame/frame_visitor.h>\r
#include <core/frame/pixel_format.h>\r
\r
#include <common/env.h>\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/gl/gl_check.h>\r
-#include <common/utility/tweener.h>\r
\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
#include <core/mixer/gpu/write_frame.h>\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
#include <boost/algorithm/string.hpp>\r
\r
\r
#include <common/memory/safe_ptr.h>\r
#include <common/concurrency/executor.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/utility/move_on_copy.h>\r
\r
namespace caspar { namespace core {\r
return core::draw_frame::empty();\r
}\r
}\r
-\r
- boost::unique_future<std::wstring> call(bool foreground, const std::wstring& param)\r
- {\r
- return (foreground ? foreground_ : background_)->call(param);\r
- }\r
-\r
+ \r
bool empty() const\r
{\r
return background_ == core::frame_producer::empty() && foreground_ == core::frame_producer::empty();\r
safe_ptr<frame_producer> layer::foreground() const { return impl_->foreground_;}\r
safe_ptr<frame_producer> layer::background() const { return impl_->background_;}\r
bool layer::empty() const {return impl_->empty();}\r
-boost::unique_future<std::wstring> layer::call(bool foreground, const std::wstring& param){return impl_->call(foreground, param);}\r
boost::property_tree::wptree layer::info() const{return impl_->info();}\r
}}
\ No newline at end of file
\r
namespace caspar { namespace core {\r
\r
-template<typename T>\r
-class tweened_transform\r
-{\r
- T source_;\r
- T dest_;\r
- int duration_;\r
- int time_;\r
- tweener_t tweener_;\r
-public: \r
- tweened_transform()\r
- : duration_(0)\r
- , time_(0)\r
- , tweener_(get_tweener(L"linear")){}\r
- tweened_transform(const T& source, const T& dest, int duration, const std::wstring& tween = L"linear")\r
- : source_(source)\r
- , dest_(dest)\r
- , duration_(duration)\r
- , time_(0)\r
- , tweener_(get_tweener(tween)){}\r
- \r
- T fetch()\r
- {\r
- return time_ == duration_ ? dest_ : tween(static_cast<double>(time_), source_, dest_, static_cast<double>(duration_), tweener_);\r
- }\r
-\r
- T fetch_and_tick(int num)\r
- { \r
- time_ = std::min(time_+num, duration_);\r
- return fetch();\r
- }\r
-};\r
-\r
struct stage::impl : public std::enable_shared_from_this<impl>\r
- , boost::noncopyable\r
{ \r
- std::map<int, layer> layers_; \r
- std::map<int, tweened_transform<core::frame_transform>> transforms_; \r
-\r
- executor executor_;\r
+ std::map<int, layer> layers_; \r
+ std::map<int, tweened_transform> transforms_; \r
+ executor executor_;\r
public:\r
- impl() \r
- : executor_(L"stage")\r
+ impl() : executor_(L"stage")\r
{\r
}\r
\r
{ \r
return executor_.invoke([=]() -> std::map<int, safe_ptr<draw_frame>>\r
{\r
- std::map<int, safe_ptr<class draw_frame>> result;\r
+ std::map<int, safe_ptr<class draw_frame>> frames;\r
\r
try\r
{ \r
BOOST_FOREACH(auto& layer, layers_) \r
- result[layer.first] = draw_frame::empty(); \r
+ frames[layer.first] = draw_frame::empty(); \r
\r
auto format_desc2 = format_desc;\r
\r
frame1 = core::draw_frame::interlace(frame1, frame2, format_desc2.field_mode);\r
}\r
\r
- result[layer.first] = frame1;\r
+ frames[layer.first] = frame1;\r
}); \r
}\r
catch(...)\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
} \r
\r
- return result;\r
+ return frames;\r
});\r
}\r
\r
- void apply_transforms(const std::vector<std::tuple<int, stage::transform_func_t, unsigned int, std::wstring>>& transforms)\r
+ void apply_transforms(const std::vector<std::tuple<int, stage::transform_func_t, unsigned int, tweener>>& transforms)\r
{\r
executor_.begin_invoke([=]\r
{\r
{\r
auto src = transforms_[std::get<0>(transform)].fetch();\r
auto dst = std::get<1>(transform)(src);\r
- transforms_[std::get<0>(transform)] = tweened_transform<frame_transform>(src, dst, std::get<2>(transform), std::get<3>(transform));\r
+ transforms_[std::get<0>(transform)] = tweened_transform(src, dst, std::get<2>(transform), std::get<3>(transform));\r
}\r
}, high_priority);\r
}\r
\r
- void apply_transform(int index, const stage::transform_func_t& transform, unsigned int mix_duration, const std::wstring& tween)\r
+ void apply_transform(int index, const stage::transform_func_t& transform, unsigned int mix_duration, const tweener& tween)\r
{\r
executor_.begin_invoke([=]\r
{\r
auto src = transforms_[index].fetch();\r
auto dst = transform(src);\r
- transforms_[index] = tweened_transform<frame_transform>(src, dst, mix_duration, tween);\r
+ transforms_[index] = tweened_transform(src, dst, mix_duration, tween);\r
}, high_priority);\r
}\r
\r
layers_.clear();\r
}, high_priority);\r
} \r
- \r
- boost::unique_future<std::wstring> call(int index, bool foreground, const std::wstring& param)\r
- {\r
- return std::move(*executor_.invoke([=]\r
- {\r
- return std::make_shared<boost::unique_future<std::wstring>>(std::move(layers_[index].call(foreground, param)));\r
- }, high_priority));\r
- }\r
- \r
+ \r
void swap_layers(const safe_ptr<stage>& other)\r
{\r
if(other->impl_.get() == this)\r
\r
stage::stage() : impl_(new impl()){}\r
void stage::apply_transforms(const std::vector<stage::transform_tuple_t>& transforms){impl_->apply_transforms(transforms);}\r
-void stage::apply_transform(int index, const std::function<core::frame_transform(core::frame_transform)>& transform, unsigned int mix_duration, const std::wstring& tween){impl_->apply_transform(index, transform, mix_duration, tween);}\r
+void stage::apply_transform(int index, const std::function<core::frame_transform(core::frame_transform)>& transform, unsigned int mix_duration, const tweener& tween){impl_->apply_transform(index, transform, mix_duration, tween);}\r
void stage::clear_transforms(int index){impl_->clear_transforms(index);}\r
void stage::clear_transforms(){impl_->clear_transforms();}\r
void stage::load(int index, const safe_ptr<frame_producer>& producer, bool preview, int auto_play_delta){impl_->load(index, producer, preview, auto_play_delta);}\r
void stage::swap_layer(int index, int other_index, const safe_ptr<stage>& other){impl_->swap_layer(index, other_index, other);}\r
boost::unique_future<safe_ptr<frame_producer>> stage::foreground(int index) {return impl_->foreground(index);}\r
boost::unique_future<safe_ptr<frame_producer>> stage::background(int index) {return impl_->background(index);}\r
-boost::unique_future<std::wstring> stage::call(int index, bool foreground, const std::wstring& param){return impl_->call(index, foreground, param);}\r
boost::unique_future<boost::property_tree::wptree> stage::info() const{return impl_->info();}\r
boost::unique_future<boost::property_tree::wptree> stage::info(int index) const{return impl_->info(index);}\r
std::map<int, safe_ptr<class draw_frame>> stage::operator()(const video_format_desc& format_desc){return (*impl_)(format_desc);}\r
\r
#include <common/forward.h>\r
#include <common/memory/safe_ptr.h>\r
+#include <common/tweener.h>\r
\r
-#include <boost/noncopyable.hpp>\r
#include <boost/property_tree/ptree_fwd.hpp>\r
\r
#include <functional>\r
\r
namespace caspar { namespace core {\r
\r
-class stage sealed : boost::noncopyable\r
+class stage sealed\r
{\r
+ stage(const stage&);\r
+ stage& operator=(const stage&);\r
public: \r
typedef std::function<struct frame_transform(struct frame_transform)> transform_func_t;\r
- typedef std::tuple<int, transform_func_t, unsigned int, std::wstring> transform_tuple_t;\r
+ typedef std::tuple<int, transform_func_t, unsigned int, tweener> transform_tuple_t;\r
\r
stage();\r
\r
std::map<int, safe_ptr<class draw_frame>> operator()(const struct video_format_desc& format_desc);\r
\r
void apply_transforms(const std::vector<transform_tuple_t>& transforms);\r
- void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+ void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const tweener& tween = L"linear");\r
void clear_transforms(int index);\r
void clear_transforms();\r
\r
void swap_layer(int index, int other_index);\r
void swap_layer(int index, int other_index, const safe_ptr<stage>& other);\r
\r
- boost::unique_future<std::wstring> call(int index, bool foreground, const std::wstring& param);\r
boost::unique_future<safe_ptr<struct frame_producer>> foreground(int index);\r
boost::unique_future<safe_ptr<struct frame_producer>> background(int index);\r
\r
boost::unique_future<boost::property_tree::wptree> info() const;\r
- boost::unique_future<boost::property_tree::wptree> info(int layer) const;\r
+ boost::unique_future<boost::property_tree::wptree> info(int index) const;\r
\r
private:\r
struct impl;\r
\r
#include "../../video_format.h"\r
\r
-#include <common/memory/safe_ptr.h>\r
#include <common/enum_class.h>\r
-#include <common/utility/tweener.h>\r
+#include <common/memory/safe_ptr.h>\r
+#include <common/tweener.h>\r
\r
#include <string>\r
\r
: type(transition_type::cut)\r
, duration(0)\r
, direction(transition_direction::from_left)\r
- , tweener(get_tweener(L"linear")){}\r
+ , tweener(L"linear"){}\r
\r
size_t duration;\r
transition_direction direction;\r
transition_type type;\r
- tweener_t tweener;\r
+ tweener tweener;\r
};\r
\r
safe_ptr<struct frame_producer> create_transition_producer(const field_mode& mode, const safe_ptr<struct frame_producer>& destination, const transition_info& info);\r
auto mixer_info = mixer_->info();\r
auto output_info = output_->info();\r
\r
- stage_info.timed_wait(boost::posix_time::seconds(2));\r
- mixer_info.timed_wait(boost::posix_time::seconds(2));\r
- output_info.timed_wait(boost::posix_time::seconds(2));\r
- \r
info.add(L"video-mode", format_desc_.name);\r
info.add_child(L"stage", stage_info.get());\r
info.add_child(L"mixer", mixer_info.get());\r
#include <common/reactive.h>\r
#include <common/forward.h>\r
\r
-#include <boost/noncopyable.hpp>\r
#include <boost/property_tree/ptree_fwd.hpp>\r
\r
FORWARD3(caspar, core, gpu, class accelerator);\r
namespace caspar { namespace core {\r
\r
class video_channel sealed : public reactive::observable<safe_ptr<const struct data_frame>>\r
- , boost::noncopyable\r
{\r
+ video_channel(const video_channel&);\r
+ video_channel& operator=(const video_channel&);\r
public:\r
explicit video_channel(int index, const struct video_format_desc& format_desc, const safe_ptr<gpu::accelerator>& ogl);\r
\r
//#include "../common/concurrency/executor.h" // Can't include this due to MSVC lambda bug\r
\r
#include <common/log.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
#include <assert.h>\r
#include <BlueHancUtils.h>\r
\r
#include <common/memory/safe_ptr.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
namespace caspar { \r
\r
\r
#include "../common/memory/safe_ptr.h"\r
#include "../common/utf.h"\r
-#include "../common/exception/exceptions.h"\r
-#include "../common/exception/win32_exception.h"\r
+#include "../common/except.h"\r
#include "../common/log.h"\r
#include <common/concurrency/executor.h>\r
#include <common/concurrency/lock.h>\r
#include <common/diagnostics/graph.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/memory/memshfl.h>\r
\r
#include <core/consumer/frame_consumer.h>\r
\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/log.h>\r
#include <common/utility/param.h>\r
\r
\r
#pragma once\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/log.h>\r
#include <core/video_format.h>\r
\r
\r
#pragma once\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
#include <string>\r
\r
\r
#include "audio_resampler.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/log.h>\r
\r
#if defined(_MSC_VER)\r
\r
#include "../../ffmpeg_error.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
#include <boost/assign.hpp>\r
#include <boost/range/iterator_range.hpp>\r
\r
#include <common/diagnostics/graph.h>\r
#include <common/concurrency/executor.h>\r
-#include <common/exception/exceptions.h>\r
-#include <common/exception/win32_exception.h>\r
+#include <common/except.h>\r
#include <common/log.h>\r
\r
#include <core/video_format.h>\r
#include <core/mixer/gpu/write_frame.h>\r
\r
#include <common/env.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/log.h>\r
\r
#if defined(_MSC_VER)\r
\r
#include "flv.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/log.h>\r
\r
#include <boost/filesystem.hpp>\r
#include <core/producer/frame_producer.h>\r
#include <core/mixer/gpu/write_frame.h>\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
#include <tbb/parallel_for.h>\r
\r
//#include "../common/concurrency/executor.h" // Can't include this due to MSVC lambda bug\r
\r
#include "../common/log.h"\r
-#include "../common/exception/exceptions.h"\r
-#include "../common/exception/win32_exception.h"\r
+#include "../common/except.h"\r
\r
#include "../StdAfx.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
#include <zlib.h> // Compiled into FreeImage\r
\r
\r
#include "image_consumer.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/env.h>\r
#include <common/log.h>\r
#include <common/utf.h>\r
\r
#include <common/env.h>\r
#include <common/log.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
\r
#include <boost/assign.hpp>\r
#include <boost/filesystem.hpp>\r
\r
#include "image_loader.h"\r
\r
-#include <common/exception/Exceptions.h>\r
+#include <common/except.h>\r
#include <common/utf.h>\r
\r
#if defined(_MSC_VER)\r
\r
#include "oal_consumer.h"\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/diagnostics/graph.h>\r
#include <common/log.h>\r
#include <common/utf.h>\r
#include <core/mixer/gpu/write_frame.h>\r
#include <core/frame/data_frame.h>\r
\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/diagnostics/graph.h>\r
#include <common/log.h>\r
#include <common/reactive.h>\r
//#include "../common/concurrency/executor.h" // Can't include this due to MSVC lambda bug\r
\r
#include "../common/log.h"\r
-#include "../common/exception/exceptions.h"\r
-#include "../common/exception/win32_exception.h"\r
+#include "../common/except.h"\r
\r
#include <assert.h>
\ No newline at end of file
std::wstring param;\r
for(auto it = std::begin(_parameters2)+1; it != std::end(_parameters2); ++it, param += L" ")\r
param += *it;\r
- result = GetChannel()->stage()->call(GetLayerIndex(), what == L"F", boost::trim_copy(param));\r
+ result = (what == L"F" ? GetChannel()->stage()->foreground(GetLayerIndex()) : GetChannel()->stage()->background(GetLayerIndex())).get()->call(boost::trim_copy(param));\r
}\r
else\r
{\r
std::wstring param;\r
for(auto it = std::begin(_parameters2); it != std::end(_parameters2); ++it, param += L" ")\r
param += *it;\r
- result = GetChannel()->stage()->call(GetLayerIndex(), true, boost::trim_copy(param));\r
+ result = GetChannel()->stage()->foreground(GetLayerIndex()).get()->call(boost::trim_copy(param));\r
}\r
\r
if(!result.timed_wait(boost::posix_time::seconds(2)))\r
transitionInfo.duration = boost::lexical_cast<size_t>(what["DURATION"].str());\r
auto direction = what["DIRECTION"].matched ? what["DIRECTION"].str() : L"";\r
auto tween = what["TWEEN"].matched ? what["TWEEN"].str() : L"";\r
- transitionInfo.tweener = get_tweener(tween); \r
+ transitionInfo.tweener = tween; \r
\r
if(transition == TEXT("CUT"))\r
transitionInfo.type = transition_type::cut;\r
#include "../StdAfx.h"\r
\r
#include "thread.h"\r
-#include <common/exception/win32_exception.h>\r
+#include <common/except.h>\r
\r
namespace caspar {\r
\r
#include <modules/image/image.h>\r
\r
#include <common/env.h>\r
-#include <common/exception/win32_exception.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
+#include <common/except.h>\r
#include <common/log.h>\r
#include <common/gl/gl_check.h>\r
#include <common/os/windows/current_version.h>\r
#include "server.h"\r
\r
#include <common/env.h>\r
-#include <common/exception/exceptions.h>\r
+#include <common/except.h>\r
#include <common/utf.h>\r
\r
#include <core/mixer/gpu/accelerator.h>\r