set(GLEW_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/glew/include")
set(SFML_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/sfml/include")
set(FREETYPE_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/freetype/include")
-set(FFMPEG_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/ffmpeg/include")
+
+if (MSVC)
+ set(FFMPEG_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/ffmpeg/include" "${DEPENDENCIES_FOLDER}/ffmpeg/include-win32")
+else ()
+ set(FFMPEG_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/ffmpeg/include")
+endif ()
+
set(ASMLIB_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/asmlib")
set(FREEIMAGE_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/freeimage/include")
set(OPENAL_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/openal/include")
add_definitions( -DUNICODE )
add_definitions( -D_UNICODE )
-if (${MSVC})
+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_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")
elseif (CMAKE_COMPILER_IS_GNUCXX)
add_compile_options( -std=c++11 )
+ add_compile_options( -msse3 )
+ add_compile_options( -mssse3 )
+ add_compile_options( -msse4.1 )
endif ()
-#cmake_policy(SET CMP0045 OLD)
+cmake_policy(SET CMP0045 OLD)
include(CMake/PrecompiledHeader.cmake)
add_subdirectory(accelerator)
add_subdirectory(modules)
add_subdirectory(protocol)
add_subdirectory(shell)
+
cmake_minimum_required (VERSION 2.6)
project (accelerator)
+if (MSVC)
+ set(OS_SPECIFIC_SOURCES
+ cpu/image/image_mixer.cpp
+ cpu/image/image_mixer.h
+
+ cpu/util/xmm.h
+ )
+elseif (CMAKE_COMPILER_IS_GNUCXX)
+endif ()
set(SOURCES
- cpu/image/image_mixer.cpp
ogl/image/image_kernel.cpp
ogl/image/image_mixer.cpp
StdAfx.cpp
)
set(HEADERS
- cpu/image/image_mixer.h
-
- cpu/util/xmm.h
-
ogl/image/blending_glsl.h
ogl/image/image_kernel.h
ogl/image/image_mixer.h
StdAfx.h
)
-add_library(accelerator ${SOURCES} ${HEADERS})
+add_library(accelerator ${SOURCES} ${HEADERS} ${OS_SPECIFIC_SOURCES})
add_precompiled_header(accelerator StdAfx.h FORCEINCLUDE)
include_directories(..)
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "stdafx.h"
\ No newline at end of file
+#include "StdAfx.h"
-#include "stdafx.h"
+#include "StdAfx.h"
#include "accelerator.h"
+#ifdef _MSC_VER
#include "cpu/image/image_mixer.h"
+#endif
#include "ogl/image/image_mixer.h"
#include "ogl/util/device.h"
if(path_ == L"gpu" || path_ == L"ogl")
CASPAR_LOG_CURRENT_EXCEPTION();
}
-
+#ifdef _MSC_VER
return std::unique_ptr<core::image_mixer>(new cpu::image_mixer());
+#else
+ CASPAR_THROW_EXCEPTION(not_supported());
+#endif
}
};
return impl_->create_image_mixer();
}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "image_mixer.h"
#include <asmlib.h>
-#include <gl/glew.h>
+#include <GL/glew.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_for_each.h>
#include <cstdint>
#include <vector>
#include <set>
+#include <array>
#if defined(_MSC_VER)
#pragma warning (push)
{
using namespace xmm;
- if(reinterpret_cast<int>(dest) % 16 != 0 || reinterpret_cast<int>(source) % 16 != 0)
+ if(reinterpret_cast<long>(dest) % 16 != 0 || reinterpret_cast<long>(source) % 16 != 0)
kernel<temporal_tag, unaligned_tag>(dest, source, count);
else
kernel<temporal_tag, aligned_tag>(dest, source, count);
{
if(source_items[n].data == data)
{
- dest_items[n].data.assign(0);
+ dest_items[n].data.fill(0);
dest_items[n].data[0] = dest_frame->data();
dest_items[n].pix_desc = core::pixel_format_desc(core::pixel_format::bgra);
dest_items[n].pix_desc.planes = { core::pixel_format_desc::plane(width, height, 4) };
return renderer_(std::move(items_), format_desc);
}
- virtual core::mutable_frame create_frame(const void* tag, const core::pixel_format_desc& desc)
+ core::mutable_frame create_frame(const void* tag, const core::pixel_format_desc& desc)
{
std::vector<array<std::uint8_t>> buffers;
for (auto& plane : desc.planes)
void image_mixer::end_layer(){impl_->end_layer();}
core::mutable_frame image_mixer::create_frame(const void* tag, const core::pixel_format_desc& desc) {return impl_->create_frame(tag, desc);}
-}}}
\ No newline at end of file
+}}}
#pragma once
+#ifdef WIN32
#include <intrin.h>
+#else
+#include <smmintrin.h>
+#endif
+
#include <type_traits>
namespace caspar { namespace accelerator { namespace cpu { namespace xmm {
// return xmm_cast_impl<T>()(other);
//}
-}}}}
\ No newline at end of file
+}}}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "image_kernel.h"
void image_kernel::draw(const draw_params& params){impl_->draw(params);}
bool image_kernel::has_blend_modes() const{return impl_->blend_modes_;}
-}}}
\ No newline at end of file
+}}}
core::image_transform transform;
core::frame_geometry geometry;
core::blend_mode blend_mode = core::blend_mode::normal;
- keyer keyer = keyer::linear;
+ ogl::keyer keyer = ogl::keyer::linear;
std::shared_ptr<class texture> background;
std::shared_ptr<class texture> local_key;
std::shared_ptr<class texture> layer_key;
spl::unique_ptr<impl> impl_;
};
-}}}
\ No newline at end of file
+}}}
*
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "image_mixer.h"
#include <asmlib.h>
-#include <gl/glew.h>
+#include <GL/glew.h>
#include <boost/range/algorithm_ext/erase.hpp>
#include <boost/thread/future.hpp>
std::size_t get_max_video_format_size()
{
+ auto format_size = [](core::video_format format) { return core::video_format_desc(format).size; };
return cpplinq::from(enum_constants<core::video_format>())
- .select([](core::video_format format) { return core::video_format_desc(format).size; })
+ .select(std::ref(format_size))
.max();
}
void image_mixer::end_layer(){impl_->end_layer();}
core::mutable_frame image_mixer::create_frame(const void* tag, const core::pixel_format_desc& desc) {return impl_->create_frame(tag, desc);}
-}}}
\ No newline at end of file
+}}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "image_shader.h"
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "buffer.h"
#include <common/except.h>
#include <common/gl/gl_check.h>
-#include <gl/glew.h>
+#include <GL/glew.h>
#include <tbb/atomic.h>
GL(glGenBuffers(1, &pbo_));
bind();
GL(glBufferData(target_, size_, NULL, usage_));
- if(usage_ == GL_STREAM_DRAW)
- data_ = (uint8_t*)GL2(glMapBuffer(target_, usage_ == GL_STREAM_DRAW ? GL_WRITE_ONLY : GL_READ_ONLY));
+ if(usage_ == GL_STREAM_DRAW)
+ {
+ auto result = GL2(glMapBuffer(target_, usage_ == GL_STREAM_DRAW ? GL_WRITE_ONLY : GL_READ_ONLY));
+ data_ = reinterpret_cast<uint8_t*>(result);
+ }
unbind();
if(!pbo_)
if(usage_ == GL_STREAM_DRAW)
GL(glBufferData(target_, size_, NULL, usage_)); // Notify OpenGL that we don't care about previous data.
- data_ = (uint8_t*)GL2(glMapBuffer(target_, usage_ == GL_STREAM_DRAW ? GL_WRITE_ONLY : GL_READ_ONLY));
+ auto result = GL2(glMapBuffer(target_, usage_ == GL_STREAM_DRAW ? GL_WRITE_ONLY : GL_READ_ONLY));
+ data_ = (uint8_t*) result;
if(timer.elapsed() > 0.02)
CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer mapping blocked: " << timer.elapsed();
std::size_t buffer::size() const { return impl_->size_; }
int buffer::id() const {return impl_->pbo_;}
-}}}
\ No newline at end of file
+}}}
// TODO: Smart GC
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "device.h"
#include <common/except.h>
#include <common/future.h>
#include <common/array.h>
+#include <common/memory.h>
#include <common/gl/gl_check.h>
-#include <common/os/windows/windows.h>
+//#include <common/os/windows/windows.h>
-#include <gl/glew.h>
+#include <GL/glew.h>
#include <SFML/Window/Context.hpp>
{
std::shared_ptr<buffer> buf;
- auto tmp = source.storage<spl::shared_ptr<buffer>>();
+ auto tmp = source.template storage<spl::shared_ptr<buffer>>();
if(tmp)
buf = *tmp;
else
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "shader.h"
#include <common/gl/gl_check.h>
-#include <gl/glew.h>
+#include <GL/glew.h>
#include <unordered_map>
int shader::id() const{return impl_->program_;}
void shader::use()const{impl_->use();}
-}}}
\ No newline at end of file
+}}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "texture.h"
#include <common/except.h>
#include <common/gl/gl_check.h>
-#include <gl/glew.h>
+#include <GL/glew.h>
#include <tbb/atomic.h>
std::size_t texture::size() const { return static_cast<std::size_t>(impl_->width_*impl_->height_*impl_->stride_); }
int texture::id() const{ return impl_->id_;}
-}}}
\ No newline at end of file
+}}}
os/windows/current_version.h
os/windows/page_locked_allocator.cpp
os/windows/prec_timer.cpp
+ os/windows/scheduling.cpp
os/windows/stack_trace.cpp
os/windows/system_info.cpp
os/windows/win32_exception.cpp
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(OS_SPECIFIC_SOURCES
os/linux/signal_handlers.cpp
+ os/linux/scheduling.cpp
os/linux/stack_trace.cpp
os/linux/system_info.cpp
)
os/general_protection_fault.h
os/page_locked_allocator.h
+ os/scheduling.h
os/stack_trace.h
os/system_info.h
// Constructors
- template<typename T>
- explicit array(std::uint8_t* ptr, std::size_t size, bool cacheable, T&& storage)
+ template<typename T2>
+ explicit array(std::uint8_t* ptr, std::size_t size, bool cacheable, T2&& storage)
: ptr_(ptr)
, size_(size)
, cacheable_(cacheable)
- , storage_(new boost::any(std::forward<T>(storage)))
+ , storage_(new boost::any(std::forward<T2>(storage)))
{
}
bool empty() const {return size() == 0;}
bool cacheable() const {return cacheable_;}
- template<typename T>
- T* storage() const
+ template<typename T2>
+ T2* storage() const
{
- return boost::any_cast<T>(storage_.get());
+ return boost::any_cast<T2>(storage_.get());
}
private:
T* ptr_;
// Constructors
array() = default; // Needed by std::future
- template<typename T>
- explicit array(const std::uint8_t* ptr, std::size_t size, bool cacheable, T&& storage)
+ template<typename T2>
+ explicit array(const std::uint8_t* ptr, std::size_t size, bool cacheable, T2&& storage)
: ptr_(ptr)
, size_(size)
, cacheable_(cacheable)
- , storage_(new boost::any(std::forward<T>(storage)))
+ , storage_(new boost::any(std::forward<T2>(storage)))
{
}
bool empty() const {return size() == 0;}
bool cacheable() const {return cacheable_;}
- template<typename T>
- T* storage() const
+ template<typename T2>
+ T2* storage() const
{
- return boost::any_cast<T>(storage_.get());
+ return boost::any_cast<T2>(storage_.get());
}
private:
- const T* ptr_;
- std::size_t size_;
- bool cacheable_;
+ const T* ptr_ = nullptr;
+ std::size_t size_ = 0;
+ bool cacheable_ = false;
std::shared_ptr<boost::any> storage_;
};
#pragma once
#include <type_traits>
+#include <cstdint>
+#ifdef _MSC_VER
#include <intrin.h>
+#endif
namespace caspar {
template<typename T>
-typename std::enable_if<sizeof(T) == sizeof(unsigned char), T>::type swap_byte_order(
+typename std::enable_if<sizeof(T) == sizeof(std::uint8_t), T>::type swap_byte_order(
const T& value)
{
return value;
}
-template<typename T>
-typename std::enable_if<sizeof(T) == sizeof(unsigned short), T>::type swap_byte_order(
+/*template<typename T>
+typename std::enable_if<sizeof(T) == sizeof(std::uint16_t), T>::type swap_byte_order(
const T& value)
{
+#ifdef _MSC_VER
auto swapped = _byteswap_ushort(reinterpret_cast<const unsigned short&>(value));
+#elif __GNUC__
+ auto swapped = __builtin_bswap32(value);
+#endif
+
return reinterpret_cast<const T&>(swapped);
-}
+}*/
template<typename T>
-typename std::enable_if<sizeof(T) == sizeof(unsigned long), T>::type swap_byte_order(
+typename std::enable_if<sizeof(T) == sizeof(std::uint32_t), T>::type swap_byte_order(
const T& value)
{
+#ifdef _MSC_VER
auto swapped = _byteswap_ulong(reinterpret_cast<const unsigned long&>(value));
- return reinterpret_cast<const T&>(swapped);
+#elif __GNUC__
+ auto swapped = __builtin_bswap32(value);
+#endif
+
+ return reinterpret_cast<const T&>(swapped);
}
template<typename T>
-typename std::enable_if<sizeof(T) == sizeof(unsigned long long), T>::type swap_byte_order(
+typename std::enable_if<sizeof(T) == sizeof(std::uint64_t), T>::type swap_byte_order(
const T& value)
{
+#ifdef _MSC_VER
auto swapped = _byteswap_uint64(reinterpret_cast<const unsigned long long&>(value));
- return reinterpret_cast<const T&>(swapped);
+#elif __GNUC__
+ auto swapped = __builtin_bswap64(value);
+#endif
+
+ return reinterpret_cast<const T&>(swapped);
}
}
caspar::gl::SMFL_GLCheckError(CASPAR_GL_EXPR_STR(expr), __FILE__, __LINE__);\
}
+// TODO: decltype version does not play well with gcc
#define GL2(expr) \
- [&]() -> decltype(expr)\
+ [&]()\
{\
- auto ret = (expr); \
+ auto ret = (expr);\
caspar::gl::SMFL_GLCheckError(CASPAR_GL_EXPR_STR(expr), __FILE__, __LINE__);\
return ret;\
}()
+/*#define GL2(expr) \
+ [&]() -> decltype(expr) \
+ { \
+ auto ret = (expr); \
+ caspar::gl::SMFL_GLCheckError(CASPAR_GL_EXPR_STR(expr), __FILE__, __LINE__); \
+ return ret; \
+ }()*/
+//#define GL2(expr) [&]() -> decltype(expr) { auto ret = (expr); caspar::gl::SMFL_GLCheckError(CASPAR_GL_EXPR_STR(expr), __FILE__, __LINE__); return ret; }()
//#else
//#define GL(expr) expr
//#endif
-}}
\ No newline at end of file
+}}
template<typename T, typename F>
auto lock(T& mutex, F&& func) -> decltype(func())
{
- T::scoped_lock lock(mutex);
+ typename T::scoped_lock lock(mutex);
return func();
}
-}
\ No newline at end of file
+}
#pragma once
+#ifdef _MSC_VER
#include <intrin.h>
+#else
+#include <tmmintrin.h>
+#endif
namespace caspar {
}
-}
\ No newline at end of file
+}
--- /dev/null
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@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 "../scheduling.h"
+
+namespace caspar {
+
+void set_priority_of_current_thread(thread_priority priority)
+{
+ // TODO: implement
+}
+
+}
--- /dev/null
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@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
+*/
+
+#pragma once
+
+namespace caspar {
+
+enum class thread_priority
+{
+ LOW
+};
+
+void set_priority_of_current_thread(thread_priority priority);
+
+}
--- /dev/null
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@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 "../scheduling.h"
+
+#include "windows.h"
+
+namespace caspar {
+
+void set_priority_of_current_thread(thread_priority priority)
+{
+ if (priority == thread_priority::LOW)
+ SetThreadPriority(GetCurrentThread(), BELOW_NORMAL_PRIORITY_CLASS);
+}
+
+}
if(++it == params.end())
throw std::out_of_range("");
- return boost::lexical_cast<std::decay<T>::type>(*it);
+ return boost::lexical_cast<typename std::decay<T>::type>(*it);
}
catch(...)
{
}
}
-}
\ No newline at end of file
+}
// Static Members
- typedef T value_type;
- typedef observer<T> observer;
- typedef std::weak_ptr<observer> observer_ptr;
+ typedef T value_type;
+ typedef reactive::observer<T> observer;
+ typedef std::weak_ptr<reactive::observer<T>> observer_ptr;
// Constructors
void swap(observer_function& other)
{
std::swap(func_, other.func_);
- std::swap(filter_, other.filter_);
}
void on_next(const T& e) override
spl::shared_ptr<observer_function<typename std::decay<typename detail::function_traits<F>::arg1_type>::type, F>>
make_observer(F func)
{
- return spl::make_shared<observer_function<std::decay<typename detail::function_traits<F>::arg1_type>::type, F>>(std::move(func));
+ return spl::make_shared<observer_function<typename std::decay<typename detail::function_traits<F>::arg1_type>::type, F>>(std::move(func));
}
template<typename T>
return s;
}
-}}
\ No newline at end of file
+}}
#pragma once
-//#include "os/windows/windows.h"
+#ifdef WIN32
+#include "os/windows/windows.h"
+#endif
#include <algorithm>
#include <vector>
-namespace caspar { namespace core {
+namespace caspar {
typedef std::function<double(double, double, double, double)> tweener_t;
params.push_back(boost::lexical_cast<double>(what["V1"].str()));
}
- auto tweens = get_tweens();
-
- auto it = tweens.find(name);
- if(it == tweens.end())
+ auto it = get_tweens().find(name);
+ if(it == get_tweens().end())
CASPAR_THROW_EXCEPTION(invalid_argument() << msg_info("Could not find tween.") << arg_value_info(name));
auto tween = it->second;
return func_(t, b, c, d);
}
-const std::vector<const std::wstring>& tweener::names()
+const std::vector<std::wstring>& tweener::names()
{
- static const auto names = cpplinq::from(get_tweens())
+ /*static const auto names = cpplinq::from(get_tweens())
.select(keys())
- .to_vector();
+ .to_vector();*/
+
+ static const auto result = []
+ {
+ std::vector<std::wstring> result;
- return names;
+ for (auto& tween : get_tweens())
+ result.push_back(tween.first);
+
+ return result;
+ }();
+ //static const std::vector<std::wstring> result;
+
+ return result;
}
-}}
+}
#include <functional>
#include <vector>
-namespace caspar { namespace core {
+namespace caspar {
/**
* A tweener can be used for creating any kind of (image position, image fade
* @return The possible tween function names. Some of them may also support
* additional parameters appended to the name.
*/
- static const std::vector<const std::wstring>& names();
+ static const std::vector<std::wstring>& names();
/**
* Calculate a tweened value given a timepoint within the total duration
std::function<double(double, double, double, double)> func_;
};
-}}
\ No newline at end of file
+}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "stdafx.h"
\ No newline at end of file
+#include "StdAfx.h"
namespace caspar { namespace core {
-std::vector<const consumer_factory_t> g_factories;
+std::vector<consumer_factory_t> g_factories;
void register_consumer_factory(const consumer_factory_t& factory)
{
class recover_consumer_proxy : public frame_consumer
{
std::shared_ptr<frame_consumer> consumer_;
- int channel_index_;
+ int channel_index_ = -1;
video_format_desc format_desc_;
public:
recover_consumer_proxy(spl::shared_ptr<frame_consumer>&& consumer)
return consumer;
}
-}}
\ No newline at end of file
+}}
remove(consumer->index());
}
- void video_format_desc(const core::video_format_desc& format_desc)
+ void set_video_format_desc(const core::video_format_desc& format_desc)
{
executor_.invoke([&]
{
{
boost::timer frame_timer;
- video_format_desc(format_desc);
+ set_video_format_desc(format_desc);
executor_.invoke([=]
{
std::future<boost::property_tree::wptree> output::info() const{return impl_->info();}
void output::operator()(const_frame frame, const video_format_desc& format_desc){(*impl_)(std::move(frame), format_desc);}
monitor::subject& output::monitor_output() {return *impl_->monitor_subject_;}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "osd_graph.h"
#include <common/lock.h>
#include <common/env.h>
#include <common/prec_timer.h>
+#include <common/os/scheduling.h>
#include <SFML/Graphics.hpp>
#include <tuple>
#include <memory>
-#include <Windows.h>
-
namespace caspar { namespace core { namespace diagnostics { namespace osd {
static const int PREFERRED_VERTICAL_GRAPHS = 8;
std::list<std::weak_ptr<drawable>> drawables_;
int64_t refresh_rate_millis_ = 16;
boost::timer display_time_;
- bool calculate_view_;
+ bool calculate_view_ = true;
int scroll_position_ = 0;
bool dragging_ = false;
- int last_mouse_y_;
+ int last_mouse_y_ = 0;
- executor executor_ = L"diagnostics";
+ executor executor_ { L"diagnostics" };
public:
static void register_drawable(const std::shared_ptr<drawable>& drawable)
context()
{
executor_.begin_invoke([=]
- {
- SetThreadPriority(GetCurrentThread(), BELOW_NORMAL_PRIORITY_CLASS);
+ {
+ set_priority_of_current_thread(thread_priority::LOW);
});
}
int64_t create_id()
{
- static std::atomic<int64_t> counter = 0;
+ static std::atomic<int64_t> counter { 0 };
return ++counter;
}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "draw_frame.h"
}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "frame.h"
#include <core/frame/pixel_format.h>
#include <core/frame/geometry.h>
+#include <cstdint>
+#include <vector>
+
#include <boost/lexical_cast.hpp>
#include <boost/thread/future.hpp>
struct const_frame::impl : boost::noncopyable
{
mutable std::vector<std::shared_future<array<const std::uint8_t>>> future_buffers_;
- int id_;
core::audio_buffer audio_data_;
const core::pixel_format_desc desc_;
const void* tag_;
impl(const void* tag)
: desc_(core::pixel_format::invalid)
, tag_(tag)
- , id_(0)
, geometry_(frame_geometry::get_default())
{
}
: audio_data_(std::move(audio_buffer))
, desc_(desc)
, tag_(tag)
- , id_(reinterpret_cast<int>(this))
, geometry_(frame_geometry::get_default())
{
if(desc.format != core::pixel_format::bgra)
: audio_data_(other.audio_data())
, desc_(other.pixel_format_desc())
, tag_(other.stream_tag())
- , id_(reinterpret_cast<int>(this))
, geometry_(other.geometry())
{
for(std::size_t n = 0; n < desc_.planes.size(); ++n)
const frame_geometry& const_frame::geometry() const { return impl_->geometry_; }
void const_frame::set_geometry(const frame_geometry& g) { impl_->geometry_ = g; }
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "frame_transform.h"
return !(lhs == rhs);
}
-}}
\ No newline at end of file
+}}
boost::array<double, 2> fill_scale = boost::array<double, 2> { { 1.0, 1.0 } };
boost::array<double, 2> clip_translation = boost::array<double, 2> { { 0.0, 0.0 } };
boost::array<double, 2> clip_scale = boost::array<double, 2> { { 1.0, 1.0 } };
- levels levels;
+ core::levels levels;
- field_mode field_mode = field_mode::progressive;
+ core::field_mode field_mode = core::field_mode::progressive;
bool is_key = false;
bool is_mix = false;
bool is_still = false;
public:
frame_transform();
- image_transform image_transform;
- audio_transform audio_transform;
+ core::image_transform image_transform;
+ core::audio_transform audio_transform;
//char padding[(sizeof(core::image_transform) + sizeof(core::audio_transform)) % 16];
}
};
-}}
\ No newline at end of file
+}}
*/
-#include "..\StdAfx.h"
+#include "../StdAfx.h"
#include "geometry.h"
return g;
}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "audio_mixer.h"
struct audio_item
{
- const void* tag;
+ const void* tag = nullptr;
audio_transform transform;
audio_buffer audio_data;
void audio_mixer::set_master_volume(float volume) { impl_->set_master_volume(volume); }
audio_buffer audio_mixer::operator()(const video_format_desc& format_desc){return impl_->mix(format_desc);}
-}}
\ No newline at end of file
+}}
#include <common/executor.h>
#include <common/diagnostics/graph.h>
#include <common/except.h>
-#include <common/gl/gl_check.h>
#include <common/future.h>
#include <core/frame/draw_frame.h>
std::unordered_map<int, blend_mode> blend_modes_;
- executor executor_ = L"mixer";
+ executor executor_ { L"mixer" };
public:
impl(spl::shared_ptr<diagnostics::graph> graph, spl::shared_ptr<image_mixer> image_mixer)
std::future<boost::property_tree::wptree> mixer::info() const{return impl_->info();}
const_frame mixer::operator()(std::map<int, draw_frame> frames, const struct video_format_desc& format_desc){return (*impl_)(std::move(frames), format_desc);}
mutable_frame mixer::create_frame(const void* tag, const core::pixel_format_desc& desc) {return impl_->image_mixer_->create_frame(tag, desc);}
-}}
\ No newline at end of file
+}}
#include <map>
#include <algorithm>
#include <type_traits>
+#include <stdexcept>
#include <boost/lexical_cast.hpp>
+#include <common/tweener.h>
+
namespace caspar { namespace core {
namespace detail {
auto self = shared_from_this();
if (dependency->depends_on(self))
- throw std::exception("Can't have circular dependencies between bindings");
+ throw std::runtime_error("Can't have circular dependencies between bindings");
dependency->on_change(self, [=] { evaluate(); });
dependencies_.push_back(dependency);
{
if (bound())
{
- throw std::exception("Bound value cannot be set");
+ throw std::runtime_error("Bound value cannot be set");
}
if (value == value_)
}
};
-template<typename T, typename T2>
+/*template<typename T, typename T2>
binding<T> add_tween(
const binding<T>& to_tween,
const binding<T2>& counter,
return tween(t - start_time, start_val, destination_val, dur);
}).as<T>())
.otherwise(destination_value);
-}
+}*/
template<typename T, typename T2>
binding<T> delay(
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "color_producer.h"
return create_color_frame(tag, frame_factory, value);
}
-}}
\ No newline at end of file
+}}
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "freehand_producer.h"
namespace caspar { namespace core {
-std::vector<const producer_factory_t> g_factories;
-std::vector<const producer_factory_t> g_thumbnail_factories;
+std::vector<producer_factory_t> g_factories;
+std::vector<producer_factory_t> g_thumbnail_factories;
void register_producer_factory(const producer_factory_t& factory)
{
return spl::make_shared<destroy_producer_proxy>(std::move(producer));
}
-spl::shared_ptr<core::frame_producer> do_create_producer(const spl::shared_ptr<frame_factory>& my_frame_factory, const video_format_desc& format_desc, const std::vector<std::wstring>& params, const std::vector<const producer_factory_t>& factories, bool throw_on_fail = false)
+spl::shared_ptr<core::frame_producer> do_create_producer(const spl::shared_ptr<frame_factory>& my_frame_factory, const video_format_desc& format_desc, const std::vector<std::wstring>& params, const std::vector<producer_factory_t>& factories, bool throw_on_fail = false)
{
if(params.empty())
CASPAR_THROW_EXCEPTION(invalid_argument() << arg_name_info("params") << arg_value_info(""));
return create_producer(factory, format_desc, tokens);
}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "layer.h"
monitor::subject& layer::monitor_output() {return *impl_->monitor_subject_;}
void layer::on_interaction(const interaction_event::ptr& event) { impl_->on_interaction(event); }
bool layer::collides(double x, double y) const { return impl_->collides(x, y); }
-}}
\ No newline at end of file
+}}
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "const_producer.h"
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "expression_parser.h"
return -require<double>(to_create_negative_of);
}
-boost::any not(const boost::any& to_create_not_of)
+boost::any not_(const boost::any& to_create_not_of)
{
return !require<bool>(to_create_not_of);
}
return require<bool>(l) == require<bool>(r);
}
-boost::any and(const boost::any& lhs, boost::any& rhs)
+boost::any and_(const boost::any& lhs, boost::any& rhs)
{
return require<bool>(lhs) && require<bool>(rhs);
}
-boost::any or(const boost::any& lhs, boost::any& rhs)
+boost::any or_(const boost::any& lhs, boost::any& rhs)
{
return require<bool>(lhs) || require<bool>(rhs);
}
}
else if (op_token.characters == L"!")
{
- tokens.at(i) = not(token_after);
+ tokens.at(i) = not_(token_after);
}
tokens.erase(tokens.begin() + index_after);
else if (op_token.characters == L"==")
token_before = equal(token_before, token_after);
else if (op_token.characters == L"!=")
- token_before = not(equal(token_before, token_after));
+ token_before = not_(equal(token_before, token_after));
else if (op_token.characters == L"&&")
- token_before = and(token_before, token_after);
+ token_before = and_(token_before, token_after);
else if (op_token.characters == L"||")
- token_before = or(token_before, token_after);
+ token_before = or_(token_before, token_after);
}
tokens.erase(tokens.begin() + i, tokens.begin() + i + 2);
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "hotswap_producer.h"
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include <common/future.h>
#include <boost/algorithm/string/split.hpp>
&& translated.second <= 1.0
&& layer.producer.get()->collides(translated.first, translated.second))
{
- return std::make_pair(transform, layer.producer.get().get());
+ return std::make_pair(transform, static_cast<interaction_sink*>(layer.producer.get().get()));
}
}
struct rect
{
- coord upper_left;
- binding<double> width;
- binding<double> height;
+ coord upper_left;
+ binding<double> width;
+ binding<double> height;
};
struct adjustments
struct layer
{
- binding<std::wstring> name;
- coord position;
- rect clipping;
- adjustments adjustments;
- binding<spl::shared_ptr<frame_producer>> producer;
- binding<bool> hidden;
- binding<bool> is_key;
+ binding<std::wstring> name;
+ scene::coord position;
+ scene::rect clipping;
+ scene::adjustments adjustments;
+ binding<spl::shared_ptr<frame_producer>> producer;
+ binding<bool> hidden;
+ binding<bool> is_key;
explicit layer(const std::wstring& name, const spl::shared_ptr<frame_producer>& producer);
};
struct keyframe
{
- std::function<void ()> on_start_animate;
- std::function<void (int64_t start_frame, int64_t current_frame)> on_animate_to;
- std::function<void ()> on_destination_frame;
- int64_t destination_frame;
+ std::function<void ()> on_start_animate;
+ std::function<void (int64_t start_frame, int64_t current_frame)> on_animate_to;
+ std::function<void ()> on_destination_frame;
+ int64_t destination_frame;
public:
keyframe(int64_t destination_frame)
: destination_frame(destination_frame)
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "xml_scene_producer.h"
#include "expression_parser.h"
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
return core::frame_producer::empty();
boost::property_tree::wptree root;
- std::wifstream file(filename);
+ boost::filesystem::wifstream file(filename);
boost::property_tree::read_xml(
file,
root,
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "separated_producer.h"
&& translated.second <= 1.0
&& layer.second.collides(translated.first, translated.second))
{
- return std::make_pair(transform, &layer.second);
+ return std::make_pair(transform, static_cast<interaction_sink*>(&layer.second));
}
}
* Author: Niklas P Andersson, niklas.p.andersson@svt.se
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "text_producer.h"
#include FT_FREETYPE_H
#include FT_GLYPH_H
-#include "utils\texture_atlas.h"
-#include "utils\texture_font.h"
+#include "utils/texture_atlas.h"
+#include "utils/texture_font.h"
class font_comparer {
const std::wstring& lhs;
if(fontname != nullptr)
{
std::string fontname_str(fontname);
- result.insert(std::pair<std::wstring, std::wstring>(std::wstring(fontname_str.begin(), fontname_str.end()), file.path().native()));
+ result.insert(std::make_pair(u16(fontname_str), u16(file.path().native())));
}
FT_Done_Face(face);
std::wstring font;
std::wstring font_file;
- float size = 0.0f;
- color<float> color;
- //int shadow_distance;
- //int shadow_size;
- //float shadow_spread;
- //color<float> shadow_color;
- int baseline_shift = 0;
- int tracking = 0;
+ float size = 0.0f;
+ text::color<float> color;
+ //int shadow_distance;
+ //int shadow_size;
+ //float shadow_spread;
+ //text::color<float> shadow_color;
+ int baseline_shift = 0;
+ int tracking = 0;
};
-}}}
\ No newline at end of file
+}}}
-#include "..\..\..\StdAfx.h"
+#include "../../../StdAfx.h"
#include "texture_atlas.h"
#include "texture_font.h"
#include <map>
+#include <memory>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
return range.last - range.first;
}
- void impl::load_glyphs(unicode_block block, const color<float>& col)
+ void load_glyphs(unicode_block block, const color<float>& col)
{
FT_Error err;
int flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL;
return unicode_range(0,0);
}
-}}}
\ No newline at end of file
+}}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "transition_producer.h"
int duration = 0;
transition_direction direction = transition_direction::from_left;
transition_type type = transition_type::cut;
- tweener tweener = { L"linear" };
+ caspar::tweener tweener { L"linear" };
};
spl::shared_ptr<class frame_producer> create_transition_producer(const field_mode& mode, const spl::shared_ptr<class frame_producer>& destination, const transition_info& info);
-}}
\ No newline at end of file
+}}
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "stdafx.h"
+#include "StdAfx.h"
#include "thumbnail_generator.h"
int current_sleep = sleep_millis;
if (current_sleep > 0)
- boost::this_thread::sleep(boost::posix_time::milliseconds(current_sleep));
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(current_sleep));
on_send(std::move(frame));
on_send = nullptr;
impl_->generate_all();
}
-}}
\ No newline at end of file
+}}
caspar::core::mixer mixer_;
caspar::core::stage stage_;
- executor executor_ = L"video_channel";
+ executor executor_ { L"video_channel" };
public:
impl(int index, const core::video_format_desc& format_desc, std::unique_ptr<image_mixer> image_mixer)
: monitor_subject_(spl::make_shared<monitor::subject>(
int video_channel::index() const { return impl_->index(); }
monitor::subject& video_channel::monitor_output(){ return *impl_->monitor_subject_; }
-}}
\ No newline at end of file
+}}
, fps(static_cast<double>(time_scale) / static_cast<double>(duration))
, time_scale(time_scale)
, duration(duration)
- , field_count(field_mode == field_mode::progressive ? 1 : 2)
+ , field_count(field_mode == core::field_mode::progressive ? 1 : 2)
, size(width*height*4)
, name(name)
, audio_sample_rate(48000)
video_format_desc::video_format_desc(video_format format)
: format(video_format::invalid)
- , field_mode(field_mode::empty)
+ , field_mode(core::field_mode::empty)
{
*this = format_descs.at(static_cast<int>(format));
}
video_format_desc::video_format_desc(const std::wstring& name)
: format(video_format::invalid)
- , field_mode(field_mode::empty)
+ , field_mode(core::field_mode::empty)
{
*this = video_format_desc(video_format::invalid);
for(auto it = std::begin(format_descs); it != std::end(format_descs)-1; ++it)
int height;
int square_width;
int square_height;
- field_mode field_mode; // progressive, interlaced upper field first, interlaced lower field first
+ core::field_mode field_mode; // progressive, interlaced upper field first, interlaced lower field first
double fps; // actual framerate = duration/time_scale, e.g. i50 = 25 fps, p50 = 50 fps
int time_scale;
int duration;
std::wostream& operator<<(std::wostream& out, const video_format_desc& format_desc);
-}}
\ No newline at end of file
+}}
cmake_minimum_required (VERSION 2.6)
project ("modules")
-add_subdirectory(bluefish)
-add_subdirectory(decklink)
+if (MSVC)
+ add_subdirectory(bluefish)
+ add_subdirectory(decklink)
+endif ()
+
add_subdirectory(ffmpeg)
-add_subdirectory(flash)
-add_subdirectory(image)
-add_subdirectory(oal)
-add_subdirectory(psd)
-add_subdirectory(reroute)
-add_subdirectory(screen)
+
+if (MSVC)
+ add_subdirectory(flash)
+ add_subdirectory(image)
+ add_subdirectory(oal)
+ add_subdirectory(psd)
+ add_subdirectory(reroute)
+ add_subdirectory(screen)
+endif ()
+
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "stdafx.h"
+#include "StdAfx.h"
#include <boost/thread/once.hpp>
#include <boost/thread/thread.hpp>
#include <boost/timer.hpp>
-#include <crtdbg.h>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <tbb/spin_mutex.h>
#include <numeric>
+#include <cstring>
#if defined(_MSC_VER)
#pragma warning (push)
oc_->oformat = output_format_.format;
- strcpy_s(oc_->filename, filename_.c_str());
+ std::strcpy(oc_->filename, filename_.c_str());
// Add the audio and video streams using the default format codecs and initialize the codecs.
video_st_ = add_video_stream(options);
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "audio_decoder.h"
uint32_t audio_decoder::nb_frames() const{return impl_->nb_frames();}
std::wstring audio_decoder::print() const{return impl_->print();}
core::monitor::subject& audio_decoder::monitor_output() { return impl_->monitor_subject_;}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "ffmpeg_producer.h"
return create_destroy_proxy(spl::make_shared_ptr(std::make_shared<ffmpeg_producer>(frame_factory, format_desc, filename, filter_str, loop, start, length)));
}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "filter.h"
return frames;
}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "input.h"
double fps_ = read_fps(*format_context_, 0.0);
uint32_t frame_number_ = 0;
- stream video_stream_ = av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_VIDEO, -1, -1, 0, 0);
- stream audio_stream_ = av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_AUDIO, -1, -1, 0, 0);
+ stream video_stream_ { av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_VIDEO, -1, -1, 0, 0) };
+ stream audio_stream_ { av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_AUDIO, -1, -1, 0, 0) };
boost::optional<uint32_t> seek_target_;
{
try
{
- boost::this_thread::sleep(boost::posix_time::milliseconds(1));
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
{
boost::unique_lock<boost::mutex> lock(mutex_);
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "tbb_avcodec.h"
return avcodec_close(avctx);
}
-}
\ No newline at end of file
+}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "flv.h"
#include <boost/filesystem.hpp>
#include <iostream>
+#include <fstream>
#include <unordered_map>
if(!boost::filesystem::exists(filename))
CASPAR_THROW_EXCEPTION(caspar_exception());
- std::fstream fileStream = std::fstream(filename, std::fstream::in);
+ std::fstream fileStream(filename, std::fstream::in);
std::vector<char> bytes2(256);
fileStream.read(bytes2.data(), bytes2.size());
return values;
}
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "util.h"
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
+#include <fstream>
+
#include <asmlib.h>
#if defined(_MSC_VER)
if(av_probe_input_format2(&pb, false, &score) != nullptr)
return true;
- std::ifstream file(filename);
+ std::ifstream file(u8filename);
std::vector<unsigned char> buf;
for(auto file_it = std::istreambuf_iterator<char>(file); file_it != std::istreambuf_iterator<char>() && buf.size() < 1024; ++file_it)
// frame =
//}
-}}
\ No newline at end of file
+}}
#include <array>
-enum PixelFormat;
+#include <libavutil/avutil.h>
+
struct AVFrame;
struct AVFormatContext;
struct AVPacket;
spl::shared_ptr<AVPacket> create_packet();
spl::shared_ptr<AVFrame> create_frame();
-spl::shared_ptr<AVCodecContext> open_codec(AVFormatContext& context, enum AVMediaType type, int& index);
+spl::shared_ptr<AVCodecContext> open_codec(AVFormatContext& context, AVMediaType type, int& index);
spl::shared_ptr<AVFormatContext> open_input(const std::wstring& filename);
bool is_sane_fps(AVRational time_base);
std::wstring probe_stem(const std::wstring& stem);
bool is_valid_file(const std::wstring& filename);
-}}
\ No newline at end of file
+}}
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "../../stdafx.h"
+#include "../../StdAfx.h"
#include "video_decoder.h"
bool video_decoder::is_progressive() const{return impl_->is_progressive_;}
std::wstring video_decoder::print() const{return impl_->print();}
core::monitor::subject& video_decoder::monitor_output() { return impl_->monitor_subject_; }
-}}
\ No newline at end of file
+}}
include_directories(${BOOST_INCLUDE_PATH})
include_directories(${RXCPP_INCLUDE_PATH})
include_directories(${TBB_INCLUDE_PATH})
+include_directories(${FFMPEG_INCLUDE_PATH})
source_group(sources\\amcp amcp/*)
source_group(sources\\asio asio/*)
* Author: Nicklas P Andersson
*/
-#include "stdafx.h"
\ No newline at end of file
+#include "StdAfx.h"
#endif
#include <cstdint>
-#include <winsock2.h>
-#include <tchar.h>
#include <sstream>
#include <memory>
#include <functional>
#include "../common/log.h"
#include "../common/except.h"
-#include <assert.h>
\ No newline at end of file
+#include <assert.h>
#pragma once
-#include "../util/clientinfo.h"
+#include "../util/ClientInfo.h"
#include "amcp_shared.h"
#include <core/consumer/frame_consumer.h>
spl::shared_ptr<IO::lock_container>& lock_container() { return ctx_.lock; }
unsigned int channel_index(){return channel_index_;}
- int layer_index(int default = 0) const{return layer_index_ != -1 ? layer_index_ : default; }
+ int layer_index(int default_ = 0) const{return layer_index_ != -1 ? layer_index_ : default_; }
private:
unsigned int channel_index_;
class AMCPChannelCommandBase : public AMCPChannelCommand, public AMCPCommandBase<TMinParameters>
{
public:
- AMCPChannelCommandBase(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommand(channel, channel_index, layer_index), AMCPCommandBase(client)
+ AMCPChannelCommandBase(IO::ClientInfoPtr client, const channel_context& channel, unsigned int channel_index, int layer_index) : AMCPChannelCommand(channel, channel_index, layer_index), AMCPCommandBase<TMinParameters>(client)
{}
protected:
- AMCPChannelCommandBase(const AMCPChannelCommandBase& rhs) : AMCPChannelCommand(rhs), AMCPCommandBase(rhs)
+ AMCPChannelCommandBase(const AMCPChannelCommandBase& rhs) : AMCPChannelCommand(rhs), AMCPCommandBase<TMinParameters>(rhs)
{}
template<int T>
- AMCPChannelCommandBase(const AMCPChannelCommandBase<T>& rhs) : AMCPChannelCommand(rhs), AMCPCommandBase(rhs)
+ AMCPChannelCommandBase(const AMCPChannelCommandBase<T>& rhs) : AMCPChannelCommand(rhs), AMCPCommandBase<TMinParameters>(rhs)
{}
};
}}}
* Author: Nicklas P Andersson
*/
-#include "..\stdafx.h"
+#include "../StdAfx.h"
#include "AMCPCommandQueue.h"
});
}
-}}}
\ No newline at end of file
+}}}
#include <common/executor.h>
-#include <tbb\mutex.h>
+#include <tbb/mutex.h>
namespace caspar { namespace protocol { namespace amcp {
#include <modules/flash/producer/flash_producer.h>
#include <modules/flash/producer/cg_proxy.h>
#include <modules/ffmpeg/producer/util/util.h>
-#include <modules/image/image.h>
#include <modules/screen/screen.h>
#include <modules/reroute/producer/reroute_producer.h>
#include <fstream>
#include <memory>
#include <cctype>
-#include <io.h>
+//#include <io.h>
#include <future>
#include <boost/date_time/posix_time/posix_time.hpp>
{
if(boost::filesystem::is_regular_file(path))
{
- std::wstring clipttype = TEXT("N/A");
+ std::wstring clipttype = L"N/A";
std::wstring extension = boost::to_upper_copy(path.extension().wstring());
- if(extension == TEXT(".TGA") || extension == TEXT(".COL") || extension == L".PNG" || extension == L".JPEG" || extension == L".JPG" ||
+ if(extension == L".TGA" || extension == L".COL" || extension == L".PNG" || extension == L".JPEG" || extension == L".JPG" ||
extension == L"GIF" || extension == L"BMP")
- clipttype = TEXT("STILL");
- else if(extension == TEXT(".WAV") || extension == TEXT(".MP3"))
- clipttype = TEXT("AUDIO");
- else if(extension == TEXT("SWF") || extension == TEXT("CT") || extension == TEXT("DV") || extension == TEXT("MOV") || extension == TEXT("MPG") || extension == TEXT("AVI") || caspar::ffmpeg::is_valid_file(path.wstring()))
- clipttype = TEXT("MOVIE");
+ clipttype = L"STILL";
+ else if(extension == L".WAV" || extension == L".MP3")
+ clipttype = L"AUDIO";
+ else if(extension == L"SWF" || extension == L"CT" || extension == L"DV" || extension == L"MOV" || extension == L"MPG" || extension == L"AVI" || caspar::ffmpeg::is_valid_file(path.wstring()))
+ clipttype = L"MOVIE";
- if(clipttype != TEXT("N/A"))
+ if(clipttype != L"N/A")
{
auto is_not_digit = [](char c){ return std::isdigit(c) == 0; };
sizeStr.erase(std::remove_if(sizeStr.begin(), sizeStr.end(), is_not_digit), sizeStr.end());
auto sizeWStr = std::wstring(sizeStr.begin(), sizeStr.end());
- auto str = relativePath.replace_extension(TEXT("")).native();
- while(str.size() > 0 && (str[0] == '\\' || str[0] == '/'))
+ auto str = relativePath.replace_extension(L"").generic_wstring();
+ while(str.size() > 0 && (str[0] == L'\\' || str[0] == L'/'))
str = std::wstring(str.begin() + 1, str.end());
- return std::wstring() + TEXT("\"") + str +
- + TEXT("\" ") + clipttype +
- + TEXT(" ") + sizeStr +
- + TEXT(" ") + writeTimeWStr +
- + TEXT("\r\n");
+ return std::wstring() + L"\"" + str +
+ + L"\" " + clipttype +
+ + L" " + sizeStr +
+ + L" " + writeTimeWStr +
+ + L"\r\n";
}
}
return L"";
auto sizeWStr = std::wstring(sizeStr.begin(), sizeStr.end());
- std::wstring dir = relativePath.parent_path().native();
+ std::wstring dir = relativePath.parent_path().generic_wstring();
std::wstring file = boost::to_upper_copy(relativePath.filename().wstring());
relativePath = boost::filesystem::wpath(dir + L"/" + file);
- auto str = relativePath.replace_extension(TEXT("")).native();
+ auto str = relativePath.replace_extension(L"").generic_wstring();
boost::trim_if(str, boost::is_any_of("\\/"));
- replyString << TEXT("\"") << str
- << TEXT("\" ") << sizeWStr
- << TEXT(" ") << writeTimeWStr
- << TEXT("\r\n");
+ replyString << L"\"" << str
+ << L"\" " << sizeWStr
+ << L" " << writeTimeWStr
+ << L"\r\n";
}
}
return replyString.str();
{
core::diagnostics::osd::show_graphs(true);
- SetReplyString(TEXT("202 DIAG OK\r\n"));
+ SetReplyString(L"202 DIAG OK\r\n");
return true;
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 DIAG FAILED\r\n"));
+ SetReplyString(L"502 DIAG FAILED\r\n");
return false;
}
}
std::wstringstream replyString;
if(result.get().empty())
- replyString << TEXT("202 CALL OK\r\n");
+ replyString << L"202 CALL OK\r\n";
else
- replyString << TEXT("201 CALL OK\r\n") << result.get() << L"\r\n";
+ replyString << L"201 CALL OK\r\n" << result.get() << L"\r\n";
SetReplyString(replyString.str());
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 CALL FAILED\r\n"));
+ SetReplyString(L"502 CALL FAILED\r\n");
return false;
}
}
}
else
{
- SetReplyString(TEXT("404 MIXER ERROR\r\n"));
+ SetReplyString(L"404 MIXER ERROR\r\n");
return false;
}
else
channel()->stage().apply_transforms(transforms);
- SetReplyString(TEXT("202 MIXER OK\r\n"));
+ SetReplyString(L"202 MIXER OK\r\n");
return true;
}
catch(file_not_found&)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("404 MIXER ERROR\r\n"));
+ SetReplyString(L"404 MIXER ERROR\r\n");
return false;
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 MIXER FAILED\r\n"));
+ SetReplyString(L"502 MIXER FAILED\r\n");
return false;
}
}
ch1->stage().swap_layers(ch2.channel->stage());
}
- SetReplyString(TEXT("202 SWAP OK\r\n"));
+ SetReplyString(L"202 SWAP OK\r\n");
return true;
}
catch(file_not_found&)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("404 SWAP ERROR\r\n"));
+ SetReplyString(L"404 SWAP ERROR\r\n");
return false;
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 SWAP FAILED\r\n"));
+ SetReplyString(L"502 SWAP FAILED\r\n");
return false;
}
}
auto consumer = create_consumer(parameters());
channel()->output().add(layer_index(consumer->index()), consumer);
- SetReplyString(TEXT("202 ADD OK\r\n"));
+ SetReplyString(L"202 ADD OK\r\n");
return true;
}
catch(file_not_found&)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("404 ADD ERROR\r\n"));
+ SetReplyString(L"404 ADD ERROR\r\n");
return false;
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 ADD FAILED\r\n"));
+ SetReplyString(L"502 ADD FAILED\r\n");
return false;
}
}
channel()->output().remove(index);
- SetReplyString(TEXT("202 REMOVE OK\r\n"));
+ SetReplyString(L"202 REMOVE OK\r\n");
return true;
}
catch(file_not_found&)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("404 REMOVE ERROR\r\n"));
+ SetReplyString(L"404 REMOVE ERROR\r\n");
return false;
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 REMOVE FAILED\r\n"));
+ SetReplyString(L"502 REMOVE FAILED\r\n");
return false;
}
}
auto pFP = create_producer(channel()->frame_factory(), channel()->video_format_desc(), parameters());
channel()->stage().load(layer_index(), pFP, true);
- SetReplyString(TEXT("202 LOAD OK\r\n"));
+ SetReplyString(L"202 LOAD OK\r\n");
return true;
}
catch(file_not_found&)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("404 LOAD ERROR\r\n"));
+ SetReplyString(L"404 LOAD ERROR\r\n");
return false;
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 LOAD FAILED\r\n"));
+ SetReplyString(L"502 LOAD FAILED\r\n");
return false;
}
}
auto tween = what["TWEEN"].matched ? what["TWEEN"].str() : L"";
transitionInfo.tweener = tween;
- if(transition == TEXT("CUT"))
+ if(transition == L"CUT")
transitionInfo.type = transition_type::cut;
- else if(transition == TEXT("MIX"))
+ else if(transition == L"MIX")
transitionInfo.type = transition_type::mix;
- else if(transition == TEXT("PUSH"))
+ else if(transition == L"PUSH")
transitionInfo.type = transition_type::push;
- else if(transition == TEXT("SLIDE"))
+ else if(transition == L"SLIDE")
transitionInfo.type = transition_type::slide;
- else if(transition == TEXT("WIPE"))
+ else if(transition == L"WIPE")
transitionInfo.type = transition_type::wipe;
- if(direction == TEXT("FROMLEFT"))
+ if(direction == L"FROMLEFT")
transitionInfo.direction = transition_direction::from_left;
- else if(direction == TEXT("FROMRIGHT"))
+ else if(direction == L"FROMRIGHT")
transitionInfo.direction = transition_direction::from_right;
- else if(direction == TEXT("LEFT"))
+ else if(direction == L"LEFT")
transitionInfo.direction = transition_direction::from_right;
- else if(direction == TEXT("RIGHT"))
+ else if(direction == L"RIGHT")
transitionInfo.direction = transition_direction::from_left;
}
channel()->stage().load(layer_index(), pFP2, false); // TODO: LOOP
- SetReplyString(TEXT("202 LOADBG OK\r\n"));
+ SetReplyString(L"202 LOADBG OK\r\n");
return true;
}
catch(file_not_found&)
{
CASPAR_LOG(error) << L"File not found. No match found for parameters. Check syntax.";
- SetReplyString(TEXT("404 LOADBG ERROR\r\n"));
+ SetReplyString(L"404 LOADBG ERROR\r\n");
return false;
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("502 LOADBG FAILED\r\n"));
+ SetReplyString(L"502 LOADBG FAILED\r\n");
return false;
}
}
try
{
channel()->stage().pause(layer_index());
- SetReplyString(TEXT("202 PAUSE OK\r\n"));
+ SetReplyString(L"202 PAUSE OK\r\n");
return true;
}
catch(...)
{
- SetReplyString(TEXT("501 PAUSE FAILED\r\n"));
+ SetReplyString(L"501 PAUSE FAILED\r\n");
}
return false;
channel()->stage().play(layer_index());
- SetReplyString(TEXT("202 PLAY OK\r\n"));
+ SetReplyString(L"202 PLAY OK\r\n");
return true;
}
catch(...)
{
- SetReplyString(TEXT("501 PLAY FAILED\r\n"));
+ SetReplyString(L"501 PLAY FAILED\r\n");
}
return false;
try
{
channel()->stage().stop(layer_index());
- SetReplyString(TEXT("202 STOP OK\r\n"));
+ SetReplyString(L"202 STOP OK\r\n");
return true;
}
catch(...)
{
- SetReplyString(TEXT("501 STOP FAILED\r\n"));
+ SetReplyString(L"501 STOP FAILED\r\n");
}
return false;
else
channel()->stage().clear();
- SetReplyString(TEXT("202 CLEAR OK\r\n"));
+ SetReplyString(L"202 CLEAR OK\r\n");
return true;
}
{
channel()->output().add(create_consumer({ L"IMAGE" }));
- SetReplyString(TEXT("202 PRINT OK\r\n"));
+ SetReplyString(L"202 PRINT OK\r\n");
return true;
}
if(boost::iequals(parameters().at(0), L"LEVEL"))
log::set_log_level(parameters().at(1));
- SetReplyString(TEXT("202 LOG OK\r\n"));
+ SetReplyString(L"202 LOG OK\r\n");
return true;
}
try
{
std::wstring command = boost::to_upper_copy(parameters()[0]);
- if(command == TEXT("ADD"))
+ if(command == L"ADD")
return DoExecuteAdd();
- else if(command == TEXT("PLAY"))
+ else if(command == L"PLAY")
return DoExecutePlay();
- else if(command == TEXT("STOP"))
+ else if(command == L"STOP")
return DoExecuteStop();
- else if(command == TEXT("NEXT"))
+ else if(command == L"NEXT")
return DoExecuteNext();
- else if(command == TEXT("REMOVE"))
+ else if(command == L"REMOVE")
return DoExecuteRemove();
- else if(command == TEXT("CLEAR"))
+ else if(command == L"CLEAR")
return DoExecuteClear();
- else if(command == TEXT("UPDATE"))
+ else if(command == L"UPDATE")
return DoExecuteUpdate();
- else if(command == TEXT("INVOKE"))
+ else if(command == L"INVOKE")
return DoExecuteInvoke();
- else if(command == TEXT("INFO"))
+ else if(command == L"INFO")
return DoExecuteInfo();
}
catch(...)
CASPAR_LOG_CURRENT_EXCEPTION();
}
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
bool CGCommand::ValidateLayer(const std::wstring& layerstring) {
int length = layerstring.length();
for(int i = 0; i < length; ++i) {
- if(!_istdigit(layerstring[i])) {
+ if(!std::isdigit(layerstring[i])) {
return false;
}
}
if(parameters().size() < 4)
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return false;
}
unsigned int dataIndex = 4;
if(!ValidateLayer(parameters()[1]))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
++dataIndex;
if(parameters().size() > 4 && parameters()[4].length() > 0) //read play-on-load-flag
- bDoStart = (parameters()[4][0]==TEXT('1')) ? true : false;
+ bDoStart = (parameters()[4][0]==L'1') ? true : false;
else
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return false;
}
}
else if(parameters()[3].length() > 0) { //read play-on-load-flag
- bDoStart = (parameters()[3][0]==TEXT('1')) ? true : false;
+ bDoStart = (parameters()[3][0]==L'1') ? true : false;
}
else
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
- const TCHAR* pDataString = 0;
+ const wchar_t* pDataString = 0;
std::wstring dataFromFile;
if(parameters().size() > dataIndex)
{ //read data
const std::wstring& dataString = parameters()[dataIndex];
- if(dataString[0] == TEXT('<')) //the data is an XML-string
+ if(dataString[0] == L'<') //the data is an XML-string
pDataString = dataString.c_str();
else
{
//The data is not an XML-string, it must be a filename
std::wstring filename = env::data_folder();
filename.append(dataString);
- filename.append(TEXT(".ftd"));
+ filename.append(L".ftd");
dataFromFile = read_file(boost::filesystem::wpath(filename));
pDataString = dataFromFile.c_str();
std::wstring filename = parameters()[2];
filename.append(extension);
- flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(channel()), layer_index(flash::cg_proxy::DEFAULT_LAYER)).add(layer, filename, bDoStart, label, (pDataString!=0) ? pDataString : TEXT(""));
- SetReplyString(TEXT("202 CG OK\r\n"));
+ flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(channel()), layer_index(flash::cg_proxy::DEFAULT_LAYER)).add(layer, filename, bDoStart, label, (pDataString!=0) ? pDataString : L"");
+ SetReplyString(L"202 CG OK\r\n");
}
else
{
CASPAR_LOG(warning) << "Could not find template " << parameters()[2];
- SetReplyString(TEXT("404 CG ERROR\r\n"));
+ SetReplyString(L"404 CG ERROR\r\n");
}
return true;
}
{
if(!ValidateLayer(parameters()[1]))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
int layer = boost::lexical_cast<int>(parameters()[1]);
}
else
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return true;
}
- SetReplyString(TEXT("202 CG OK\r\n"));
+ SetReplyString(L"202 CG OK\r\n");
return true;
}
{
if(!ValidateLayer(parameters()[1]))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
int layer = boost::lexical_cast<int>(parameters()[1]);
}
else
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return true;
}
- SetReplyString(TEXT("202 CG OK\r\n"));
+ SetReplyString(L"202 CG OK\r\n");
return true;
}
{
if(!ValidateLayer(parameters()[1]))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
}
else
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return true;
}
- SetReplyString(TEXT("202 CG OK\r\n"));
+ SetReplyString(L"202 CG OK\r\n");
return true;
}
{
if(!ValidateLayer(parameters()[1]))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
}
else
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return true;
}
- SetReplyString(TEXT("202 CG OK\r\n"));
+ SetReplyString(L"202 CG OK\r\n");
return true;
}
bool CGCommand::DoExecuteClear()
{
channel()->stage().clear(layer_index(flash::cg_proxy::DEFAULT_LAYER));
- SetReplyString(TEXT("202 CG OK\r\n"));
+ SetReplyString(L"202 CG OK\r\n");
return true;
}
{
if(!ValidateLayer(parameters().at(1)))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
std::wstring dataString = parameters().at(2);
- if(dataString.at(0) != TEXT('<'))
+ if(dataString.at(0) != L'<')
{
//The data is not an XML-string, it must be a filename
std::wstring filename = env::data_folder();
filename.append(dataString);
- filename.append(TEXT(".ftd"));
+ filename.append(L".ftd");
dataString = read_file(boost::filesystem::wpath(filename));
}
}
catch(...)
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return true;
}
- SetReplyString(TEXT("202 CG OK\r\n"));
+ SetReplyString(L"202 CG OK\r\n");
return true;
}
bool CGCommand::DoExecuteInvoke()
{
std::wstringstream replyString;
- replyString << TEXT("201 CG OK\r\n");
+ replyString << L"201 CG OK\r\n";
if(parameters().size() > 2)
{
if(!ValidateLayer(parameters()[1]))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
int layer = boost::lexical_cast<int>(parameters()[1]);
auto result = flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(channel()), layer_index(flash::cg_proxy::DEFAULT_LAYER)).invoke(layer, parameters()[2]);
- replyString << result << TEXT("\r\n");
+ replyString << result << L"\r\n";
}
else
{
- SetReplyString(TEXT("402 CG ERROR\r\n"));
+ SetReplyString(L"402 CG ERROR\r\n");
return true;
}
bool CGCommand::DoExecuteInfo()
{
std::wstringstream replyString;
- replyString << TEXT("201 CG OK\r\n");
+ replyString << L"201 CG OK\r\n";
if(parameters().size() > 1)
{
if(!ValidateLayer(parameters()[1]))
{
- SetReplyString(TEXT("403 CG ERROR\r\n"));
+ SetReplyString(L"403 CG ERROR\r\n");
return false;
}
int layer = boost::lexical_cast<int>(parameters()[1]);
auto desc = flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(channel()), layer_index(flash::cg_proxy::DEFAULT_LAYER)).description(layer);
- replyString << desc << TEXT("\r\n");
+ replyString << desc << L"\r\n";
}
else
{
auto info = flash::create_cg_proxy(spl::shared_ptr<core::video_channel>(channel()), layer_index(flash::cg_proxy::DEFAULT_LAYER)).template_host_info();
- replyString << info << TEXT("\r\n");
+ replyString << info << L"\r\n";
}
SetReplyString(replyString.str());
bool DataCommand::DoExecute()
{
std::wstring command = boost::to_upper_copy(parameters()[0]);
- if(command == TEXT("STORE"))
+ if(command == L"STORE")
return DoExecuteStore();
- else if(command == TEXT("RETRIEVE"))
+ else if(command == L"RETRIEVE")
return DoExecuteRetrieve();
- else if(command == TEXT("REMOVE"))
+ else if(command == L"REMOVE")
return DoExecuteRemove();
- else if(command == TEXT("LIST"))
+ else if(command == L"LIST")
return DoExecuteList();
- SetReplyString(TEXT("403 DATA ERROR\r\n"));
+ SetReplyString(L"403 DATA ERROR\r\n");
return false;
}
{
if(parameters().size() < 3)
{
- SetReplyString(TEXT("402 DATA STORE ERROR\r\n"));
+ SetReplyString(L"402 DATA STORE ERROR\r\n");
return false;
}
std::wstring filename = env::data_folder();
filename.append(parameters()[1]);
- filename.append(TEXT(".ftd"));
+ filename.append(L".ftd");
auto data_path = boost::filesystem::wpath(
boost::filesystem::wpath(filename).parent_path());
if(!boost::filesystem::exists(data_path))
boost::filesystem::create_directories(data_path);
- std::wofstream datafile(filename.c_str());
+ boost::filesystem::wofstream datafile(filename);
if(!datafile)
{
- SetReplyString(TEXT("501 DATA STORE FAILED\r\n"));
+ SetReplyString(L"501 DATA STORE FAILED\r\n");
return false;
}
datafile << parameters()[2] << std::flush;
datafile.close();
- std::wstring replyString = TEXT("202 DATA STORE OK\r\n");
+ std::wstring replyString = L"202 DATA STORE OK\r\n";
SetReplyString(replyString);
return true;
}
{
if(parameters().size() < 2)
{
- SetReplyString(TEXT("402 DATA RETRIEVE ERROR\r\n"));
+ SetReplyString(L"402 DATA RETRIEVE ERROR\r\n");
return false;
}
std::wstring filename = env::data_folder();
filename.append(parameters()[1]);
- filename.append(TEXT(".ftd"));
+ filename.append(L".ftd");
std::wstring file_contents = read_file(boost::filesystem::wpath(filename));
if (file_contents.empty())
{
- SetReplyString(TEXT("404 DATA RETRIEVE ERROR\r\n"));
+ SetReplyString(L"404 DATA RETRIEVE ERROR\r\n");
return false;
}
- std::wstringstream reply(TEXT("201 DATA RETRIEVE OK\r\n"));
+ std::wstringstream reply(L"201 DATA RETRIEVE OK\r\n");
std::wstringstream file_contents_stream(file_contents);
std::wstring line;
{
if (parameters().size() < 2)
{
- SetReplyString(TEXT("402 DATA REMOVE ERROR\r\n"));
+ SetReplyString(L"402 DATA REMOVE ERROR\r\n");
return false;
}
std::wstring filename = env::data_folder();
filename.append(parameters()[1]);
- filename.append(TEXT(".ftd"));
+ filename.append(L".ftd");
if (!boost::filesystem::exists(filename))
{
- SetReplyString(TEXT("404 DATA REMOVE ERROR\r\n"));
+ SetReplyString(L"404 DATA REMOVE ERROR\r\n");
return false;
}
if (!boost::filesystem::remove(filename))
{
- SetReplyString(TEXT("403 DATA REMOVE ERROR\r\n"));
+ SetReplyString(L"403 DATA REMOVE ERROR\r\n");
return false;
}
- SetReplyString(TEXT("201 DATA REMOVE OK\r\n"));
+ SetReplyString(L"201 DATA REMOVE OK\r\n");
return true;
}
bool DataCommand::DoExecuteList()
{
std::wstringstream replyString;
- replyString << TEXT("200 DATA LIST OK\r\n");
+ replyString << L"200 DATA LIST OK\r\n";
for (boost::filesystem::recursive_directory_iterator itr(env::data_folder()), end; itr != end; ++itr)
{
auto relativePath = boost::filesystem::wpath(itr->path().wstring().substr(env::data_folder().size()-1, itr->path().wstring().size()));
- auto str = relativePath.replace_extension(TEXT("")).native();
- if(str[0] == '\\' || str[0] == '/')
+ auto str = relativePath.replace_extension(L"").generic_wstring();
+ if(str[0] == L'\\' || str[0] == L'/')
str = std::wstring(str.begin() + 1, str.end());
- replyString << str << TEXT("\r\n");
+ replyString << str << L"\r\n";
}
}
- replyString << TEXT("\r\n");
+ replyString << L"\r\n";
SetReplyString(boost::to_upper_copy(replyString.str()));
return true;
if(info.empty())
{
- SetReplyString(TEXT("404 CINF ERROR\r\n"));
+ SetReplyString(L"404 CINF ERROR\r\n");
return false;
}
- replyString << TEXT("200 CINF OK\r\n");
+ replyString << L"200 CINF OK\r\n";
replyString << info << "\r\n";
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("404 CINF ERROR\r\n"));
+ SetReplyString(L"404 CINF ERROR\r\n");
return false;
}
void GenerateChannelInfo(int index, const spl::shared_ptr<core::video_channel>& pChannel, std::wstringstream& replyString)
{
- replyString << index+1 << TEXT(" ") << pChannel->video_format_desc().name << TEXT(" PLAYING") << TEXT("\r\n");
+ replyString << index+1 << L" " << pChannel->video_format_desc().name << L" PLAYING\r\n";
}
bool InfoCommand::DoExecute()
info.add(L"system.bluefish.device", device);
info.add(L"system.flash", caspar::flash::version());
- //info.add(L"system.free-image", caspar::image::version());
info.add(L"system.ffmpeg.avcodec", caspar::ffmpeg::avcodec_version());
info.add(L"system.ffmpeg.avformat", caspar::ffmpeg::avformat_version());
info.add(L"system.ffmpeg.avfilter", caspar::ffmpeg::avfilter_version());
{
if(parameters().size() >= 1)
{
- replyString << TEXT("201 INFO OK\r\n");
+ replyString << L"201 INFO OK\r\n";
boost::property_tree::wptree info;
std::vector<std::wstring> split;
else
{
// This is needed for backwards compatibility with old clients
- replyString << TEXT("200 INFO OK\r\n");
+ replyString << L"200 INFO OK\r\n";
for(size_t n = 0; n < channels().size(); ++n)
GenerateChannelInfo(n, channels()[n].channel, replyString);
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("403 INFO ERROR\r\n"));
+ SetReplyString(L"403 INFO ERROR\r\n");
return false;
}
- replyString << TEXT("\r\n");
+ replyString << L"\r\n";
SetReplyString(replyString.str());
return true;
}
try
{
std::wstringstream replyString;
- replyString << TEXT("200 CLS OK\r\n");
+ replyString << L"200 CLS OK\r\n";
replyString << ListMedia();
- replyString << TEXT("\r\n");
+ replyString << L"\r\n";
SetReplyString(boost::to_upper_copy(replyString.str()));
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("501 CLS FAILED\r\n"));
+ SetReplyString(L"501 CLS FAILED\r\n");
return false;
}
try
{
std::wstringstream replyString;
- replyString << TEXT("200 TLS OK\r\n");
+ replyString << L"200 TLS OK\r\n";
replyString << ListTemplates();
- replyString << TEXT("\r\n");
+ replyString << L"\r\n";
SetReplyString(replyString.str());
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("501 TLS FAILED\r\n"));
+ SetReplyString(L"501 TLS FAILED\r\n");
return false;
}
return true;
bool VersionCommand::DoExecute()
{
- std::wstring replyString = TEXT("201 VERSION OK\r\n") + env::version() + TEXT("\r\n");
+ std::wstring replyString = L"201 VERSION OK\r\n" + env::version() + L"\r\n";
if(parameters().size() > 0)
{
if(boost::iequals(parameters()[0], L"FLASH"))
- replyString = TEXT("201 VERSION OK\r\n") + flash::version() + TEXT("\r\n");
+ replyString = L"201 VERSION OK\r\n" + flash::version() + L"\r\n";
else if(boost::iequals(parameters()[0], L"TEMPLATEHOST"))
- replyString = TEXT("201 VERSION OK\r\n") + flash::cg_version() + TEXT("\r\n");
+ replyString = L"201 VERSION OK\r\n" + flash::cg_version() + L"\r\n";
else if(!boost::iequals(parameters()[0], L"SERVER"))
- replyString = TEXT("403 VERSION ERROR\r\n");
+ replyString = L"403 VERSION ERROR\r\n";
}
SetReplyString(replyString);
std::wstring name = boost::to_upper_copy(parameters()[0]);
std::wstring value = boost::to_upper_copy(parameters()[1]);
- if(name == TEXT("MODE"))
+ if(name == L"MODE")
{
auto format_desc = core::video_format_desc(value);
if(format_desc.format != core::video_format::invalid)
{
channel()->video_format_desc(format_desc);
- SetReplyString(TEXT("202 SET MODE OK\r\n"));
+ SetReplyString(L"202 SET MODE OK\r\n");
}
else
- SetReplyString(TEXT("501 SET MODE FAILED\r\n"));
+ SetReplyString(L"501 SET MODE FAILED\r\n");
}
else
{
- this->SetReplyString(TEXT("403 SET ERROR\r\n"));
+ this->SetReplyString(L"403 SET ERROR\r\n");
}
}
catch(...)
{
CASPAR_LOG_CURRENT_EXCEPTION();
- SetReplyString(TEXT("501 SET FAILED\r\n"));
+ SetReplyString(L"501 SET FAILED\r\n");
return false;
}
{
std::wstring command = boost::to_upper_copy(parameters()[0]);
- if (command == TEXT("RETRIEVE"))
+ if (command == L"RETRIEVE")
return DoExecuteRetrieve();
- else if (command == TEXT("LIST"))
+ else if (command == L"LIST")
return DoExecuteList();
- else if (command == TEXT("GENERATE"))
+ else if (command == L"GENERATE")
return DoExecuteGenerate();
- else if (command == TEXT("GENERATE_ALL"))
+ else if (command == L"GENERATE_ALL")
return DoExecuteGenerateAll();
- SetReplyString(TEXT("403 THUMBNAIL ERROR\r\n"));
+ SetReplyString(L"403 THUMBNAIL ERROR\r\n");
return false;
}
{
if(parameters().size() < 2)
{
- SetReplyString(TEXT("402 THUMBNAIL RETRIEVE ERROR\r\n"));
+ SetReplyString(L"402 THUMBNAIL RETRIEVE ERROR\r\n");
return false;
}
std::wstring filename = env::thumbnails_folder();
filename.append(parameters()[1]);
- filename.append(TEXT(".png"));
+ filename.append(L".png");
std::wstring file_contents = read_file_base64(boost::filesystem::wpath(filename));
if (file_contents.empty())
{
- SetReplyString(TEXT("404 THUMBNAIL RETRIEVE ERROR\r\n"));
+ SetReplyString(L"404 THUMBNAIL RETRIEVE ERROR\r\n");
return false;
}
bool ThumbnailCommand::DoExecuteList()
{
std::wstringstream replyString;
- replyString << TEXT("200 THUMBNAIL LIST OK\r\n");
+ replyString << L"200 THUMBNAIL LIST OK\r\n";
for (boost::filesystem::recursive_directory_iterator itr(env::thumbnails_folder()), end; itr != end; ++itr)
{
auto relativePath = boost::filesystem::wpath(itr->path().wstring().substr(env::thumbnails_folder().size()-1, itr->path().wstring().size()));
- auto str = relativePath.replace_extension(L"").native();
+ auto str = relativePath.replace_extension(L"").generic_wstring();
if(str[0] == '\\' || str[0] == '/')
str = std::wstring(str.begin() + 1, str.end());
}
}
- replyString << TEXT("\r\n");
+ replyString << L"\r\n";
SetReplyString(boost::to_upper_copy(replyString.str()));
return true;
bool KillCommand::DoExecute()
{
shutdown_server_now_->set_value(false); //false for not attempting to restart
- SetReplyString(TEXT("202 KILL OK\r\n"));
+ SetReplyString(L"202 KILL OK\r\n");
return true;
}
bool RestartCommand::DoExecute()
{
shutdown_server_now_->set_value(true); //true for attempting to restart
- SetReplyString(TEXT("202 RESTART OK\r\n"));
+ SetReplyString(L"202 RESTART OK\r\n");
return true;
}
#include "AMCPCommandQueue.h"
#include <stdio.h>
-#include <crtdbg.h>
+//#include <crtdbg.h>
#include <string.h>
#include <algorithm>
#include <cctype>
switch(state)
{
case parser_state::New:
- if((*it)[0] == TEXT('/'))
+ if((*it)[0] == L'/')
state = parser_state::GetSwitch;
else
state = parser_state::GetCommand;
//insert code-handling here
switch(message[charIndex])
{
- case TEXT('\\'):
- currentToken += TEXT("\\");
+ case L'\\':
+ currentToken += L"\\";
break;
- case TEXT('\"'):
- currentToken += TEXT("\"");
+ case L'\"':
+ currentToken += L"\"";
break;
- case TEXT('n'):
- currentToken += TEXT("\n");
+ case L'n':
+ currentToken += L"\n";
break;
default:
break;
continue;
}
- if(message[charIndex]==TEXT('\\'))
+ if(message[charIndex]==L'\\')
{
getSpecialCode = true;
continue;
}
- if(message[charIndex]==' ' && inQuote==false)
+ if(message[charIndex]==L' ' && inQuote==false)
{
if(currentToken.size()>0)
{
continue;
}
- if(message[charIndex]==TEXT('\"'))
+ if(message[charIndex]==L'\"')
{
inQuote = !inQuote;
AMCPCommand::ptr_type create_command(const std::wstring& str, ClientInfoPtr client)
{
std::wstring s = boost::to_upper_copy(str);
- if(s == TEXT("DIAG")) return std::make_shared<DiagnosticsCommand>(client);
- else if(s == TEXT("CHANNEL_GRID")) return std::make_shared<ChannelGridCommand>(client, channels_);
- else if(s == TEXT("DATA")) return std::make_shared<DataCommand>(client);
- else if(s == TEXT("CINF")) return std::make_shared<CinfCommand>(client);
- else if(s == TEXT("INFO")) return std::make_shared<InfoCommand>(client, channels_);
- else if(s == TEXT("CLS")) return std::make_shared<ClsCommand>(client);
- else if(s == TEXT("TLS")) return std::make_shared<TlsCommand>(client);
- else if(s == TEXT("VERSION")) return std::make_shared<VersionCommand>(client);
- else if(s == TEXT("BYE")) return std::make_shared<ByeCommand>(client);
- else if(s == TEXT("LOCK")) return std::make_shared<LockCommand>(client, channels_);
- else if(s == TEXT("LOG")) return std::make_shared<LogCommand>(client);
- else if(s == TEXT("THUMBNAIL")) return std::make_shared<ThumbnailCommand>(client, thumb_gen_);
- else if(s == TEXT("KILL")) return std::make_shared<KillCommand>(client, shutdown_server_now_);
- else if(s == TEXT("RESTART")) return std::make_shared<RestartCommand>(client, shutdown_server_now_);
+ if(s == L"DIAG") return std::make_shared<DiagnosticsCommand>(client);
+ else if(s == L"CHANNEL_GRID") return std::make_shared<ChannelGridCommand>(client, channels_);
+ else if(s == L"DATA") return std::make_shared<DataCommand>(client);
+ else if(s == L"CINF") return std::make_shared<CinfCommand>(client);
+ else if(s == L"INFO") return std::make_shared<InfoCommand>(client, channels_);
+ else if(s == L"CLS") return std::make_shared<ClsCommand>(client);
+ else if(s == L"TLS") return std::make_shared<TlsCommand>(client);
+ else if(s == L"VERSION") return std::make_shared<VersionCommand>(client);
+ else if(s == L"BYE") return std::make_shared<ByeCommand>(client);
+ else if(s == L"LOCK") return std::make_shared<LockCommand>(client, channels_);
+ else if(s == L"LOG") return std::make_shared<LogCommand>(client);
+ else if(s == L"THUMBNAIL") return std::make_shared<ThumbnailCommand>(client, thumb_gen_);
+ else if(s == L"KILL") return std::make_shared<KillCommand>(client, shutdown_server_now_);
+ else if(s == L"RESTART") return std::make_shared<RestartCommand>(client, shutdown_server_now_);
return nullptr;
}
{
std::wstring s = boost::to_upper_copy(str);
- if (s == TEXT("MIXER")) return std::make_shared<MixerCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("CALL")) return std::make_shared<CallCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("SWAP")) return std::make_shared<SwapCommand>(client, channel, channel_index, layer_index, channels_);
- else if(s == TEXT("LOAD")) return std::make_shared<LoadCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("LOADBG")) return std::make_shared<LoadbgCommand>(client, channel, channel_index, layer_index, channels_);
- else if(s == TEXT("ADD")) return std::make_shared<AddCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("REMOVE")) return std::make_shared<RemoveCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("PAUSE")) return std::make_shared<PauseCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("PLAY")) return std::make_shared<PlayCommand>(client, channel, channel_index, layer_index, channels_);
- else if(s == TEXT("STOP")) return std::make_shared<StopCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("CLEAR")) return std::make_shared<ClearCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("PRINT")) return std::make_shared<PrintCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("CG")) return std::make_shared<CGCommand>(client, channel, channel_index, layer_index);
- else if(s == TEXT("SET")) return std::make_shared<SetCommand>(client, channel, channel_index, layer_index);
+ if (s == L"MIXER") return std::make_shared<MixerCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"CALL") return std::make_shared<CallCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"SWAP") return std::make_shared<SwapCommand>(client, channel, channel_index, layer_index, channels_);
+ else if(s == L"LOAD") return std::make_shared<LoadCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"LOADBG") return std::make_shared<LoadbgCommand>(client, channel, channel_index, layer_index, channels_);
+ else if(s == L"ADD") return std::make_shared<AddCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"REMOVE") return std::make_shared<RemoveCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"PAUSE") return std::make_shared<PauseCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"PLAY") return std::make_shared<PlayCommand>(client, channel, channel_index, layer_index, channels_);
+ else if(s == L"STOP") return std::make_shared<StopCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"CLEAR") return std::make_shared<ClearCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"PRINT") return std::make_shared<PrintCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"CG") return std::make_shared<CGCommand>(client, channel, channel_index, layer_index);
+ else if(s == L"SET") return std::make_shared<SetCommand>(client, channel, channel_index, layer_index);
return nullptr;
}
} //namespace amcp
-}} //namespace caspar
\ No newline at end of file
+}} //namespace caspar
#pragma once
-#include "../util/protocolstrategy.h"
+#include "../util/ProtocolStrategy.h"
#include <core/video_channel.h>
#include <core/thumbnail_generator.h>
#pragma once
+#include <memory>
+
namespace caspar { namespace protocol {
namespace cii {
virtual void Execute() = 0;
};
-typedef std::tr1::shared_ptr<ICIICommand> CIICommandPtr;
+typedef std::shared_ptr<ICIICommand> CIICommandPtr;
} //namespace cii
-}} //namespace caspar
\ No newline at end of file
+}} //namespace caspar
std::wstringstream dataStream;
- dataStream << TEXT("<templateData>");
+ dataStream << L"<templateData>";
std::vector<std::wstring>::size_type end = parameters.size();
for(std::vector<std::wstring>::size_type i = 3; i < end; ++i)
- dataStream << TEXT("<componentData id=\"field") << i-2 << TEXT("\"><data id=\"text\" value=\"") << parameters[i] << TEXT("\" /></componentData>");
+ dataStream << L"<componentData id=\"field" << i-2 << L"\"><data id=\"text\" value=\"" << parameters[i] << L"\" /></componentData>";
- dataStream << TEXT("</templateData>");
+ dataStream << L"</templateData>";
xmlData_ = dataStream.str();
}
}
// ImagestoreCommand
void ImagestoreCommand::Setup(const std::vector<std::wstring>& parameters)
{
- if(parameters[1] == TEXT("7") && parameters.size() > 2)
+ if(parameters[1] == L"7" && parameters.size() > 2)
titleName_ = parameters[2].substr(0, 4);
}
{
//HAWRYS: V\5\3\1\1\namn.tga\1
// Display still
- if((parameters.size() > 5) && parameters[1] == TEXT("5") && parameters[2] == TEXT("3"))
+ if((parameters.size() > 5) && parameters[1] == L"5" && parameters[2] == L"3")
{
filename_ = parameters[5];
- filename_ = filename_.substr(0, filename_.find_last_of(TEXT('.')));
+ filename_ = filename_.substr(0, filename_.find_last_of(L'.'));
filename_.append(L".ft");
state_ = 0;
return;
//NEPTUNE: V\5\13\1\X\Template\0\TabField1\TabField2...
// Add Template to layer X in the active templatehost
- if((parameters.size() > 5) && parameters[1] == TEXT("5") && parameters[2] == TEXT("13"))
+ if((parameters.size() > 5) && parameters[1] == L"5" && parameters[2] == L"13")
{
- layer_ = _ttoi(parameters[4].c_str());
+ layer_ = boost::lexical_cast<int>(parameters[4]);
filename_ = parameters[5];
if(filename_.find(L"PK/") == std::wstring::npos && filename_.find(L"PK\\") == std::wstring::npos)
filename_ = L"PK/" + filename_;
if(parameters.size() > 7) {
std::wstringstream dataStream;
- dataStream << TEXT("<templateData>");
+ dataStream << L"<templateData>";
std::vector<std::wstring>::size_type end = parameters.size();
for(std::vector<std::wstring>::size_type i = 7; i < end; ++i) {
- dataStream << TEXT("<componentData id=\"f") << i-7 << TEXT("\"><data id=\"text\" value=\"") << parameters[i] << TEXT("\" /></componentData>");
+ dataStream << L"<componentData id=\"f" << i-7 << L"\"><data id=\"text\" value=\"" << parameters[i] << L"\" /></componentData>";
}
- dataStream << TEXT("</templateData>");
+ dataStream << L"</templateData>";
xmlData_ = dataStream.str();
}
}
// VIDEO MODE V\5\14\MODE
- if((parameters.size() > 3) && parameters[1] == TEXT("5") && parameters[2] == TEXT("14"))
+ if((parameters.size() > 3) && parameters[1] == L"5" && parameters[2] == L"14")
{
std::wstring value = parameters[3];
std::transform(value.begin(), value.end(), value.begin(), toupper);
{
// HACK fix. The data sent is UTF8, however the protocol is implemented for ISO-8859-1. Instead of doing risky changes we simply convert into proper encoding when leaving protocol code.
auto xmlData2 = boost::locale::conv::utf_to_utf<wchar_t, char>(std::string(xmlData_.begin(), xmlData_.end()));
- flash::create_cg_proxy(pCIIStrategy_->GetChannel()).add(layer_, filename_, false, TEXT(""), xmlData2);
+ flash::create_cg_proxy(pCIIStrategy_->GetChannel()).add(layer_, filename_, false, L"", xmlData2);
}
}
for(int i=0;i<4;++i)
{
if(parameters[1][i+3] < 176) {
- titleName_ = TEXT("");
+ titleName_ = L"";
break;
}
titleName_[i] = parameters[1][i+3]-144;
}
-}}}
\ No newline at end of file
+}}}
#pragma once
-#include "ciicommand.h"
+#include "CIICommand.h"
namespace caspar { namespace protocol {
};
} //namespace cii
-}} //namespace caspar
\ No newline at end of file
+}} //namespace caspar
#include <sstream>
#include <algorithm>
#include "CIIProtocolStrategy.h"
-#include "CIICommandsimpl.h"
+#include "CIICommandsImpl.h"
#include <modules/flash/producer/flash_producer.h>
#include <core/producer/transition/transition_producer.h>
#include <core/mixer/mixer.h>
if(message[charIndex] == TokenDelimiter)
{
pTokenVector->push_back(currentToken.str());
- currentToken.str(TEXT(""));
+ currentToken.str(L"");
continue;
}
- if(message[charIndex] == TEXT('\"'))
- currentToken << TEXT(""");
- else if(message[charIndex] == TEXT('<'))
- currentToken << TEXT("<");
- else if(message[charIndex] == TEXT('>'))
- currentToken << TEXT(">");
+ if(message[charIndex] == L'\"')
+ currentToken << L""";
+ else if(message[charIndex] == L'<')
+ currentToken << L"<";
+ else if(message[charIndex] == L'>')
+ currentToken << L">";
else
currentToken << message[charIndex];
}
/************
// Examples (<X> = ASCIICHAR X)
-I\25\3\VII\\ sätter outputtype till 'vii'
+I\25\3\VII\\ s�tter outputtype till 'vii'
I\25\4\1\\ enablar framebuffer (ignore this)
-M\C/SVTNEWS\\ pekar ut vilken grafisk profil som skall användas
+M\C/SVTNEWS\\ pekar ut vilken grafisk profil som skall anv�ndas
-W\4009\4067\Jonas Björkman\\ Skriver "Jonas Björkman" till första textfältet i template 4067 och sparar den färdiga skylten som 4009
+W\4009\4067\Jonas Bj�rkman\\ Skriver "Jonas Bj�rkman" till f�rsta textf�ltet i template 4067 och sparar den f�rdiga skylten som 4009
-T\7\4009.VII\A\\ lägger ut skylt 4009
+T\7\4009.VII\A\\ l�gger ut skylt 4009
-Y\<205><247><202><196><192><192><200><248>\\ lägger ut skylten 4008 (<205><247><202><196><192><192><200><248> = "=g:4008h" om man drar bort 144 från varje asciivärde)
+Y\<205><247><202><196><192><192><200><248>\\ l�gger ut skylten 4008 (<205><247><202><196><192><192><200><248> = "=g:4008h" om man drar bort 144 fr�n varje asciiv�rde)
-V\5\3\1\1\namn.tga\1\\ lägger ut bilden namn.tga
-V\0\1\D\C\10\0\0\0\\ gör någon inställning som har med föregående kommando att göra.
+V\5\3\1\1\namn.tga\1\\ l�gger ut bilden namn.tga
+V\0\1\D\C\10\0\0\0\\ g�r n�gon inst�llning som har med f�reg�ende kommando att g�ra.
*************/
/**********************
New Commands to support the Netupe automation system
-V\5\13\1\1\Template\0\TabField1\TabField2...\\ Build. Ettan före Template indikerar vilket lager den nya templaten skall laddas in i. OBS. Skall inte visas efter det här steget
-Y\<27>\\ Stop. Här kommer ett lagerID också att skickas med (<27> = ESC)
-Y\<254>\\ Clear Canvas. Här kommer ett lagerID också att skickas med, utan det skall allt tömmas
-Y\<213><243>\\ Play. Här kommer ett lagerID också att skickas med
+V\5\13\1\1\Template\0\TabField1\TabField2...\\ Build. Ettan f�re Template indikerar vilket lager den nya templaten skall laddas in i. OBS. Skall inte visas efter det h�r steget
+Y\<27>\\ Stop. H�r kommer ett lagerID ocks� att skickas med (<27> = ESC)
+Y\<254>\\ Clear Canvas. H�r kommer ett lagerID ocks� att skickas med, utan det skall allt t�mmas
+Y\<213><243>\\ Play. H�r kommer ett lagerID ocks� att skickas med
**********************/
CIICommandPtr CIIProtocolStrategy::Create(const std::wstring& name)
{
switch(name[0])
{
- case TEXT('M'): return std::make_shared<MediaCommand>(this);
- case TEXT('W'): return std::make_shared<WriteCommand>(this);
- case TEXT('T'): return std::make_shared<ImagestoreCommand>(this);
- case TEXT('V'): return std::make_shared<MiscellaneousCommand>(this);
- case TEXT('Y'): return std::make_shared<KeydataCommand>(this);
+ case L'M': return std::make_shared<MediaCommand>(this);
+ case L'W': return std::make_shared<WriteCommand>(this);
+ case L'T': return std::make_shared<ImagestoreCommand>(this);
+ case L'V': return std::make_shared<MiscellaneousCommand>(this);
+ case L'Y': return std::make_shared<KeydataCommand>(this);
default: return nullptr;
}
}
if(currentProfile_.size() > 0)
{
fullTemplateFilename += currentProfile_;
- fullTemplateFilename += TEXT("\\");
+ fullTemplateFilename += L"\\";
}
fullTemplateFilename += templateName;
fullTemplateFilename = flash::find_template(fullTemplateFilename);
if(fullTemplateFilename.empty())
{
- CASPAR_LOG(error) << "Failed to save instance of " << templateName << TEXT(" as ") << titleName << TEXT(", template ") << fullTemplateFilename << " not found";
+ CASPAR_LOG(error) << "Failed to save instance of " << templateName << L" as " << titleName << L", template " << fullTemplateFilename << " not found";
return;
}
core::diagnostics::scoped_call_context save;
core::diagnostics::call_context::for_thread().video_channel = 1;
core::diagnostics::call_context::for_thread().layer = 0;
- auto producer = flash::create_producer(this->GetChannel()->frame_factory(), this->GetChannel()->video_format_desc(), { env::template_folder() + TEXT("CG.fth") });
+ auto producer = flash::create_producer(this->GetChannel()->frame_factory(), this->GetChannel()->video_format_desc(), { env::template_folder() + L"CG.fth" });
std::wstringstream flashParam;
- flashParam << TEXT("<invoke name=\"Add\" returntype=\"xml\"><arguments><number>1</number><string>") << currentProfile_ << '/' << templateName << TEXT("</string><number>0</number><true/><string> </string><string><![CDATA[ ") << xmlData << TEXT(" ]]></string></arguments></invoke>");
+ flashParam << L"<invoke name=\"Add\" returntype=\"xml\"><arguments><number>1</number><string>" << currentProfile_ << '/' << templateName << L"</string><number>0</number><true/><string> </string><string><![CDATA[ " << xmlData << L" ]]></string></arguments></invoke>";
std::vector<std::wstring> params;
params.push_back(flashParam.str());
producer->call(std::move(params));
- CASPAR_LOG(info) << "Saved an instance of " << templateName << TEXT(" as ") << titleName ;
+ CASPAR_LOG(info) << "Saved an instance of " << templateName << L" as " << titleName ;
PutPreparedTemplate(titleName, spl::shared_ptr<core::frame_producer>(std::move(producer)));
return result;
}
-void CIIProtocolStrategy::PutPreparedTemplate(const std::wstring& titleName, spl::shared_ptr<core::frame_producer>& pFP)
+void CIIProtocolStrategy::PutPreparedTemplate(const std::wstring& titleName, const spl::shared_ptr<core::frame_producer>& pFP)
{
CASPAR_LOG(debug) << L"Saved title with name " << titleName;
typedef std::list<TitleHolder> TitleList;
TitleList titles_;
spl::shared_ptr<core::frame_producer> GetPreparedTemplate(const std::wstring& name);
- void PutPreparedTemplate(const std::wstring& name, spl::shared_ptr<core::frame_producer>& pframe_producer);
+ void PutPreparedTemplate(const std::wstring& name, const spl::shared_ptr<core::frame_producer>& pframe_producer);
static const wchar_t TokenDelimiter;
static const std::wstring MessageDelimiter;
spl::shared_ptr<core::video_channel> pChannel_;
};
-}}}
\ No newline at end of file
+}}}
*/
-#include "..\stdafx.h"
+#include "../StdAfx.h"
#include "CLKProtocolStrategy.h"
#include "clk_commands.h"
* Author: Helge Norberg, helge.norberg@svt.se\r
*/\r
\r
-#include "../stdafx.h"\r
+#include "../StdAfx.h"\r
\r
#include "clk_command_processor.h"\r
\r
* Author: Helge Norberg, helge.norberg@svt.se\r
*/\r
\r
-#include "../stdafx.h"\r
+#include "../StdAfx.h"\r
\r
#include <stdexcept>\r
#include <sstream>\r
* Author: Helge Norberg, helge.norberg@svt.se
*/
-#include "../stdafx.h"
+#include "../StdAfx.h"
#include "client.h"
* Author: Robert Nagy, ronag89@gmail.com
*/
-#include "..\stdafx.h"
+#include "../StdAfx.h"
#include "AsyncEventServer.h"
#include <boost/thread.hpp>
#include <boost/lexical_cast.hpp>
-#include <tbb\mutex.h>
-#include <tbb\concurrent_hash_map.h>
-#include <tbb\concurrent_queue.h>
+#include <tbb/mutex.h>
+#include <tbb/concurrent_hash_map.h>
+#include <tbb/concurrent_queue.h>
using boost::asio::ip::tcp;
AsyncEventServer::~AsyncEventServer() {}
void AsyncEventServer::add_client_lifecycle_object_factory(const lifecycle_factory_t& factory) { impl_->add_client_lifecycle_object_factory(factory); }
-}}
\ No newline at end of file
+}}
-#include "..\StdAfx.h"
+#include "../StdAfx.h"
#include <tbb/spin_rw_mutex.h>
#include "lock_container.h"
* Author: Helge Norberg, helge.norberg@svt.se\r
*/\r
\r
-#include "../stdafx.h"\r
+#include "../StdAfx.h"\r
\r
#include "strategy_adapters.h"\r
\r
{\r
std::basic_string<CharT> delimiter_;\r
std::basic_string<CharT> input_;\r
- protocol_strategy<CharT>::ptr strategy_;\r
+ typename protocol_strategy<CharT>::ptr strategy_;\r
public:\r
delimiter_based_chunking_strategy(\r
const std::basic_string<CharT>& delimiter, \r
- const protocol_strategy<CharT>::ptr& strategy)\r
+ const typename protocol_strategy<CharT>::ptr& strategy)\r
: delimiter_(delimiter)\r
, strategy_(strategy)\r
{\r
: public protocol_strategy_factory<CharT>\r
{\r
std::basic_string<CharT> delimiter_;\r
- protocol_strategy_factory<CharT>::ptr strategy_factory_;\r
+ typename protocol_strategy_factory<CharT>::ptr strategy_factory_;\r
public:\r
delimiter_based_chunking_strategy_factory(\r
const std::basic_string<CharT>& delimiter, \r
- const protocol_strategy_factory<CharT>::ptr& strategy_factory)\r
+ const typename protocol_strategy_factory<CharT>::ptr& strategy_factory)\r
: delimiter_(delimiter)\r
, strategy_factory_(strategy_factory)\r
{\r
#ifdef _DEBUG
if(env::properties().get(L"configuration.debugging.remote", false))
- MessageBox(nullptr, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST);
+ MessageBox(nullptr, L"Now is the time to connect for remote debugging...", L"Debug", MB_OK | MB_TOPMOST);
#endif
// Start logging to file.
#include <protocol/asio/io_service_manager.h>
#include <protocol/amcp/AMCPProtocolStrategy.h>
#include <protocol/cii/CIIProtocolStrategy.h>
-#include <protocol/CLK/CLKProtocolStrategy.h>
+#include <protocol/clk/CLKProtocolStrategy.h>
#include <protocol/util/AsyncEventServer.h>
#include <protocol/util/strategy_adapters.h>
#include <protocol/osc/client.h>
std::shared_ptr<core::thumbnail_generator> server::get_thumbnail_generator() const {return impl_->thumbnail_generator_; }
core::monitor::subject& server::monitor_output() { return *impl_->monitor_subject_; }
-}
\ No newline at end of file
+}