<ClInclude Include="frame\frame_transform.h" />\r
<ClInclude Include="frame\frame_visitor.h" />\r
<ClInclude Include="frame\pixel_format.h" />\r
+ <ClInclude Include="frame\write_frame.h" />\r
<ClInclude Include="mixer\audio\audio_util.h" />\r
<ClInclude Include="mixer\gpu\device_buffer.h" />\r
<ClInclude Include="mixer\gpu\host_buffer.h" />\r
<ClInclude Include="consumer\cadence_guard.h">\r
<Filter>source\consumer</Filter>\r
</ClInclude>\r
+ <ClInclude Include="frame\write_frame.h">\r
+ <Filter>source\frame</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="producer\transition\transition_producer.cpp">\r
{\r
virtual ~frame_factory(){}\r
\r
- virtual spl::shared_ptr<class write_frame> create_frame(const void* video_stream_tag, const struct pixel_format_desc& desc) = 0; \r
+ virtual spl::shared_ptr<struct write_frame> create_frame(const void* video_stream_tag, const struct pixel_format_desc& desc) = 0; \r
virtual struct video_format_desc get_video_format_desc() const = 0; // nothrow\r
};\r
\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#pragma once\r
+\r
+#include "data_frame.h"\r
+#include "draw_frame.h"\r
+\r
+namespace caspar { namespace core {\r
+ \r
+struct write_frame : public draw_frame, public data_frame\r
+{\r
+};\r
+\r
+\r
+}}
\ No newline at end of file
#include <common/gl/gl_check.h>\r
#include <common/concurrency/async.h>\r
\r
+#include <core/frame/write_frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/pixel_format.h>\r
#include <core/video_format.h>\r
if(frame == nullptr)\r
return;\r
\r
+ if(frame->get_pixel_format_desc().format == core::pixel_format::invalid)\r
+ return;\r
+\r
item item;\r
item.pix_desc = frame->get_pixel_format_desc();\r
\r
{\r
return renderer_(std::move(layers_), format_desc);\r
}\r
+ \r
+ virtual spl::shared_ptr<gpu::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc)\r
+ {\r
+ return spl::make_shared<gpu::write_frame>(ogl_, tag, desc);\r
+ }\r
};\r
\r
image_mixer::image_mixer(const spl::shared_ptr<accelerator>& ogl) : impl_(new impl(ogl)){}\r
boost::unique_future<boost::iterator_range<const uint8_t*>> image_mixer::operator()(const video_format_desc& format_desc){return impl_->render(format_desc);}\r
void image_mixer::begin_layer(blend_mode blend_mode){impl_->begin_layer(blend_mode);}\r
void image_mixer::end_layer(){impl_->end_layer();}\r
+spl::shared_ptr<core::write_frame> image_mixer::create_frame(const void* tag, const pixel_format_desc& desc) {return impl_->create_frame(tag, desc);}\r
\r
}}}
\ No newline at end of file
#include <core/frame/frame_visitor.h>\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
+FORWARD2(caspar, core, struct write_frame);\r
+FORWARD2(caspar, core, struct pixel_format_desc);\r
\r
namespace caspar { namespace core { namespace gpu {\r
\r
// NOTE: Content of return future is only valid while future is valid.\r
virtual boost::unique_future<boost::iterator_range<const uint8_t*>> operator()(const struct video_format_desc& format_desc) override;\r
\r
+ virtual spl::shared_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc) override;\r
private:\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
\r
#include <boost/lexical_cast.hpp>\r
\r
-namespace caspar { namespace core {\r
+namespace caspar { namespace core { namespace gpu {\r
\r
struct write_frame::impl : boost::noncopyable\r
{ \r
, desc_(desc)\r
, tag_(tag)\r
{\r
- std::transform(desc.planes.begin(), desc.planes.end(), std::back_inserter(buffers_), [&](const core::pixel_format_desc::plane& plane)\r
+ if(desc.format != core::pixel_format::invalid)\r
{\r
- return ogl_->create_host_buffer(plane.size, gpu::host_buffer::usage::write_only);\r
- });\r
+ std::transform(desc.planes.begin(), desc.planes.end(), std::back_inserter(buffers_), [&](const core::pixel_format_desc::plane& plane)\r
+ {\r
+ return ogl_->create_host_buffer(plane.size, gpu::host_buffer::usage::write_only);\r
+ });\r
+ }\r
}\r
\r
void accept(write_frame& self, core::frame_visitor& visitor)\r
const void* write_frame::tag() const{return impl_->tag_;} \r
std::vector<spl::shared_ptr<gpu::host_buffer>> write_frame::get_buffers(){return impl_->buffers_;}\r
\r
-\r
-}}
\ No newline at end of file
+}}}
\ No newline at end of file
#include <common/spl/memory.h>\r
#include <common/forward.h>\r
\r
-#include <core/frame/draw_frame.h>\r
-#include <core/frame/data_frame.h>\r
+#include <core/frame/write_frame.h>\r
#include <core/video_format.h>\r
#include <core/mixer/audio/audio_mixer.h>\r
\r
FORWARD3(caspar, core, gpu, class accelerator);\r
FORWARD3(caspar, core, gpu, class host_buffer);\r
\r
-namespace caspar { namespace core {\r
+namespace caspar { namespace core { namespace gpu {\r
\r
-class write_frame sealed : public core::draw_frame, public core::data_frame\r
+class write_frame sealed : public core::write_frame\r
{\r
write_frame(const write_frame&);\r
write_frame& operator=(const write_frame);\r
spl::shared_ptr<impl> impl_;\r
};\r
\r
-\r
-}}
\ No newline at end of file
+}}}
\ No newline at end of file
#include <core/frame/frame_visitor.h>\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
+FORWARD2(caspar, core, struct write_frame);\r
+FORWARD2(caspar, core, struct pixel_format_desc);\r
\r
namespace caspar { namespace core {\r
\r
virtual void end_layer() = 0;\r
\r
virtual boost::unique_future<boost::iterator_range<const uint8_t*>> operator()(const struct video_format_desc& format_desc) = 0;\r
+ virtual spl::shared_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc) = 0;\r
};\r
\r
}}
\ No newline at end of file
void mixer::set_blend_mode(int index, blend_mode value){impl_->set_blend_mode(index, value);}\r
boost::unique_future<boost::property_tree::wptree> mixer::info() const{return impl_->info();}\r
spl::shared_ptr<const data_frame> mixer::operator()(std::map<int, spl::shared_ptr<draw_frame>> frames, const struct video_format_desc& format_desc){return (*impl_)(std::move(frames), format_desc);}\r
+spl::shared_ptr<write_frame> mixer::create_frame(const void* tag, const core::pixel_format_desc& desc) {return impl_->image_mixer_->create_frame(tag, desc);}\r
}}
\ No newline at end of file
FORWARD1(boost, template<typename> class unique_future);\r
FORWARD2(caspar, diagnostics, class graph);\r
FORWARD3(caspar, core, gpu, class accelerator);\r
+FORWARD2(caspar, core, struct write_frame);\r
+FORWARD2(caspar, core, struct pixel_format_desc);\r
\r
namespace caspar { namespace core {\r
\r
void set_blend_mode(int index, blend_mode value);\r
\r
boost::unique_future<boost::property_tree::wptree> info() const;\r
+\r
+ spl::shared_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc);\r
private:\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
namespace caspar { namespace core {\r
\r
spl::shared_ptr<struct frame_producer> create_color_producer(const spl::shared_ptr<struct frame_factory>& frame_factory, const std::vector<std::wstring>& params);\r
-spl::shared_ptr<class write_frame> create_color_frame(void* tag, const spl::shared_ptr<struct frame_factory>& frame_factory, const std::wstring& color);\r
+spl::shared_ptr<struct write_frame> create_color_frame(void* tag, const spl::shared_ptr<struct frame_factory>& frame_factory, const std::wstring& color);\r
\r
}}\r
\r
virtual spl::shared_ptr<write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc) override\r
{ \r
- return spl::make_shared<write_frame>(ogl_, tag, desc);\r
+ return mixer_->create_frame(tag, desc);\r
}\r
\r
virtual core::video_format_desc get_video_format_desc() const override\r
}\r
else if(video_frame == empty_video())\r
{\r
- video_streams_.back().push(spl::make_shared<core::write_frame>(this));\r
+ auto empty_frame = frame_factory_->create_frame(this, core::pixel_format_desc(core::pixel_format::invalid));\r
+ video_streams_.back().push(empty_frame);\r
display_mode_ = display_mode::simple;\r
}\r
else\r
\r
#include "display_mode.h"\r
\r
+#include <common/forward.h>\r
#include <common/spl/memory.h>\r
\r
#include <core/mixer/audio/audio_mixer.h>\r
\r
struct AVFrame;\r
\r
-namespace caspar { \r
- \r
-namespace core {\r
-\r
-class write_frame;\r
-class draw_frame;\r
-struct frame_factory;\r
-\r
-}\r
+FORWARD2(caspar, core, struct pixel_format_desc);\r
+FORWARD2(caspar, core, struct write_frame);\r
+FORWARD2(caspar, core, struct frame_factory);\r
+FORWARD2(caspar, core, class draw_frame);\r
\r
-namespace ffmpeg {\r
+namespace caspar { namespace ffmpeg {\r
\r
class frame_muxer : boost::noncopyable\r
{\r
static tbb::concurrent_unordered_map<int, tbb::concurrent_queue<std::shared_ptr<SwsContext>>> sws_contexts_;\r
\r
if(decoded_frame->width < 1 || decoded_frame->height < 1)\r
- return spl::make_shared<core::write_frame>(tag);\r
+ return frame_factory->create_frame(tag, core::pixel_format_desc(core::pixel_format::invalid));\r
\r
const auto width = decoded_frame->width;\r
const auto height = decoded_frame->height;\r
\r
#pragma once\r
\r
+#include <common/forward.h>\r
#include <common/spl/memory.h>\r
\r
#include <core/video_format.h>\r
struct AVRational;\r
struct AVCodecContext;\r
\r
-namespace caspar {\r
+FORWARD2(caspar, core, struct pixel_format_desc);\r
+FORWARD2(caspar, core, struct write_frame);\r
+FORWARD2(caspar, core, struct frame_factory);\r
\r
-namespace core {\r
-\r
-struct pixel_format_desc;\r
-class write_frame;\r
-struct frame_factory;\r
-\r
-}\r
-\r
-namespace ffmpeg {\r
+namespace caspar { namespace ffmpeg {\r
\r
std::shared_ptr<core::audio_buffer> flush_audio();\r
std::shared_ptr<core::audio_buffer> empty_audio();\r
#pragma once\r
\r
#include <common/spl/memory.h>\r
+#include <common/forward.h>\r
\r
#include <boost/noncopyable.hpp>\r
\r
struct AVFrame;\r
struct AVPacket;\r
\r
-namespace caspar {\r
+FORWARD2(caspar, core, struct write_frame);\r
+FORWARD2(caspar, core, struct frame_factory);\r
\r
-namespace core {\r
- struct frame_factory;\r
- class write_frame;\r
-}\r
-\r
-namespace ffmpeg {\r
+namespace caspar { namespace ffmpeg {\r
\r
class video_decoder : boost::noncopyable\r
{\r