#include <common/env.h>\r
#include <common/concurrency/com_context.h>\r
#include <common/diagnostics/graph.h>\r
-#include <common/memory/memcpy.h>\r
-#include <common/memory/memclr.h>\r
#include <common/utility/timer.h>\r
\r
#include <boost/filesystem.hpp>\r
memset(&info, 0, sizeof(BITMAPINFO));\r
info.bmiHeader.biBitCount = 32;\r
info.bmiHeader.biCompression = BI_RGB;\r
- info.bmiHeader.biHeight = -height;\r
+ info.bmiHeader.biHeight = static_cast<LONG>(-height);\r
info.bmiHeader.biPlanes = 1;\r
info.bmiHeader.biSize = sizeof(BITMAPINFO);\r
- info.bmiHeader.biWidth = width;\r
+ info.bmiHeader.biWidth = static_cast<LONG>(width);\r
\r
bmp_.reset(CreateDIBSection(static_cast<HDC>(hdc_.get()), &info, DIB_RGB_COLORS, reinterpret_cast<void**>(&bmp_data_), 0, 0), DeleteObject);\r
SelectObject(static_cast<HDC>(hdc_.get()), bmp_.get()); \r
{\r
std::wstring video_mode;\r
std::wstring filename;\r
- size_t width;\r
- size_t height;\r
+ int width;\r
+ int height;\r
};\r
\r
template_host get_template_host(const core::video_format_desc& desc)\r
template_host template_host;\r
template_host.filename = L"cg.fth";\r
\r
- for(auto it = boost::filesystem2::wdirectory_iterator(env::template_folder()); it != boost::filesystem2::wdirectory_iterator(); ++it)\r
+ for(auto it = boost::filesystem::directory_iterator(env::template_folder()); it != boost::filesystem::directory_iterator(); ++it)\r
{\r
- if(boost::iequals(it->path().extension(), L"." + desc.name))\r
+ if(boost::iequals(it->path().extension().wstring(), L"." + desc.name))\r
{\r
- template_host.filename = it->filename();\r
+ template_host.filename = it->path().filename().wstring();\r
break;\r
}\r
}\r
\r
high_prec_timer timer_;\r
\r
- const size_t width_;\r
- const size_t height_;\r
+ const int width_;\r
+ const int height_;\r
\r
public:\r
flash_renderer(const safe_ptr<diagnostics::graph>& graph, const std::shared_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, int width, int height) \r
graph_->set_color("skip-sync", diagnostics::color(0.8f, 0.3f, 0.2f)); \r
\r
if(FAILED(CComObject<caspar::flash::FlashAxContainer>::CreateInstance(&ax_)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to create FlashAxContainer"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to create FlashAxContainer"));\r
\r
ax_->set_print([this]{return L"flash_renderer";});\r
\r
if(FAILED(ax_->CreateAxControl()))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Create FlashAxControl"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to Create FlashAxControl"));\r
\r
CComPtr<IShockwaveFlash> spFlash;\r
if(FAILED(ax_->QueryControl(&spFlash)))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Query FlashAxControl"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to Query FlashAxControl"));\r
\r
if(FAILED(spFlash->put_Playing(true)) )\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to start playing Flash"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to start playing Flash"));\r
\r
if(FAILED(spFlash->put_Movie(CComBSTR(filename.c_str()))))\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Load Template Host"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to Load Template Host"));\r
\r
if(FAILED(spFlash->put_ScaleMode(2))) //Exact fit. Scale without respect to the aspect ratio.\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to Set Scale Mode"));\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << wmsg_info(print() + L" Failed to Set Scale Mode"));\r
\r
ax_->SetSize(width_, height_); \r
\r
std::wstring result;\r
\r
if(!ax_->FlashCall(param, result))\r
- CASPAR_LOG(warning) << print() << L" Flash call failed:" << param;//BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Flash function call failed.") << arg_name_info("param") << arg_value_info(narrow(param)));\r
+ CASPAR_LOG(warning) << print() << L" Flash call failed:" << param;//BOOST_THROW_EXCEPTION(invalid_operation() << wmsg_info("Flash function call failed.") << arg_name_info("param") << arg_value_info(u8(param)));\r
graph_->add_tag("param");\r
\r
return result;\r
{\r
float frame_time = 1.0f/ax_->GetFPS();\r
\r
- graph_->update_value("tick-time", static_cast<float>(tick_timer_.elapsed()/frame_time)*0.5f);\r
+ graph_->update_value("tick-time", (tick_timer_.elapsed()/frame_time)*0.5f);\r
tick_timer_.restart();\r
\r
if(ax_->IsEmpty())\r
ax_->Tick();\r
if(ax_->InvalidRect())\r
{ \r
- fast_memclr(bmp_.data(), width_*height_*4);\r
+ memset(bmp_.data(), 0, width_*height_*4);\r
ax_->DrawControl(bmp_);\r
\r
core::pixel_format_desc desc;\r
desc.planes.push_back(core::pixel_format_desc::plane(width_, height_, 4));\r
auto frame = frame_factory_->create_frame(this, desc);\r
\r
- fast_memcpy(frame->image_data().begin(), bmp_.data(), width_*height_*4);\r
+ memcpy(frame->image_data().begin(), bmp_.data(), width_*height_*4);\r
frame->commit();\r
head_ = frame;\r
} \r
\r
std::wstring print()\r
{\r
- return L"flash[" + boost::filesystem::wpath(filename_).filename() + L"]"; \r
+ return L"flash[" + boost::filesystem::path(filename_).filename().wstring() + L"]"; \r
}\r
};\r
\r
struct flash_producer : public core::frame_producer\r
{ \r
- const std::wstring filename_; \r
- const safe_ptr<core::frame_factory> frame_factory_;\r
+ const std::wstring filename_; \r
+ const safe_ptr<core::frame_factory> frame_factory_;\r
\r
- tbb::atomic<int> fps_;\r
+ tbb::atomic<int> fps_;\r
\r
safe_ptr<diagnostics::graph> graph_;\r
\r
- tbb::concurrent_bounded_queue<safe_ptr<core::basic_frame>> frame_buffer_;\r
+ tbb::concurrent_bounded_queue<safe_ptr<core::basic_frame>> frame_buffer_;\r
\r
- mutable tbb::spin_mutex last_frame_mutex_;\r
- safe_ptr<core::basic_frame> last_frame_;\r
- \r
- com_context<flash_renderer> context_; \r
+ mutable tbb::spin_mutex last_frame_mutex_;\r
+ safe_ptr<core::basic_frame> last_frame_;\r
+ \r
+ int width_;\r
+ int height_;\r
+\r
+ com_context<flash_renderer> context_; \r
\r
- int width_;\r
- int height_;\r
public:\r
- flash_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, size_t width, size_t height) \r
+ flash_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, int width, int height) \r
: filename_(filename) \r
, frame_factory_(frame_factory)\r
- , context_(L"flash_producer")\r
, last_frame_(core::basic_frame::empty())\r
, width_(width > 0 ? width : frame_factory->get_video_format_desc().width)\r
, height_(height > 0 ? height : frame_factory->get_video_format_desc().height)\r
+ , context_(L"flash_producer")\r
{ \r
if(!boost::filesystem::exists(filename))\r
- BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(narrow(filename))); \r
+ BOOST_THROW_EXCEPTION(file_not_found() << werr_file_name_info(filename)); \r
\r
fps_ = 0;\r
\r
\r
virtual std::wstring print() const override\r
{ \r
- return L"flash[" + boost::filesystem::wpath(filename_).filename() + L"|" + boost::lexical_cast<std::wstring>(fps_) + L"]"; \r
+ return L"flash[" + boost::filesystem::wpath(filename_).filename().wstring() + L"|" + boost::lexical_cast<std::wstring>(fps_) + L"]"; \r
} \r
\r
virtual boost::property_tree::wptree info() const override\r
\r
graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity())); \r
fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0)); \r
- graph_->set_text(narrow(print()));\r
+ graph_->set_text(print());\r
\r
render(renderer);\r
}\r