<ClInclude Include="producer\ffmpeg\input.h" />\r
<ClInclude Include="producer\ffmpeg\video\video_decoder.h" />\r
<ClInclude Include="producer\flash\axflash.h" />\r
- <ClInclude Include="producer\flash\bitmap.h" />\r
<ClInclude Include="producer\flash\cg_producer.h" />\r
<ClInclude Include="producer\flash\ct_producer.h" />\r
<ClInclude Include="producer\flash\FlashAxContainer.h" />\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
- <ClCompile Include="producer\flash\bitmap.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../stdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../stdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
<ClCompile Include="producer\flash\cg_producer.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../stdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../stdAfx.h</PrecompiledHeaderFile>\r
<ClInclude Include="consumer\frame_consumer.h">\r
<Filter>Source\channel\consumer</Filter>\r
</ClInclude>\r
- <ClInclude Include="producer\flash\bitmap.h">\r
- <Filter>Source\channel\producer\flash</Filter>\r
- </ClInclude>\r
<ClInclude Include="consumer\frame_consumer_device.h">\r
<Filter>Source\channel\consumer</Filter>\r
</ClInclude>\r
<ClCompile Include="consumer\bluefish\bluefish_consumer.cpp">\r
<Filter>Source\channel\consumer\bluefish</Filter>\r
</ClCompile>\r
- <ClCompile Include="producer\flash\bitmap.cpp">\r
- <Filter>Source\channel\producer\flash</Filter>\r
- </ClCompile>\r
<ClCompile Include="consumer\frame_consumer_device.cpp">\r
<Filter>Source\channel\consumer</Filter>\r
</ClCompile>\r
#include <common/concurrency/executor.h>\r
\r
#include <Glee.h>\r
-#include <SFML/Window.hpp>\r
-\r
-#include <boost/noncopyable.hpp>\r
-\r
+#include <SFML/Window/Context.hpp>\r
#include <unordered_map>\r
\r
namespace caspar { namespace core {\r
return image_transform(*this) *= other;\r
}\r
\r
-struct image_processor::implementation\r
+struct image_processor::implementation : boost::noncopyable\r
{ \r
implementation(const video_format_desc& format_desc) : format_desc_(format_desc)\r
{\r
\r
#include <boost/tuple/tuple.hpp>\r
#include <boost/thread/future.hpp>\r
+#include <boost/noncopyable.hpp>\r
\r
#include <memory>\r
#include <array>\r
\r
struct pixel_format_desc;\r
\r
-struct image_transform\r
+struct image_transform \r
{\r
image_transform() : alpha(1.0), pos(boost::make_tuple(0.0, 0.0)), uv(boost::make_tuple(0.0, 0.0, 0.0, 0.0)), mode(video_mode::invalid){}\r
double alpha;\r
const image_transform operator*(const image_transform &other) const;\r
};\r
\r
-class image_processor\r
+class image_processor : boost::noncopyable\r
{\r
public:\r
image_processor(const video_format_desc& format_desc);\r
\r
#include "audio_decoder.h"\r
\r
-#include <queue>\r
-#include <deque>\r
-\r
-#include <tbb/cache_aligned_allocator.h>\r
- \r
#if defined(_MSC_VER)\r
#pragma warning (push)\r
#pragma warning (disable : 4244)\r
\r
#include "ffmpeg_producer.h"\r
\r
-#if defined(_MSC_VER)\r
-#pragma warning (push)\r
-#pragma warning (disable : 4244)\r
-#endif\r
-\r
-extern "C" \r
-{\r
- #define __STDC_CONSTANT_MACROS\r
- #define __STDC_LIMIT_MACROS\r
- #include <libavcodec/avcodec.h>\r
- #include <libavformat/avformat.h>\r
- #include <libavutil/avutil.h>\r
- #include <libswscale/swscale.h>\r
-}\r
-\r
-#if defined(_MSC_VER)\r
-#pragma warning (pop)\r
-#endif\r
-\r
#include "input.h"\r
-\r
#include "audio/audio_decoder.h"\r
#include "video/video_decoder.h"\r
-#include "video/video_decoder.h"\r
\r
#include "../../format/video_format.h"\r
#include "../../processor/draw_frame.h"\r
-#include "../../processor/draw_frame.h"\r
\r
-#include <tbb/mutex.h>\r
#include <tbb/parallel_invoke.h>\r
-#include <tbb/task_group.h>\r
-\r
-#include <boost/algorithm/string/case_conv.hpp>\r
-#include <boost/lexical_cast.hpp>\r
-#include <boost/thread.hpp>\r
-#include <boost/thread/once.hpp>\r
\r
#include <deque>\r
\r
\r
namespace caspar { namespace core { namespace ffmpeg{\r
\r
-struct ffmpeg_producer_impl\r
+struct ffmpeg_producer : public frame_producer\r
{\r
public:\r
- ffmpeg_producer_impl(const std::wstring& filename, const std::vector<std::wstring>& params) : filename_(filename), last_frame_(draw_frame(draw_frame::empty())),\r
+ ffmpeg_producer(const std::wstring& filename, const std::vector<std::wstring>& params) : filename_(filename), last_frame_(draw_frame(draw_frame::empty())),\r
input_(filename), video_decoder_(input_.get_video_codec_context().get()), audio_decoder_(input_.get_audio_codec_context().get())\r
{ \r
input_.set_loop(std::find(params.begin(), params.end(), L"LOOP") != params.end());\r
\r
while(!video_frame_channel_.empty() && (!audio_chunk_channel_.empty() || input_.get_audio_codec_context() == nullptr))\r
{\r
- std::vector<short> audio_data;\r
if(input_.get_audio_codec_context() != nullptr) \r
{\r
- audio_data = std::move(audio_chunk_channel_.front());\r
+ video_frame_channel_.front()->audio_data() = std::move(audio_chunk_channel_.front());\r
audio_chunk_channel_.pop_front();\r
}\r
\r
- auto write = std::move(video_frame_channel_.front());\r
- write->audio_data() = std::move(audio_data);\r
- auto transform = draw_frame(write);\r
+ ouput_channel_.push(video_frame_channel_.front());\r
video_frame_channel_.pop_front();\r
- \r
- // TODO: Make generic for all formats and modes.\r
- if(input_.get_video_codec_context()->codec_id == CODEC_ID_DVVIDEO) // Move up one field \r
- transform.translate(0.0f, 1.0/static_cast<double>(format_desc_.height)); \r
- \r
- ouput_channel_.push(std::move(transform));\r
} \r
\r
if(ouput_channel_.empty() && video_packet.empty() && audio_packet.empty()) \r
video_format_desc format_desc_;\r
};\r
\r
-class ffmpeg_producer : public frame_producer\r
-{\r
-public:\r
- ffmpeg_producer(const std::wstring& filename, const std::vector<std::wstring>& params) : impl_(new ffmpeg_producer_impl(filename, params)){}\r
- ffmpeg_producer(ffmpeg_producer&& other) : impl_(std::move(other.impl_)){}\r
- virtual safe_ptr<draw_frame> receive(){return impl_->receive();}\r
- virtual void initialize(const safe_ptr<frame_processor_device>& frame_processor){impl_->initialize(frame_processor);}\r
- virtual std::wstring print() const{return impl_->print();}\r
-private:\r
- std::shared_ptr<ffmpeg_producer_impl> impl_;\r
-};\r
-\r
safe_ptr<frame_producer> create_ffmpeg_producer(const std::vector<std::wstring>& params)\r
{ \r
static const std::vector<std::wstring> extensions = list_of(L"mpg")(L"avi")(L"mov")(L"dv")(L"wav")(L"mp3")(L"mp4")(L"f4v")(L"flv");\r
\r
if(ext == extensions.end())\r
return frame_producer::empty();\r
- \r
- static boost::once_flag av_register_all_flag = BOOST_ONCE_INIT;\r
- boost::call_once(av_register_all, av_register_all_flag); \r
- \r
- static boost::once_flag avcodec_init_flag = BOOST_ONCE_INIT;\r
- boost::call_once(avcodec_init, avcodec_init_flag); \r
\r
return make_safe<ffmpeg_producer>(filename + L"." + *ext, params);\r
}\r
#include <tbb/queuing_mutex.h>\r
\r
#include <boost/exception/error_info.hpp>\r
-#include <boost/utility/value_init.hpp>\r
+#include <boost/thread/once.hpp>\r
\r
#include <errno.h>\r
#include <system_error>\r
static const size_t BUFFER_SIZE = 2 << 25;\r
\r
implementation(const std::wstring& filename) : video_s_index_(-1), audio_s_index_(-1), filename_(filename)\r
- {\r
+ { \r
+ static boost::once_flag av_register_all_flag = BOOST_ONCE_INIT;\r
+ boost::call_once(av_register_all, av_register_all_flag); \r
+ \r
+ static boost::once_flag avcodec_init_flag = BOOST_ONCE_INIT;\r
+ boost::call_once(avcodec_init, avcodec_init_flag); \r
+\r
loop_ = false; \r
\r
int errn;\r
});\r
});\r
\r
- return std::move(write);\r
+ // TODO: Make generic for all formats and modes.\r
+ if(codec_context_->codec_id == CODEC_ID_DVVIDEO) // Move up one field \r
+ write->translate(0.0f, 1.0/static_cast<double>(height_));\r
+\r
+ return write;\r
}\r
else\r
{\r
avpicture_fill(reinterpret_cast<AVPicture*>(&av_frame), write->image_data().begin(), PIX_FMT_BGRA, width_, height_);\r
\r
sws_scale(sws_context_.get(), decoded_frame->data, decoded_frame->linesize, 0, height_, av_frame.data, av_frame.linesize); \r
- \r
- return std::move(write);\r
+ \r
+ // TODO: Make generic for all formats and modes.\r
+ if(codec_context_->codec_id == CODEC_ID_DVVIDEO) // Move up one field \r
+ write->translate(0.0f, 1.0/static_cast<double>(height_));\r
+\r
+ return write;\r
} \r
}\r
\r
+++ /dev/null
-/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
-*\r
-* This file is part of CasparCG.\r
-*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-*/\r
- \r
-#include "../../StdAfx.h"\r
-\r
-#include "bitmap.h"\r
-\r
-#include <windows.h>\r
-\r
-namespace caspar { namespace core {\r
- \r
-struct bitmap::implementation : boost::noncopyable\r
-{\r
- implementation(size_t width, size_t height) \r
- : size_(width*height*4), width_(width), height_(height), hdc_(CreateCompatibleDC(nullptr)), bitmap_handle_(nullptr)\r
- { \r
- if(hdc_ == nullptr)\r
- throw std::bad_alloc();\r
- \r
- BITMAPINFO bitmapInfo;\r
- bitmapInfo.bmiHeader.biBitCount = 32;\r
- bitmapInfo.bmiHeader.biClrImportant = 0;\r
- bitmapInfo.bmiHeader.biClrUsed = 0;\r
- bitmapInfo.bmiHeader.biCompression = BI_RGB;\r
-#ifdef _MSC_VER\r
- #pragma warning(disable:4146)\r
-#endif\r
- bitmapInfo.bmiHeader.biHeight = -height;\r
-#ifdef _MSC_VER\r
- #pragma warning(default:4146)\r
-#endif\r
- bitmapInfo.bmiHeader.biPlanes = 1;\r
- bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO);\r
- bitmapInfo.bmiHeader.biWidth = width;\r
- bitmapInfo.bmiHeader.biSizeImage = 0;\r
- bitmapInfo.bmiHeader.biXPelsPerMeter = 0;\r
- bitmapInfo.bmiHeader.biYPelsPerMeter = 0;\r
-\r
- bitmap_handle_ = CreateDIBSection(hdc_, &bitmapInfo, DIB_RGB_COLORS, reinterpret_cast<void**>(&bitmap_data_), NULL, 0);\r
- SelectObject(hdc_, bitmap_handle_); \r
- }\r
- \r
- ~implementation()\r
- {\r
- if(bitmap_handle_ != nullptr) \r
- DeleteObject(bitmap_handle_);\r
- if(hdc_ != nullptr)\r
- DeleteDC(hdc_);\r
- }\r
- \r
- const size_t size_;\r
- const size_t width_;\r
- const size_t height_;\r
- unsigned char* bitmap_data_;\r
- HDC hdc_;\r
- HBITMAP bitmap_handle_;\r
-};\r
-\r
-bitmap::bitmap(size_t width, size_t height) : impl_(new implementation(width, height)){}\r
-size_t bitmap::size() const { return impl_->size_; }\r
-size_t bitmap::width() const { return impl_->width_; }\r
-size_t bitmap::height() const { return impl_->height_; }\r
-unsigned char* bitmap::data() { return impl_->bitmap_data_; }\r
-HDC bitmap::hdc() { return impl_->hdc_; }\r
-\r
-}}
\ No newline at end of file
+++ /dev/null
-/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
-*\r
-* This file is part of CasparCG.\r
-*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-*/\r
-#pragma once\r
-\r
-#include <memory>\r
-\r
-namespace caspar { namespace core {\r
-\r
-class bitmap\r
-{\r
-public:\r
- bitmap(size_t width, size_t height);\r
-\r
- unsigned char* data();\r
- size_t size() const; \r
- size_t width() const;\r
- size_t height() const;\r
- HDC hdc();\r
-private:\r
- struct implementation;\r
- std::shared_ptr<implementation> impl_;\r
-};\r
-\r
-}}\r
-\r
#include "flash_producer.h"\r
#include "FlashAxContainer.h"\r
#include "TimerHelper.h"\r
-#include "bitmap.h"\r
\r
#include "../../format/video_format.h"\r
\r
\r
#include <boost/filesystem.hpp>\r
\r
-#include <type_traits>\r
-\r
namespace caspar { namespace core { namespace flash {\r
\r
// NOTE: This is needed in order to make CComObject work since this is not a real ATL project.\r
public:\r
flash_renderer(const safe_ptr<frame_processor_device>& frame_processor, const std::wstring& filename) \r
: last_frame_(draw_frame::empty()), current_frame_(draw_frame::empty()), frame_processor_(frame_processor), filename_(filename),\r
- format_desc_(frame_processor->get_video_format_desc()), bmp_frame_(format_desc_.width, format_desc_.height)\r
+ hdc_(CreateCompatibleDC(0), DeleteDC), format_desc_(frame_processor->get_video_format_desc())\r
\r
{\r
CASPAR_LOG(info) << print() << L" Started";\r
\r
if(FAILED(spFlash->put_Movie(CComBSTR(filename.c_str()))))\r
BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(bprint() + "Failed to Load Template Host"));\r
- \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(bprint() + "Failed to Set Scale Mode"));\r
\r
if(FAILED(ax_->SetFormat(frame_processor_->get_video_format_desc()))) // stop if failed\r
BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(bprint() + "Failed to Set Format"));\r
+\r
+ BITMAPINFO info;\r
+ memset(&info, 0, sizeof(BITMAPINFO));\r
+ info.bmiHeader.biBitCount = 32;\r
+ info.bmiHeader.biCompression = BI_RGB;\r
+#ifdef _MSC_VER\r
+ #pragma warning(disable:4146)\r
+#endif\r
+ info.bmiHeader.biHeight = -format_desc_.height;\r
+#ifdef _MSC_VER\r
+ #pragma warning(default:4146)\r
+#endif\r
+ info.bmiHeader.biPlanes = 1;\r
+ info.bmiHeader.biSize = sizeof(BITMAPINFO);\r
+ info.bmiHeader.biWidth = format_desc_.width;\r
+\r
+ bmp_.reset(CreateDIBSection((HDC)hdc_.get(), &info, DIB_RGB_COLORS, reinterpret_cast<void**>(&bmp_data_), 0, 0), DeleteObject);\r
+ SelectObject((HDC)hdc_.get(), bmp_.get()); \r
}\r
\r
~flash_renderer()\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
}\r
-\r
+ \r
::OleUninitialize();\r
CASPAR_LOG(info) << print() << L" Ended";\r
}\r
\r
if(ax_->IsReadyToRender() && ax_->InvalidRectangle())\r
{\r
- std::fill_n(bmp_frame_.data(), bmp_frame_.size(), 0); \r
- ax_->DrawControl(bmp_frame_.hdc());\r
+ std::fill_n(bmp_data_, format_desc_.size, 0); \r
+ //ax_->DrawControl((HDC)hdc_.get());\r
\r
auto frame = frame_processor_->create_frame();\r
- std::copy(bmp_frame_.data(), bmp_frame_.data() + bmp_frame_.size(), frame->image_data().begin());\r
+ std::copy_n(bmp_data_, format_desc_.size, frame->image_data().begin());\r
current_frame_ = frame;\r
}\r
return current_frame_;\r
const std::wstring filename_;\r
const safe_ptr<frame_processor_device> frame_processor_;\r
const video_format_desc format_desc_;\r
- bitmap bmp_frame_; \r
+ \r
+ unsigned char* bmp_data_;\r
+ \r
+ std::shared_ptr<void> hdc_;\r
+ std::shared_ptr<void> bmp_;\r
\r
CComPtr<FlashAxContainer> ax_;\r
tbb::concurrent_bounded_queue<std::shared_ptr<draw_frame>> frame_buffer_; \r
});\r
}\r
\r
- safe_ptr<draw_frame> receive()\r
+ virtual safe_ptr<draw_frame> receive()\r
{\r
auto frame = draw_frame::empty();\r
if(renderer_ && renderer_->try_pop(frame)) // Only render again if frame was removed from buffer. \r
return frame;\r
}\r
\r
- void render_frame()\r
+ virtual void render_frame()\r
{\r
try\r
{\r
}\r
}\r
\r
- void initialize(const safe_ptr<frame_processor_device>& frame_processor)\r
+ virtual void initialize(const safe_ptr<frame_processor_device>& frame_processor)\r
{\r
factory_ = [=]{return new flash_renderer(frame_processor, filename_);};\r
}\r
</paths>\r
<channels>\r
<channel>\r
- <videomode>1080i5000</videomode>\r
+ <videomode>PAL</videomode>\r
<consumers>\r
<ogl>\r
<device>1</device>\r
else if(wcmd.substr(0, 1) == L"4")\r
wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" WIPE 100 LOOP AUTOPLAY";\r
else if(wcmd.substr(0, 1) == L"5")\r
- wcmd = L"LOADBG 1-1 " + wcmd.substr(1, wcmd.length()-1) + L" LOOP AUTOPLAY";\r
+ wcmd = L"LOADBG 1-2 " + wcmd.substr(1, wcmd.length()-1) + L" LOOP AUTOPLAY";\r
else if(wcmd.substr(0, 1) == L"6")\r
wcmd = L"CG 1-2 ADD 1 BBTELEFONARE 1";\r
else if(wcmd.substr(0, 1) == L"7")\r
<None Include="caspar.config">\r
<SubType>Designer</SubType>\r
</None>\r
+ <None Include="My Amplifier Results\r003hs\r003hs.ampl" />\r
<None Include="My Amplifier Results\r006hs\r006hs.ampl" />\r
<None Include="My Amplifier Results\r007cc\r007cc.ampl" />\r
<None Include="My Amplifier Results\r008lw\r008lw.ampl" />\r
<None Include="My Amplifier Results\r009hs\r009hs.ampl">\r
<Filter>My Amplifier Results</Filter>\r
</None>\r
+ <None Include="My Amplifier Results\r003hs\r003hs.ampl">\r
+ <Filter>My Amplifier Results</Filter>\r
+ </None>\r
</ItemGroup>\r
<ItemGroup>\r
<Filter Include="My Amplifier Results">\r