<ClInclude Include="consumer\ogl\ogl_consumer.h" />\r
<ClInclude Include="format\pixel_format.h" />\r
<ClInclude Include="format\video_format.h" />\r
+ <ClInclude Include="processor\audio_processor.h" />\r
<ClInclude Include="processor\composite_frame.h" />\r
<ClInclude Include="processor\frame_processor_device.h" />\r
- <ClInclude Include="processor\frame_renderer.h" />\r
- <ClInclude Include="processor\frame_shader.h" />\r
+ <ClInclude Include="processor\image_processor.h" />\r
+ <ClInclude Include="processor\image_shader.h" />\r
<ClInclude Include="processor\fwd.h" />\r
<ClInclude Include="processor\draw_frame.h" />\r
<ClInclude Include="processor\read_frame.h" />\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="processor\audio_processor.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="processor\composite_frame.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\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="processor\frame_renderer.cpp">\r
+ <ClCompile Include="processor\image_processor.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="processor\frame_shader.cpp">\r
+ <ClCompile Include="processor\image_shader.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
<Filter Include="Source\channel\processor">\r
<UniqueIdentifier>{53e41831-70b4-4214-bc38-77e0d7aa288b}</UniqueIdentifier>\r
</Filter>\r
- <Filter Include="Source\channel\processor\renderer">\r
- <UniqueIdentifier>{30fe40ca-8bf0-4a46-a882-16d07b2b441e}</UniqueIdentifier>\r
- </Filter>\r
<Filter Include="Source\channel\consumer">\r
<UniqueIdentifier>{35d7835f-f813-4b4b-8d8d-8a35dfef68d3}</UniqueIdentifier>\r
</Filter>\r
<Filter Include="Source\channel\producer\ffmpeg\io">\r
<UniqueIdentifier>{eaa43a39-9ff0-4291-b717-4d4231d8295a}</UniqueIdentifier>\r
</Filter>\r
+ <Filter Include="Source\channel\processor\image">\r
+ <UniqueIdentifier>{30fe40ca-8bf0-4a46-a882-16d07b2b441e}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="Source\channel\processor\audio">\r
+ <UniqueIdentifier>{43ca44bb-d718-44df-9342-1913750f7e41}</UniqueIdentifier>\r
+ </Filter>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="StdAfx.h">\r
<ClInclude Include="processor\frame_processor_device.h">\r
<Filter>Source\channel\processor</Filter>\r
</ClInclude>\r
- <ClInclude Include="processor\frame_shader.h">\r
- <Filter>Source\channel\processor\renderer</Filter>\r
- </ClInclude>\r
- <ClInclude Include="processor\frame_renderer.h">\r
- <Filter>Source\channel\processor\renderer</Filter>\r
- </ClInclude>\r
<ClInclude Include="format\pixel_format.h">\r
<Filter>Source\channel\format</Filter>\r
</ClInclude>\r
<ClInclude Include="processor\draw_frame.h">\r
<Filter>Source\channel\processor\frame</Filter>\r
</ClInclude>\r
+ <ClInclude Include="processor\image_shader.h">\r
+ <Filter>Source\channel\processor\image</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="processor\image_processor.h">\r
+ <Filter>Source\channel\processor\image</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="processor\audio_processor.h">\r
+ <Filter>Source\channel\processor\audio</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="StdAfx.cpp">\r
<ClCompile Include="processor\frame_processor_device.cpp">\r
<Filter>Source\channel\processor</Filter>\r
</ClCompile>\r
- <ClCompile Include="processor\frame_renderer.cpp">\r
- <Filter>Source\channel\processor\renderer</Filter>\r
- </ClCompile>\r
- <ClCompile Include="processor\frame_shader.cpp">\r
- <Filter>Source\channel\processor\renderer</Filter>\r
- </ClCompile>\r
<ClCompile Include="format\video_format.cpp">\r
<Filter>Source\channel\format</Filter>\r
</ClCompile>\r
<ClCompile Include="format\pixel_format.cpp">\r
<Filter>Source\channel\format</Filter>\r
</ClCompile>\r
+ <ClCompile Include="processor\image_shader.cpp">\r
+ <Filter>Source\channel\processor\image</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="processor\image_processor.cpp">\r
+ <Filter>Source\channel\processor\image</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="processor\audio_processor.cpp">\r
+ <Filter>Source\channel\processor\audio</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<Midl Include="consumer\decklink\DeckLinkAPI_v7_3.idl">\r
--- /dev/null
+#include "../stdafx.h"\r
+\r
+#include "audio_processor.h"\r
+\r
+namespace caspar { namespace core {\r
+\r
+}}
\ No newline at end of file
--- /dev/null
+#pragma once\r
+\r
+namespace caspar { namespace core {\r
+\r
+class audio_processor\r
+{\r
+public:\r
+\r
+private:\r
+};\r
+\r
+}}
\ No newline at end of file
#include "draw_frame.h"\r
#include "composite_frame.h"\r
#include "transform_frame.h"\r
-#include "frame_shader.h"\r
+#include "image_shader.h"\r
#include "../../common/utility/singleton_pool.h"\r
\r
#include <boost/range/algorithm.hpp>\r
boost::range::for_each(frames_, std::bind(&draw_frame_decorator::unmap, std::placeholders::_1));\r
}\r
\r
- void draw(frame_shader& shader)\r
+ void draw(image_shader& shader)\r
{\r
boost::range::for_each(frames_, std::bind(&draw_frame_decorator::draw, std::placeholders::_1, std::ref(shader)));\r
}\r
}\r
\r
void composite_frame::unmap(){impl_->unmap();}\r
-void composite_frame::draw(frame_shader& shader){impl_->draw(shader);}\r
+void composite_frame::draw(image_shader& shader){impl_->draw(shader);}\r
const std::vector<short>& composite_frame::audio_data() const {return impl_->audio_data();}\r
\r
safe_ptr<composite_frame> composite_frame::interlace(safe_ptr<draw_frame>&& frame1, safe_ptr<draw_frame>&& frame2, video_mode::type mode)\r
\r
private: \r
virtual void unmap();\r
- virtual void draw(frame_shader& shader);\r
+ virtual void draw(image_shader& shader);\r
\r
struct implementation;\r
std::shared_ptr<implementation> impl_;\r
class draw_frame : boost::noncopyable\r
{ \r
friend struct draw_frame_decorator;\r
- friend class frame_renderer;\r
+ friend class image_processor;\r
public:\r
virtual ~draw_frame(){}\r
\r
return audio_data;\r
}\r
virtual void unmap(){}\r
- virtual void draw(frame_shader&){}\r
+ virtual void draw(image_shader&){}\r
};\r
static safe_ptr<draw_frame> frame = make_safe<eof_frame>();\r
return frame;\r
return audio_data;\r
}\r
virtual void unmap(){}\r
- virtual void draw(frame_shader&){}\r
+ virtual void draw(image_shader&){}\r
};\r
static safe_ptr<draw_frame> frame = make_safe<empty_frame>();\r
return frame;\r
}\r
private:\r
virtual void unmap() = 0;\r
- virtual void draw(frame_shader& shader) = 0;\r
+ virtual void draw(image_shader& shader) = 0;\r
};\r
\r
struct draw_frame_decorator\r
{\r
protected:\r
static void unmap(const safe_ptr<draw_frame>& frame) {frame->unmap();}\r
- static void draw(const safe_ptr<draw_frame>& frame, frame_shader& shader) {frame->draw(shader);}\r
+ static void draw(const safe_ptr<draw_frame>& frame, image_shader& shader) {frame->draw(shader);}\r
};\r
\r
\r
\r
#include "frame_processor_device.h"\r
\r
-#include "frame_renderer.h"\r
+#include "image_processor.h"\r
#include "write_frame.h"\r
#include "read_frame.h"\r
\r
{ \r
output_.set_capacity(3);\r
executor_.start();\r
- executor_.invoke([=]{renderer_.reset(new frame_renderer(format_desc));});\r
+ executor_.invoke([=]{image_processor_.reset(new image_processor(format_desc));});\r
}\r
\r
void send(safe_ptr<draw_frame>&& frame)\r
{ \r
- output_.push(executor_.begin_invoke([=]{return renderer_->render(safe_ptr<draw_frame>(frame));})); // Blocks\r
+ output_.push(executor_.begin_invoke([=]{return image_processor_->render(safe_ptr<draw_frame>(frame));})); // Blocks\r
}\r
\r
safe_ptr<const read_frame> receive()\r
\r
executor executor_; \r
\r
- std::unique_ptr<frame_renderer> renderer_; \r
+ std::unique_ptr<image_processor> image_processor_; \r
\r
tbb::concurrent_bounded_queue<output_type> output_; \r
tbb::concurrent_unordered_map<pixel_format_desc, tbb::concurrent_bounded_queue<std::shared_ptr<write_frame>>, std::hash<pixel_format_desc>> pools_;\r
class transform_frame;\r
class composite_frame;\r
\r
-class frame_shader;\r
-class frame_renderer;\r
+class image_shader;\r
+class image_processor;\r
class frame_processor_device;\r
}}
\ No newline at end of file
#include "../StdAfx.h"\r
\r
-#include "frame_renderer.h"\r
+#include "image_processor.h"\r
\r
-#include "frame_shader.h"\r
+#include "image_shader.h"\r
#include "write_frame.h"\r
#include "read_frame.h"\r
\r
sf::Context context_;\r
};\r
\r
-struct frame_renderer::implementation : boost::noncopyable\r
+struct image_processor::implementation : boost::noncopyable\r
{ \r
implementation(const video_format_desc& format_desc) : shader_(format_desc), format_desc_(format_desc),\r
fbo_(format_desc.width, format_desc.height), writing_(draw_frame::empty()), reading_(create_reading())\r
safe_ptr<const read_frame> render(safe_ptr<draw_frame>&& frame)\r
{ \r
frame->unmap(); // Start transfer from system memory to texture. End with draw in next tick.\r
- \r
+\r
reading_->map(); // Map texture to system memory.\r
auto result = reading_;\r
- \r
+\r
GL(glClear(GL_COLOR_BUFFER_BIT));\r
- \r
+\r
writing_->draw(shader_); // Draw to frame buffer.\r
- writing_ = frame; \r
+ writing_ = frame;\r
\r
reading_ = create_reading();\r
reading_->unmap(); // Start transfer from frame buffer to texture. End with map in next tick.\r
- reading_->audio_data(writing_->audio_data()); \r
+ reading_->audio_data(writing_->audio_data());\r
\r
return result;\r
}\r
\r
tbb::concurrent_bounded_queue<std::shared_ptr<read_frame>> pool_;\r
\r
- safe_ptr<read_frame> reading_; \r
+ safe_ptr<read_frame> reading_;\r
safe_ptr<draw_frame> writing_;\r
- \r
- frame_shader shader_;\r
+\r
+ image_shader shader_;\r
};\r
\r
-frame_renderer::frame_renderer(const video_format_desc& format_desc) : impl_(new implementation(format_desc)){}\r
-safe_ptr<const read_frame> frame_renderer::render(safe_ptr<draw_frame>&& frame){return impl_->render(std::move(frame));}\r
+image_processor::image_processor(const video_format_desc& format_desc) : impl_(new implementation(format_desc)){}\r
+safe_ptr<const read_frame> image_processor::render(safe_ptr<draw_frame>&& frame){return impl_->render(std::move(frame));}\r
}}
\ No newline at end of file
\r
namespace caspar { namespace core {\r
\r
-class frame_renderer : boost::noncopyable\r
+class image_processor : boost::noncopyable\r
{\r
public:\r
- frame_renderer(const video_format_desc& format_desc_);\r
+ image_processor(const video_format_desc& format_desc_);\r
\r
safe_ptr<const read_frame> render(safe_ptr<draw_frame>&& frame);\r
private:\r
struct implementation;\r
std::shared_ptr<implementation> impl_;\r
};\r
-typedef std::shared_ptr<frame_renderer> frame_renderer_ptr;\r
+typedef std::shared_ptr<image_processor> image_processor_ptr;\r
\r
}}
\ No newline at end of file
#include "../StdAfx.h"\r
\r
-#include "frame_shader.h"\r
+#include "image_shader.h"\r
\r
#include "../../common/exception/exceptions.h"\r
#include "../../common/gl/utility.h"\r
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,\r
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff};\r
\r
-struct frame_shader::implementation : boost::noncopyable\r
+struct image_shader::implementation : boost::noncopyable\r
{\r
implementation(const video_format_desc& format_desc) : current_(pixel_format::invalid), alpha_(1.0)\r
{\r
std::unordered_map<pixel_format::type, gl::shader_program> shaders_;\r
};\r
\r
-frame_shader::frame_shader(const video_format_desc& format_desc) : impl_(new implementation(format_desc)){}\r
-void frame_shader::begin(const shader_transform& transform) {impl_->begin(transform);}\r
-void frame_shader::render(const pixel_format_desc& desc){impl_->render(desc);}\r
-void frame_shader::end(){impl_->end();}\r
+image_shader::image_shader(const video_format_desc& format_desc) : impl_(new implementation(format_desc)){}\r
+void image_shader::begin(const shader_transform& transform) {impl_->begin(transform);}\r
+void image_shader::render(const pixel_format_desc& desc){impl_->render(desc);}\r
+void image_shader::end(){impl_->end();}\r
}}
\ No newline at end of file
video_mode::type mode; \r
};\r
\r
-class frame_shader\r
+class image_shader\r
{\r
public:\r
- frame_shader(const video_format_desc& format_desc);\r
+ image_shader(const video_format_desc& format_desc);\r
\r
void begin(const shader_transform& transform);\r
void render(const pixel_format_desc& desc);\r
struct implementation;\r
std::shared_ptr<implementation> impl_;\r
};\r
-typedef std::shared_ptr<frame_shader> frame_shader_ptr;\r
+typedef std::shared_ptr<image_shader> image_shader_ptr;\r
\r
}}
\ No newline at end of file
#include "transform_frame.h"\r
\r
#include "draw_frame.h"\r
-#include "frame_shader.h"\r
+#include "image_shader.h"\r
\r
#include "../format/pixel_format.h"\r
#include "../../common/gl/utility.h"\r
\r
void unmap(){draw_frame_decorator::unmap(frame_);}\r
\r
- void draw(frame_shader& shader)\r
+ void draw(image_shader& shader)\r
{\r
shader.begin(transform_);\r
draw_frame_decorator::draw(frame_, shader);\r
return *this;\r
}\r
void transform_frame::unmap(){impl_->unmap();} \r
-void transform_frame::draw(frame_shader& shader){impl_->draw(shader);}\r
+void transform_frame::draw(image_shader& shader){impl_->draw(shader);}\r
void transform_frame::audio_volume(unsigned char volume){impl_->audio_volume(volume);}\r
void transform_frame::translate(double x, double y){impl_->transform_.pos = boost::make_tuple(x, y);}\r
void transform_frame::texcoord(double left, double top, double right, double bottom){impl_->transform_.uv = boost::make_tuple(left, top, right, bottom);}\r
private:\r
\r
virtual void unmap();\r
- virtual void draw(frame_shader& shader);\r
+ virtual void draw(image_shader& shader);\r
\r
struct implementation;\r
std::shared_ptr<implementation> impl_;\r
#include "write_frame.h"\r
\r
#include "draw_frame.h"\r
-#include "frame_shader.h"\r
+#include "image_shader.h"\r
\r
#include "../format/pixel_format.h"\r
#include "../../common/gl/utility.h"\r
boost::range::for_each(pbos_, std::mem_fn(&gl::pbo::map_write));\r
}\r
\r
- void draw(frame_shader& shader)\r
+ void draw(image_shader& shader)\r
{\r
for(size_t n = 0; n < pbos_.size(); ++n)\r
{\r
}\r
void write_frame::map(){impl_->map();} \r
void write_frame::unmap(){impl_->unmap();} \r
-void write_frame::draw(frame_shader& shader){impl_->draw(shader);}\r
+void write_frame::draw(image_shader& shader){impl_->draw(shader);}\r
boost::iterator_range<unsigned char*> write_frame::pixel_data(size_t index){return impl_->pixel_data(index);}\r
const boost::iterator_range<const unsigned char*> write_frame::pixel_data(size_t index) const {return impl_->pixel_data(index);}\r
std::vector<short>& write_frame::audio_data() { return impl_->audio_data_; }\r
\r
void map();\r
void unmap();\r
- void draw(frame_shader& shader);\r
+ void draw(image_shader& shader);\r
\r
struct implementation;\r
std::shared_ptr<implementation> impl_;\r
~implementation()\r
{ \r
is_running_ = false;\r
- audio_packet_buffer_.clear();\r
- video_packet_buffer_.clear();\r
+ std::shared_ptr<aligned_buffer> buffer;\r
+ audio_packet_buffer_.try_pop(buffer);\r
+ video_packet_buffer_.try_pop(buffer);\r
io_thread_.join();\r
}\r
\r
if(!boost::filesystem::exists(filename))\r
BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(narrow(filename)));\r
\r
- frame_buffer_.set_capacity(3); \r
+ frame_buffer_.set_capacity(3);\r
}\r
\r
~implementation() \r
is_empty_ = true;\r
if(executor_.is_running())\r
{\r
- frame_buffer_.clear();\r
+ std::shared_ptr<draw_frame> frame;\r
+ while(frame_buffer_.try_pop(frame)){}\r
executor_.stop();\r
}\r
}\r
CASPAR_SCOPE_EXIT([=]\r
{ \r
stop();\r
-\r
- frame_buffer_.clear();\r
+ \r
+ std::shared_ptr<draw_frame> frame;\r
+ while(frame_buffer_.try_pop(frame)){}\r
frame_buffer_.try_push(draw_frame::eof()); // EOF\r
\r
current_frame_ = nullptr;\r
is_empty_ = flashax_container_->IsEmpty();\r
}\r
}\r
- \r
+\r
safe_ptr<draw_frame> do_receive()\r
{\r
auto format_desc = frame_processor_->get_video_format_desc();\r
flashax_container_->Tick();\r
invalid_count_ = !flashax_container_->InvalidRectangle() ? std::min(2, invalid_count_+1) : 0;\r
if(current_frame_ == nullptr || invalid_count_ < 2)\r
- { \r
+ {\r
std::fill_n(bmp_frame_->data(), bmp_frame_->size(), 0); \r
flashax_container_->DrawControl(bmp_frame_->hdc());\r
current_frame_ = bmp_frame_;\r
- } \r
+ }\r
\r
auto frame = frame_processor_->create_frame(format_desc.width, format_desc.height);\r
std::copy(current_frame_->data(), current_frame_->data() + current_frame_->size(), frame->pixel_data().begin());\r
return frame;\r
}\r
- \r
+\r
safe_ptr<draw_frame> receive()\r
- { \r
+ {\r
return ((frame_buffer_.try_pop(last_frame_) || !is_empty_) && last_frame_) ? safe_ptr<draw_frame>(last_frame_) : draw_frame::empty();\r
}\r
\r
}\r
\r
CComObject<flash::FlashAxContainer>* flashax_container_;\r
- \r
+\r
tbb::concurrent_bounded_queue<std::shared_ptr<draw_frame>> frame_buffer_;\r
\r
std::shared_ptr<draw_frame> last_frame_;\r
std::wstring filename = server::media_folder() + L"\\" + params[0];\r
\r
auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
- { \r
+ {\r
return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
});\r
\r
</paths>\r
<channels>\r
<channel>\r
- <videomode>1080p2500</videomode>\r
+ <videomode>720p5000</videomode>\r
<consumers>\r
<ogl>\r
- <device>1</device>\r
+ <device>0</device>\r
<stretch>uniform</stretch>\r
<windowed>true</windowed>\r
</ogl>\r