<ItemGroup>\r
<ClInclude Include="cpu\image\image_mixer.h" />\r
<ClInclude Include="cpu\util\xmm.h" />\r
- <ClInclude Include="cpu\util\write_frame.h" />\r
+ <ClInclude Include="cpu\util\data_frame.h" />\r
<ClInclude Include="accelerator.h" />\r
<ClInclude Include="ogl\image\blending_glsl.h" />\r
<ClInclude Include="ogl\image\image_kernel.h" />\r
<ClInclude Include="ogl\util\device_buffer.h" />\r
<ClInclude Include="ogl\util\host_buffer.h" />\r
<ClInclude Include="ogl\util\shader.h" />\r
- <ClInclude Include="ogl\util\write_frame.h" />\r
+ <ClInclude Include="ogl\util\data_frame.h" />\r
<ClInclude Include="StdAfx.h" />\r
</ItemGroup>\r
<ItemGroup>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
- <ClCompile Include="cpu\util\write_frame.cpp">\r
+ <ClCompile Include="cpu\util\data_frame.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
- <ClCompile Include="ogl\util\write_frame.cpp">\r
+ <ClCompile Include="ogl\util\data_frame.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
<ClInclude Include="ogl\util\shader.h">\r
<Filter>source\ogl\util</Filter>\r
</ClInclude>\r
- <ClInclude Include="ogl\util\write_frame.h">\r
- <Filter>source\ogl\util</Filter>\r
- </ClInclude>\r
<ClInclude Include="cpu\image\image_mixer.h">\r
<Filter>source\cpu\image</Filter>\r
</ClInclude>\r
- <ClInclude Include="cpu\util\write_frame.h">\r
- <Filter>source\cpu\util</Filter>\r
- </ClInclude>\r
<ClInclude Include="cpu\util\xmm.h">\r
<Filter>source\cpu\util</Filter>\r
</ClInclude>\r
<ClInclude Include="accelerator.h">\r
<Filter>source</Filter>\r
</ClInclude>\r
+ <ClInclude Include="cpu\util\data_frame.h">\r
+ <Filter>source\cpu\util</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="ogl\util\data_frame.h">\r
+ <Filter>source\ogl\util</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="StdAfx.cpp" />\r
<ClCompile Include="ogl\util\shader.cpp">\r
<Filter>source\ogl\util</Filter>\r
</ClCompile>\r
- <ClCompile Include="ogl\util\write_frame.cpp">\r
- <Filter>source\ogl\util</Filter>\r
- </ClCompile>\r
<ClCompile Include="cpu\image\image_mixer.cpp">\r
<Filter>source\cpu\image</Filter>\r
</ClCompile>\r
- <ClCompile Include="cpu\util\write_frame.cpp">\r
- <Filter>source\cpu\util</Filter>\r
- </ClCompile>\r
<ClCompile Include="accelerator.cpp">\r
<Filter>source</Filter>\r
</ClCompile>\r
+ <ClCompile Include="cpu\util\data_frame.cpp">\r
+ <Filter>source\cpu\util</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\util\data_frame.cpp">\r
+ <Filter>source\ogl\util</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
\r
#include "image_mixer.h"\r
\r
-#include "../util/write_frame.h"\r
+#include "../util/data_frame.h"\r
#include "../util/xmm.h"\r
\r
#include <common/assert.h>\r
#include <common/concurrency/async.h>\r
#include <common/memory/memcpy.h>\r
\r
-#include <core/frame/write_frame.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/pixel_format.h>\r
#include <core/video_format.h>\r
\r
void visit(const core::data_frame& frame2)\r
{ \r
- auto frame = dynamic_cast<const write_frame*>(&frame2);\r
+ auto frame = dynamic_cast<const data_frame*>(&frame2);\r
if(frame == nullptr)\r
return;\r
\r
return renderer_(std::move(items_), format_desc);\r
}\r
\r
- virtual spl::shared_ptr<cpu::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode)\r
+ virtual spl::shared_ptr<core::data_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode)\r
{\r
- return spl::make_shared<cpu::write_frame>(tag, desc, frame_rate, field_mode);\r
+ return spl::make_shared<cpu::data_frame>(tag, desc, frame_rate, field_mode);\r
}\r
};\r
\r
boost::shared_future<boost::iterator_range<const uint8_t*>> image_mixer::operator()(const core::video_format_desc& format_desc){return impl_->render(format_desc);}\r
void image_mixer::begin_layer(core::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 core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) {return impl_->create_frame(tag, desc, frame_rate, field_mode);}\r
+spl::shared_ptr<core::data_frame> image_mixer::create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) {return impl_->create_frame(tag, desc, frame_rate, field_mode);}\r
\r
}}}
\ No newline at end of file
\r
FORWARD1(boost, template<typename> class shared_future);\r
FORWARD1(boost, template<typename> class iterator_range);\r
-FORWARD2(caspar, core, class write_frame);\r
+FORWARD2(caspar, core, class data_frame);\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
FORWARD2(caspar, core, struct video_format_desc);\r
FORWARD2(caspar, core, class data_frame);\r
// NOTE: Content of return future is only valid while future is valid.\r
virtual ::boost::shared_future<::boost::iterator_range<const uint8_t*>> operator()(const core::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, double frame_rate, core::field_mode field_mode) override;\r
+ virtual spl::shared_ptr<core::data_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) override;\r
private:\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
\r
#include "../../stdafx.h"\r
\r
-#include "write_frame.h"\r
+#include "data_frame.h"\r
\r
#include <common/except.h>\r
#include <core/frame/frame_visitor.h>\r
\r
namespace caspar { namespace accelerator { namespace cpu {\r
\r
-struct write_frame::impl : boost::noncopyable\r
+struct data_frame::impl : boost::noncopyable\r
{ \r
std::vector<spl::shared_ptr<host_buffer>> buffers_;\r
core::audio_buffer audio_data_;\r
return spl::make_shared<host_buffer>(plane.size);\r
});\r
}\r
- \r
- void accept(const write_frame& self, core::frame_visitor& visitor) const\r
- {\r
- visitor.push(self.frame_transform());\r
- visitor.visit(self);\r
- visitor.pop();\r
- }\r
\r
boost::iterator_range<uint8_t*> image_data(int index)\r
{\r
}\r
};\r
\r
-write_frame::write_frame(const void* tag) : impl_(new impl(tag)){}\r
-write_frame::write_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) \r
+data_frame::data_frame(const void* tag) : impl_(new impl(tag)){}\r
+data_frame::data_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) \r
: impl_(new impl(tag, desc, frame_rate, field_mode)){}\r
-write_frame::write_frame(write_frame&& other) : impl_(std::move(other.impl_)){}\r
-write_frame& write_frame::operator=(write_frame&& other)\r
+data_frame::data_frame(data_frame&& other) : impl_(std::move(other.impl_)){}\r
+data_frame& data_frame::operator=(data_frame&& other)\r
{\r
impl_ = std::move(other.impl_);\r
return *this;\r
}\r
-void write_frame::swap(write_frame& other){impl_.swap(other.impl_);}\r
-void write_frame::accept(core::frame_visitor& visitor) const {impl_->accept(*this, visitor);}\r
-const core::pixel_format_desc& write_frame::pixel_format_desc() const{return impl_->desc_;}\r
-const boost::iterator_range<const uint8_t*> write_frame::image_data(int index) const{return impl_->image_data(index);}\r
-const core::audio_buffer& write_frame::audio_data() const{return impl_->audio_data_;}\r
-const boost::iterator_range<uint8_t*> write_frame::image_data(int index){return impl_->image_data(index);}\r
-core::audio_buffer& write_frame::audio_data(){return impl_->audio_data_;}\r
-double write_frame::frame_rate() const{return impl_->frame_rate_;}\r
-core::field_mode write_frame::field_mode()const{return impl_->field_mode_;}\r
-int write_frame::width() const{return impl_->desc_.planes.at(0).width;}\r
-int write_frame::height() const{return impl_->desc_.planes.at(0).height;} \r
-const void* write_frame::tag() const{return impl_->tag_;} \r
-std::vector<spl::shared_ptr<host_buffer>> write_frame::buffers() const{return impl_->buffers_;}\r
+void data_frame::swap(data_frame& other){impl_.swap(other.impl_);}\r
+const core::pixel_format_desc& data_frame::pixel_format_desc() const{return impl_->desc_;}\r
+const boost::iterator_range<const uint8_t*> data_frame::image_data(int index) const{return impl_->image_data(index);}\r
+const core::audio_buffer& data_frame::audio_data() const{return impl_->audio_data_;}\r
+const boost::iterator_range<uint8_t*> data_frame::image_data(int index){return impl_->image_data(index);}\r
+core::audio_buffer& data_frame::audio_data(){return impl_->audio_data_;}\r
+double data_frame::frame_rate() const{return impl_->frame_rate_;}\r
+core::field_mode data_frame::field_mode()const{return impl_->field_mode_;}\r
+int data_frame::width() const{return impl_->desc_.planes.at(0).width;}\r
+int data_frame::height() const{return impl_->desc_.planes.at(0).height;} \r
+const void* data_frame::tag() const{return impl_->tag_;} \r
+std::vector<spl::shared_ptr<host_buffer>> data_frame::buffers() const{return impl_->buffers_;}\r
\r
}}}
\ No newline at end of file
#include <common/spl/memory.h>\r
#include <common/forward.h>\r
\r
-#include <core/frame/write_frame.h>\r
#include <core/video_format.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/mixer/audio/audio_mixer.h>\r
\r
#include <boost/range/iterator_range.hpp>\r
\r
typedef std::vector<uint8_t, tbb::cache_aligned_allocator<uint8_t>> host_buffer;\r
\r
-class write_frame sealed : public core::write_frame\r
+class data_frame sealed : public core::data_frame\r
{\r
- write_frame(const write_frame&);\r
- write_frame& operator=(const write_frame);\r
+ data_frame(const data_frame&);\r
+ data_frame& operator=(const data_frame);\r
public: \r
- explicit write_frame(const void* tag);\r
- explicit write_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode);\r
+ explicit data_frame(const void* tag);\r
+ explicit data_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode);\r
\r
- write_frame(write_frame&& other);\r
- write_frame& operator=(write_frame&& other);\r
-\r
- void swap(write_frame& other);\r
- \r
- // draw_frame\r
-\r
- virtual void accept(core::frame_visitor& visitor) const override;\r
+ data_frame(data_frame&& other);\r
+ data_frame& operator=(data_frame&& other);\r
\r
+ void swap(data_frame& other);\r
+ \r
// data_frame\r
\r
virtual const core::pixel_format_desc& pixel_format_desc() const override;\r
\r
virtual const void* tag() const override; \r
\r
- // write_frames\r
+ // data_frames\r
\r
std::vector<spl::shared_ptr<host_buffer>> buffers() const; \r
private:\r
\r
#include "image_kernel.h"\r
\r
-#include "../util/write_frame.h"\r
+#include "../util/data_frame.h"\r
#include "../util/context.h"\r
#include "../util/host_buffer.h"\r
#include "../util/device_buffer.h"\r
#include <common/concurrency/async.h>\r
#include <common/memory/memcpy.h>\r
\r
-#include <core/frame/write_frame.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/pixel_format.h>\r
#include <core/video_format.h>\r
struct item\r
{\r
core::pixel_format_desc pix_desc;\r
+ core::field_mode field_mode;\r
std::vector<spl::shared_ptr<host_buffer>> buffers;\r
std::vector<future_texture> textures;\r
core::image_transform transform;\r
\r
-\r
item()\r
: pix_desc(core::pixel_format::invalid)\r
+ , field_mode(core::field_mode::empty)\r
{\r
}\r
};\r
std::shared_ptr<device_buffer>& local_key_buffer, \r
std::shared_ptr<device_buffer>& local_mix_buffer,\r
const core::video_format_desc& format_desc)\r
- { \r
+ { \r
+ if(item.pix_desc.planes.at(0).height == 480) // NTSC DV\r
+ {\r
+ item.transform.fill_translation[1] += 2.0/static_cast<double>(format_desc.height);\r
+ item.transform.fill_scale[1] = 1.0 - 6.0*1.0/static_cast<double>(format_desc.height);\r
+ }\r
+ \r
+ // Fix field-order if needed\r
+ if(item.field_mode == core::field_mode::lower && format_desc.field_mode == core::field_mode::upper)\r
+ item.transform.fill_translation[1] += 1.0/static_cast<double>(format_desc.height);\r
+ else if(item.field_mode == core::field_mode::upper && format_desc.field_mode == core::field_mode::lower)\r
+ item.transform.fill_translation[1] -= 1.0/static_cast<double>(format_desc.height);\r
+ \r
draw_params draw_params;\r
draw_params.pix_desc = std::move(item.pix_desc);\r
draw_params.transform = std::move(item.transform);\r
\r
void visit(const core::data_frame& frame2)\r
{ \r
- auto frame = dynamic_cast<const write_frame*>(&frame2);\r
+ auto frame = dynamic_cast<const data_frame*>(&frame2);\r
if(frame == nullptr)\r
return;\r
\r
\r
item item;\r
item.pix_desc = frame->pixel_format_desc();\r
+ item.field_mode = frame->field_mode();\r
item.buffers = frame->buffers(); \r
item.transform = transform_stack_.back();\r
\r
return renderer_(std::move(layers_), format_desc);\r
}\r
\r
- virtual spl::shared_ptr<ogl::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode)\r
+ virtual spl::shared_ptr<core::data_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode)\r
{\r
- return spl::make_shared<ogl::write_frame>(ogl_, tag, desc, frame_rate, field_mode);\r
+ return spl::make_shared<ogl::data_frame>(ogl_, tag, desc, frame_rate, field_mode);\r
}\r
};\r
\r
boost::shared_future<boost::iterator_range<const uint8_t*>> image_mixer::operator()(const core::video_format_desc& format_desc){return impl_->render(format_desc);}\r
void image_mixer::begin_layer(core::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 core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) {return impl_->create_frame(tag, desc, frame_rate, field_mode);}\r
+spl::shared_ptr<core::data_frame> image_mixer::create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) {return impl_->create_frame(tag, desc, frame_rate, field_mode);}\r
\r
}}}
\ No newline at end of file
#include <core/video_format.h>\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
-FORWARD2(caspar, core, class write_frame);\r
+FORWARD2(caspar, core, class data_frame);\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
FORWARD2(caspar, core, struct video_format_desc);\r
FORWARD2(caspar, core, class data_frame);\r
// NOTE: Content of return future is only valid while future is valid.\r
virtual boost::shared_future<boost::iterator_range<const uint8_t*>> operator()(const core::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, double frame_rate, core::field_mode field_mode) override;\r
+ virtual spl::shared_ptr<core::data_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) override;\r
private:\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
\r
#include "../../stdafx.h"\r
\r
-#include "write_frame.h"\r
+#include "data_frame.h"\r
\r
#include "context.h"\r
#include "host_buffer.h"\r
\r
namespace caspar { namespace accelerator { namespace ogl {\r
\r
-struct write_frame::impl : boost::noncopyable\r
+struct data_frame::impl : boost::noncopyable\r
{ \r
std::shared_ptr<context> ogl_;\r
std::vector<spl::shared_ptr<ogl::host_buffer>> buffers_;\r
});\r
}\r
\r
- void accept(const write_frame& self, core::frame_visitor& visitor) const\r
- {\r
- visitor.push(self.frame_transform());\r
- visitor.visit(self);\r
- visitor.pop();\r
- }\r
-\r
boost::iterator_range<uint8_t*> image_data(int index)\r
{\r
if(index >= buffers_.size() || !buffers_[index]->data())\r
}\r
};\r
\r
-write_frame::write_frame(const void* tag) : impl_(new impl(tag)){}\r
-write_frame::write_frame(const spl::shared_ptr<ogl::context>& ogl, const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) \r
+data_frame::data_frame(const void* tag) : impl_(new impl(tag)){}\r
+data_frame::data_frame(const spl::shared_ptr<ogl::context>& ogl, const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) \r
: impl_(new impl(ogl, tag, desc, frame_rate, field_mode)){}\r
-write_frame::write_frame(write_frame&& other) : impl_(std::move(other.impl_)){}\r
-write_frame& write_frame::operator=(write_frame&& other)\r
+data_frame::data_frame(data_frame&& other) : impl_(std::move(other.impl_)){}\r
+data_frame& data_frame::operator=(data_frame&& other)\r
{\r
impl_ = std::move(other.impl_);\r
return *this;\r
}\r
-void write_frame::swap(write_frame& other){impl_.swap(other.impl_);}\r
-void write_frame::accept(core::frame_visitor& visitor) const {impl_->accept(*this, visitor);}\r
-const core::pixel_format_desc& write_frame::pixel_format_desc() const{return impl_->desc_;}\r
-const boost::iterator_range<const uint8_t*> write_frame::image_data(int index) const{return impl_->image_data(index);}\r
-const core::audio_buffer& write_frame::audio_data() const{return impl_->audio_data_;}\r
-const boost::iterator_range<uint8_t*> write_frame::image_data(int index){return impl_->image_data(index);}\r
-core::audio_buffer& write_frame::audio_data(){return impl_->audio_data_;}\r
-double write_frame::frame_rate() const{return impl_->frame_rate_;}\r
-core::field_mode write_frame::field_mode() const{return impl_->field_mode_;}\r
-int write_frame::width() const{return impl_->desc_.planes.at(0).width;}\r
-int write_frame::height() const{return impl_->desc_.planes.at(0).height;} \r
-const void* write_frame::tag() const{return impl_->tag_;} \r
-std::vector<spl::shared_ptr<ogl::host_buffer>> write_frame::buffers() const{return impl_->buffers_;}\r
+void data_frame::swap(data_frame& other){impl_.swap(other.impl_);}\r
+const core::pixel_format_desc& data_frame::pixel_format_desc() const{return impl_->desc_;}\r
+const boost::iterator_range<const uint8_t*> data_frame::image_data(int index) const{return impl_->image_data(index);}\r
+const core::audio_buffer& data_frame::audio_data() const{return impl_->audio_data_;}\r
+const boost::iterator_range<uint8_t*> data_frame::image_data(int index){return impl_->image_data(index);}\r
+core::audio_buffer& data_frame::audio_data(){return impl_->audio_data_;}\r
+double data_frame::frame_rate() const{return impl_->frame_rate_;}\r
+core::field_mode data_frame::field_mode() const{return impl_->field_mode_;}\r
+int data_frame::width() const{return impl_->desc_.planes.at(0).width;}\r
+int data_frame::height() const{return impl_->desc_.planes.at(0).height;} \r
+const void* data_frame::tag() const{return impl_->tag_;} \r
+std::vector<spl::shared_ptr<ogl::host_buffer>> data_frame::buffers() const{return impl_->buffers_;}\r
\r
}}}
\ No newline at end of file
#include <common/spl/memory.h>\r
#include <common/forward.h>\r
\r
-#include <core/frame/write_frame.h>\r
+#include <core/frame/data_frame.h>\r
+#include <core/frame/pixel_format.h>\r
#include <core/video_format.h>\r
#include <core/mixer/audio/audio_mixer.h>\r
\r
\r
namespace caspar { namespace accelerator { namespace ogl {\r
\r
-class write_frame sealed : public core::write_frame\r
+class data_frame sealed : public core::data_frame\r
{\r
- write_frame(const write_frame&);\r
- write_frame& operator=(const write_frame);\r
+ data_frame(const data_frame&);\r
+ data_frame& operator=(const data_frame);\r
public: \r
- explicit write_frame(const void* tag);\r
- explicit write_frame(const spl::shared_ptr<class context>& ogl, const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode);\r
+ explicit data_frame(const void* tag);\r
+ explicit data_frame(const spl::shared_ptr<class context>& ogl, const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode);\r
\r
- write_frame(write_frame&& other);\r
- write_frame& operator=(write_frame&& other);\r
+ data_frame(data_frame&& other);\r
+ data_frame& operator=(data_frame&& other);\r
\r
- void swap(write_frame& other);\r
+ void swap(data_frame& other);\r
\r
- // draw_frame\r
-\r
- virtual void accept(core::frame_visitor& visitor) const override;\r
-\r
// data_frame\r
\r
virtual const core::pixel_format_desc& pixel_format_desc() const override;\r
\r
virtual const void* tag() const override;\r
\r
- // write_frames\r
+ // data_frames\r
\r
std::vector<spl::shared_ptr<class host_buffer>> buffers() const;\r
private:\r
<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\image\blend_modes.h" />\r
<ClInclude Include="monitor\monitor.h" />\r
<ClInclude Include="frame\draw_frame.h">\r
<Filter>source\frame</Filter>\r
</ClInclude>\r
- <ClInclude Include="frame\write_frame.h">\r
- <Filter>source\frame</Filter>\r
- </ClInclude>\r
<ClInclude Include="monitor\monitor.h">\r
<Filter>source\monitor</Filter>\r
</ClInclude>\r
struct draw_frame::impl\r
{ \r
std::vector<spl::shared_ptr<const draw_frame>> frames_;\r
+ std::shared_ptr<const data_frame> data_frame_;\r
\r
core::frame_transform frame_transform_; \r
public:\r
impl()\r
{\r
}\r
+ \r
+ impl(spl::shared_ptr<const data_frame> frame) \r
+ : data_frame_(frame)\r
+ {\r
+ }\r
\r
- impl(std::vector<spl::shared_ptr<draw_frame>> frames)\r
+ impl(spl::shared_ptr<const draw_frame> frame) \r
{\r
- frames_.insert(frames_.end(), frames.begin(), frames.end());\r
+ frames_.push_back(std::move(frame));\r
}\r
\r
impl(std::vector<spl::shared_ptr<const draw_frame>> frames) : frames_(std::move(frames))\r
{\r
}\r
\r
- impl(spl::shared_ptr<const draw_frame> frame) \r
+ impl(std::vector<spl::shared_ptr<draw_frame>> frames)\r
{\r
- frames_.push_back(std::move(frame));\r
+ frames_.insert(frames_.end(), frames.begin(), frames.end());\r
}\r
+\r
\r
void accept(frame_visitor& visitor) const\r
{\r
visitor.push(frame_transform_);\r
- BOOST_FOREACH(auto frame, frames_)\r
- frame->accept(visitor);\r
+ if(data_frame_)\r
+ {\r
+ visitor.visit(*data_frame_);\r
+ }\r
+ else\r
+ {\r
+ BOOST_FOREACH(auto frame, frames_)\r
+ frame->accept(visitor);\r
+ }\r
visitor.pop();\r
} \r
};\r
draw_frame::draw_frame() : impl_(new impl()){}\r
draw_frame::draw_frame(const draw_frame& other) : impl_(new impl(*other.impl_)){}\r
draw_frame::draw_frame(draw_frame&& other) : impl_(std::move(other.impl_)){}\r
+draw_frame::draw_frame(spl::shared_ptr<const data_frame> frame) : impl_(new impl(std::move(frame))){}\r
+draw_frame::draw_frame(spl::shared_ptr<const draw_frame> frame) : impl_(new impl(std::move(frame))){}\r
draw_frame::draw_frame(std::vector<spl::shared_ptr<draw_frame>> frames) : impl_(new impl(frames)){}\r
draw_frame::draw_frame(std::vector<spl::shared_ptr<const draw_frame>> frames) : impl_(new impl(frames)){}\r
-draw_frame::draw_frame(spl::shared_ptr<const draw_frame> frame) : impl_(new impl(std::move(frame))){}\r
draw_frame& draw_frame::operator=(draw_frame other)\r
{\r
other.swap(*this);\r
draw_frame(draw_frame&& other);\r
draw_frame& operator=(draw_frame other);\r
virtual ~draw_frame(){}\r
-\r
+ \r
+ draw_frame(spl::shared_ptr<const data_frame> frame);\r
draw_frame(spl::shared_ptr<const draw_frame> frame);\r
draw_frame(std::vector<spl::shared_ptr<draw_frame>> frames);\r
draw_frame(std::vector<spl::shared_ptr<const draw_frame>> frames);\r
public:\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, double frame_rate, core::field_mode field_mode) = 0; \r
- spl::shared_ptr<class write_frame> create_frame(const void* video_stream_tag, const struct pixel_format_desc& desc)\r
+ virtual spl::shared_ptr<class data_frame> create_frame(const void* video_stream_tag, const struct pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) = 0; \r
+ spl::shared_ptr<class data_frame> create_frame(const void* video_stream_tag, const struct pixel_format_desc& desc)\r
{\r
auto format_desc = video_format_desc();\r
return create_frame(video_stream_tag, desc, format_desc.fps, format_desc.field_mode);\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
-class write_frame : public draw_frame, public data_frame\r
-{\r
-};\r
-\r
-\r
-}}
\ No newline at end of file
\r
#include "audio_mixer.h"\r
\r
-#include <core/frame/write_frame.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <common/diagnostics/graph.h>\r
\r
#include <stdint.h>\r
\r
FORWARD1(boost, template<typename> class shared_future);\r
-FORWARD2(caspar, core, class write_frame);\r
+FORWARD2(caspar, core, class data_frame);\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
\r
namespace caspar { namespace core {\r
virtual void end_layer() = 0;\r
\r
virtual boost::shared_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 struct pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) = 0;\r
+ virtual spl::shared_ptr<core::data_frame> create_frame(const void* tag, const struct pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) = 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, double frame_rate, core::field_mode field_mode) {return impl_->image_mixer_->create_frame(tag, desc, frame_rate, field_mode);}\r
+spl::shared_ptr<data_frame> mixer::create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) {return impl_->image_mixer_->create_frame(tag, desc, frame_rate, field_mode);}\r
}}
\ No newline at end of file
\r
boost::unique_future<boost::property_tree::wptree> info() const;\r
\r
- spl::shared_ptr<class write_frame> create_frame(const void* tag, const struct pixel_format_desc& desc, double frame_rate, core::field_mode field_mode);\r
+ spl::shared_ptr<class data_frame> create_frame(const void* tag, const struct pixel_format_desc& desc, double frame_rate, core::field_mode field_mode);\r
private:\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
#include "color_producer.h"\r
\r
#include <core/producer/frame_producer.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/frame/write_frame.h>\r
\r
#include <common/except.h>\r
\r
\r
return core::wrap_producer(spl::make_shared<color_producer>(frame_factory, color2));\r
}\r
-spl::shared_ptr<write_frame> create_color_frame(void* tag, const spl::shared_ptr<frame_factory>& frame_factory, const std::wstring& color)\r
+spl::shared_ptr<draw_frame> create_color_frame(void* tag, const spl::shared_ptr<frame_factory>& frame_factory, const std::wstring& color)\r
{\r
auto color2 = get_hex_color(color);\r
if(color2.length() != 9 || color2[0] != '#')\r
if(!(str >> std::hex >> value) || !str.eof())\r
BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(color2) << msg_info("Invalid color."));\r
\r
- return frame;\r
+ return spl::make_shared<draw_frame>(frame);\r
}\r
\r
}}
\ No newline at end of file
namespace caspar { namespace core {\r
\r
spl::shared_ptr<class frame_producer> create_color_producer(const spl::shared_ptr<class 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<class frame_factory>& frame_factory, const std::wstring& color);\r
+spl::shared_ptr<class draw_frame> create_color_frame(void* tag, const spl::shared_ptr<class frame_factory>& frame_factory, const std::wstring& color);\r
\r
}}\r
\r
// frame_factory\r
\r
- virtual spl::shared_ptr<write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) override\r
+ virtual spl::shared_ptr<data_frame> create_frame(const void* tag, const core::pixel_format_desc& desc, double frame_rate, core::field_mode field_mode) override\r
{ \r
return mixer_.create_frame(tag, desc, frame_rate, field_mode);\r
}\r
#include <common/log.h>\r
#include <common/param.h>\r
\r
-#include <core/frame/write_frame.h>\r
+#include <core/frame/data_frame.h>\r
+#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/frame_factory.h>\r
\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/pixel_format.h>\r
#include <core/frame/frame_factory.h>\r
-#include <core/frame/write_frame.h>\r
+#include <core/frame/data_frame.h>\r
\r
#include <common/env.h>\r
#include <common/except.h>\r
\r
struct frame_muxer::impl : boost::noncopyable\r
{ \r
- std::queue<std::queue<spl::shared_ptr<write_frame>>> video_streams_;\r
- std::queue<core::audio_buffer> audio_streams_;\r
- std::queue<spl::shared_ptr<draw_frame>> frame_buffer_;\r
- display_mode display_mode_;\r
- const double in_fps_;\r
- const video_format_desc format_desc_;\r
- bool auto_transcode_;\r
- bool auto_deinterlace_;\r
+ std::queue<std::queue<spl::shared_ptr<data_frame>>> video_streams_;\r
+ std::queue<core::audio_buffer> audio_streams_;\r
+ std::queue<spl::shared_ptr<draw_frame>> frame_buffer_;\r
+ display_mode display_mode_;\r
+ const double in_fps_;\r
+ const video_format_desc format_desc_;\r
+ bool auto_transcode_;\r
+ bool auto_deinterlace_;\r
\r
- std::vector<int> audio_cadence_;\r
+ std::vector<int> audio_cadence_;\r
\r
spl::shared_ptr<core::frame_factory> frame_factory_;\r
\r
- filter filter_;\r
- const std::wstring filter_str_;\r
- bool force_deinterlacing_;\r
+ filter filter_;\r
+ const std::wstring filter_str_;\r
+ bool force_deinterlacing_;\r
\r
impl(double in_fps, const spl::shared_ptr<core::frame_factory>& frame_factory, const std::wstring& filter_str)\r
: display_mode_(display_mode::invalid)\r
, filter_str_(filter_str)\r
, force_deinterlacing_(false)\r
{\r
- video_streams_.push(std::queue<spl::shared_ptr<write_frame>>());\r
+ video_streams_.push(std::queue<spl::shared_ptr<data_frame>>());\r
audio_streams_.push(core::audio_buffer());\r
\r
// Note: Uses 1 step rotated cadence for 1001 modes (1602, 1602, 1601, 1602, 1601)\r
\r
if(video_frame == flush_video())\r
{ \r
- video_streams_.push(std::queue<spl::shared_ptr<write_frame>>());\r
+ //video_streams_.push(std::queue<spl::shared_ptr<data_frame>>());\r
}\r
else if(video_frame == empty_video())\r
{\r
if(video_frame->format == PIX_FMT_GRAY8 && format == CASPAR_PIX_FMT_LUMA)\r
av_frame->format = format;\r
\r
- video_streams_.back().push(make_write_frame(this, av_frame, frame_factory_->video_format_desc().fps, frame_factory_, flags));\r
+ video_streams_.back().push(make_data_frame(this, av_frame, frame_factory_->video_format_desc().fps, frame_factory_, flags));\r
}\r
}\r
\r
case display_mode::deinterlace_bob: \r
case display_mode::deinterlace: \r
{\r
- frame_buffer_.push(frame1);\r
+ frame_buffer_.push(spl::make_shared<draw_frame>(frame1));\r
break;\r
}\r
case display_mode::interlace: \r
{ \r
auto frame2 = pop_video();\r
\r
- frame_buffer_.push(core::draw_frame::interlace(frame1, frame2, format_desc_.field_mode)); \r
+ frame_buffer_.push(core::draw_frame::interlace(spl::make_shared<draw_frame>(frame1), spl::make_shared<draw_frame>(frame2), format_desc_.field_mode)); \r
break;\r
}\r
case display_mode::duplicate: \r
{\r
boost::range::push_back(frame1->audio_data(), pop_audio());\r
\r
- frame_buffer_.push(frame1);\r
- frame_buffer_.push(frame1);\r
+ frame_buffer_.push(spl::make_shared<draw_frame>(frame1));\r
+ frame_buffer_.push(spl::make_shared<draw_frame>(frame1));\r
break;\r
}\r
case display_mode::half: \r
{ \r
pop_video(); // Throw away\r
\r
- frame_buffer_.push(frame1);\r
+ frame_buffer_.push(spl::make_shared<draw_frame>(frame1));\r
break;\r
}\r
}\r
return frame_buffer_.empty() ? nullptr : poll();\r
}\r
\r
- spl::shared_ptr<core::write_frame> pop_video()\r
+ spl::shared_ptr<core::data_frame> pop_video()\r
{\r
auto frame = video_streams_.front().front();\r
video_streams_.front().pop(); \r
filter_.push(frame);\r
auto av_frame = filter_.poll();\r
if(av_frame) \r
- video_streams_.back().push(make_write_frame(this, spl::make_shared_ptr(av_frame), frame_factory_->video_format_desc().fps, frame_factory_, 0));\r
+ video_streams_.back().push(make_data_frame(this, spl::make_shared_ptr(av_frame), frame_factory_->video_format_desc().fps, frame_factory_, 0));\r
}\r
filter_ = filter(filter_str);\r
CASPAR_LOG(info) << L"[frame_muxer] " << display_mode_ << L" " << print_mode(frame->width, frame->height, in_fps_, frame->interlaced_frame > 0);\r
struct AVFrame;\r
\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
-FORWARD2(caspar, core, class write_frame);\r
+FORWARD2(caspar, core, class data_frame);\r
FORWARD2(caspar, core, class frame_factory);\r
FORWARD2(caspar, core, class draw_frame);\r
\r
\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/frame_factory.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/producer/frame_producer.h>\r
-#include <core/frame/write_frame.h>\r
\r
#include <common/except.h>\r
\r
}\r
}\r
\r
-spl::shared_ptr<core::write_frame> make_write_frame(const void* tag, const spl::shared_ptr<AVFrame>& decoded_frame, double fps, const spl::shared_ptr<core::frame_factory>& frame_factory, int flags)\r
+spl::shared_ptr<core::data_frame> make_data_frame(const void* tag, const spl::shared_ptr<AVFrame>& decoded_frame, double fps, const spl::shared_ptr<core::frame_factory>& frame_factory, int flags)\r
{ \r
static tbb::concurrent_unordered_map<int, tbb::concurrent_queue<std::shared_ptr<SwsContext>>> sws_contexts_;\r
\r
if(flags & core::frame_producer::flags::alpha_only)\r
desc = pixel_format_desc(static_cast<PixelFormat>(make_alpha_format(decoded_frame->format)), width, height);\r
\r
- std::shared_ptr<core::write_frame> write;\r
+ std::shared_ptr<core::data_frame> write;\r
\r
if(desc.format == core::pixel_format::invalid)\r
{\r
}, ap);\r
}\r
}\r
-\r
- if(decoded_frame->height == 480) // NTSC DV\r
- {\r
- write->frame_transform().image_transform.fill_translation[1] += 2.0/static_cast<double>(frame_factory->video_format_desc().height);\r
- write->frame_transform().image_transform.fill_scale[1] = 1.0 - 6.0*1.0/static_cast<double>(frame_factory->video_format_desc().height);\r
- }\r
\r
- // Fix field-order if needed\r
- if(get_mode(*decoded_frame) == core::field_mode::lower && frame_factory->video_format_desc().field_mode == core::field_mode::upper)\r
- write->frame_transform().image_transform.fill_translation[1] += 1.0/static_cast<double>(frame_factory->video_format_desc().height);\r
- else if(get_mode(*decoded_frame) == core::field_mode::upper && frame_factory->video_format_desc().field_mode == core::field_mode::lower)\r
- write->frame_transform().image_transform.fill_translation[1] -= 1.0/static_cast<double>(frame_factory->video_format_desc().height);\r
-\r
return spl::make_shared_ptr(write);\r
}\r
\r
struct AVCodecContext;\r
\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
-FORWARD2(caspar, core, class write_frame);\r
+FORWARD2(caspar, core, class data_frame);\r
FORWARD2(caspar, core, class data_frame);\r
FORWARD2(caspar, core, class frame_factory);\r
\r
\r
core::field_mode get_mode(const AVFrame& frame);\r
int make_alpha_format(int format); // NOTE: Be careful about CASPAR_PIX_FMT_LUMA, change it to PIX_FMT_GRAY8 if you want to use the frame inside some ffmpeg function.\r
-spl::shared_ptr<core::write_frame> make_write_frame(const void* tag, const spl::shared_ptr<AVFrame>& decoded_frame, double fps, const spl::shared_ptr<core::frame_factory>& frame_factory, int flags);\r
+spl::shared_ptr<core::data_frame> make_data_frame(const void* tag, const spl::shared_ptr<AVFrame>& decoded_frame, double fps, const spl::shared_ptr<core::frame_factory>& frame_factory, int flags);\r
spl::shared_ptr<AVFrame> make_av_frame(caspar::core::data_frame& frame);\r
spl::shared_ptr<AVFrame> make_av_frame(std::array<void*, 4> data, const core::pixel_format_desc& pix_desc);\r
\r
struct AVFrame;\r
struct AVPacket;\r
\r
-FORWARD2(caspar, core, class write_frame);\r
-FORWARD2(caspar, core, class frame_factory);\r
-\r
namespace caspar { namespace ffmpeg {\r
\r
class video_decoder : public monitor::observable\r
\r
#include <core/video_format.h>\r
\r
+#include <core/frame/data_frame.h>\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/frame/write_frame.h>\r
\r
#include <common/env.h>\r
#include <common/concurrency/executor.h>\r
auto frame = frame_factory_->create_frame(this, desc, fps(), core::field_mode::progressive);\r
\r
A_memcpy(frame->image_data(0).begin(), bmp_.data(), width_*height_*4);\r
- head_ = frame; \r
+ head_ = spl::make_shared<core::draw_frame>(frame); \r
} \r
\r
graph_->set_value("frame-time", static_cast<float>(frame_timer_.elapsed()/frame_time)*0.5f);\r
\r
#include <core/video_format.h>\r
\r
+#include <core/frame/data_frame.h>\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/frame/write_frame.h>\r
\r
#include <common/env.h>\r
#include <common/log.h>\r
auto frame = frame_factory->create_frame(this, desc);\r
\r
std::copy_n(FreeImage_GetBits(bitmap.get()), frame->image_data(0).size(), frame->image_data(0).begin());\r
- frame_ = std::move(frame);\r
+ frame_ = spl::make_shared<core::draw_frame>(std::move(frame));\r
}\r
\r
// frame_producer\r
\r
#include <core/video_format.h>\r
\r
+#include <core/frame/data_frame.h>\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/frame/write_frame.h>\r
\r
#include <common/env.h>\r
#include <common/log.h>\r
count = 0;\r
}\r
\r
- frames_.push_back(frame);\r
+ frames_.push_back(spl::make_shared<core::draw_frame>(frame));\r
}\r
\r
if(speed_ < 0.0)\r
count = 0;\r
}\r
\r
- frames_.push_back(frame);\r
+ frames_.push_back(spl::make_shared<core::draw_frame>(frame));\r
}\r
\r
std::reverse(frames_.begin(), frames_.end());\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/frame/write_frame.h>\r
#include <core/frame/data_frame.h>\r
\r
#include <common/except.h>\r
\r
A_memcpy(frame->image_data(0).begin(), read_frame->image_data().begin(), read_frame->image_data().size());\r
boost::push_back(frame->audio_data(), read_frame->audio_data());\r
-\r
- frame_buffer_.push(frame); \r
+ \r
+ frame_buffer_.push(spl::make_shared<core::draw_frame>(frame));\r
\r
if(double_speed) \r
- frame_buffer_.push(frame);\r
+ frame_buffer_.push(spl::make_shared<core::draw_frame>(frame));\r
\r
return receive(0);\r
} \r