#include <common/memory/safe_ptr.h>\r
#include <common/exception/exceptions.h>\r
#include <core/video_format.h>\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
\r
#include <boost/circular_buffer.hpp>\r
\r
consumer_->initialize(format_desc, channel_index);\r
}\r
\r
- virtual bool send(const safe_ptr<const frame>& frame) override\r
+ virtual bool send(const safe_ptr<const data_frame>& frame) override\r
{ \r
if(audio_cadence_.size() == 1)\r
return consumer_->send(frame);\r
{\r
struct empty_frame_consumer : public frame_consumer\r
{\r
- virtual bool send(const safe_ptr<const frame>&) override {return false;}\r
+ virtual bool send(const safe_ptr<const data_frame>&) override {return false;}\r
virtual void initialize(const video_format_desc&, int) override{}\r
virtual std::wstring print() const override {return L"empty";}\r
virtual bool has_synchronization_clock() const override {return false;}\r
frame_consumer(){}\r
virtual ~frame_consumer() {}\r
\r
- virtual bool send(const safe_ptr<const struct frame>& frame) = 0;\r
+ virtual bool send(const safe_ptr<const struct data_frame>& frame) = 0;\r
virtual void initialize(const struct video_format_desc& format_desc, int channel_index) = 0;\r
virtual std::wstring print() const = 0;\r
virtual boost::property_tree::wptree info() const = 0;\r
\r
prec_timer sync_timer_;\r
\r
- boost::circular_buffer<safe_ptr<const frame>> frames_;\r
+ boost::circular_buffer<safe_ptr<const data_frame>> frames_;\r
\r
executor executor_;\r
\r
return boost::range::count_if(consumers_ | boost::adaptors::map_values, [](const safe_ptr<frame_consumer>& x){return x->has_synchronization_clock();}) > 0;\r
}\r
\r
- void operator()(safe_ptr<const frame> input_frame, const video_format_desc& format_desc)\r
+ void operator()(safe_ptr<const data_frame> input_frame, const video_format_desc& format_desc)\r
{\r
executor_.invoke([=]\r
{\r
void output::remove(int index){impl_->remove(index);}\r
void output::remove(const safe_ptr<frame_consumer>& consumer){impl_->remove(consumer);}\r
boost::unique_future<boost::property_tree::wptree> output::info() const{return impl_->info();}\r
-void output::operator()(safe_ptr<const frame> frame, const video_format_desc& format_desc){(*impl_)(std::move(frame), format_desc);}\r
+void output::operator()(safe_ptr<const data_frame> frame, const video_format_desc& format_desc){(*impl_)(std::move(frame), format_desc);}\r
}}
\ No newline at end of file
\r
// output\r
\r
- void operator()(safe_ptr<const struct frame> frame, const struct video_format_desc& format_desc);\r
+ void operator()(safe_ptr<const struct data_frame> frame, const struct video_format_desc& format_desc);\r
\r
void add(const safe_ptr<struct frame_consumer>& consumer);\r
void add(int index, const safe_ptr<struct frame_consumer>& consumer);\r
</Lib>\r
</ItemDefinitionGroup>\r
<ItemGroup>\r
- <ClInclude Include="frame.h" />\r
+ <ClInclude Include="frame\draw_frame.h" />\r
+ <ClInclude Include="frame\data_frame.h" />\r
+ <ClInclude Include="frame\frame_factory.h" />\r
+ <ClInclude Include="frame\frame_transform.h" />\r
+ <ClInclude Include="frame\frame_visitor.h" />\r
+ <ClInclude Include="frame\pixel_format.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="mixer\read_frame.h" />\r
<ClInclude Include="mixer\write_frame.h" />\r
<ClInclude Include="producer\color\color_producer.h" />\r
- <ClInclude Include="producer\frame\basic_frame.h" />\r
- <ClInclude Include="producer\frame\frame_factory.h" />\r
- <ClInclude Include="producer\frame\frame_visitor.h" />\r
- <ClInclude Include="producer\frame\frame_transform.h" />\r
- <ClInclude Include="producer\frame\pixel_format.h" />\r
<ClInclude Include="producer\frame_producer.h" />\r
<ClInclude Include="producer\stage.h" />\r
<ClInclude Include="producer\layer.h" />\r
<ClInclude Include="StdAfx.h" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <ClCompile Include="frame\draw_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
+ <ClCompile Include="frame\frame_transform.cpp">\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="mixer\gpu\device_buffer.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\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="producer\frame\basic_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
- <ClCompile Include="producer\frame\frame_transform.cpp">\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="producer\frame_producer.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<Filter Include="source\producer\color">\r
<UniqueIdentifier>{78b16c14-bf29-4511-9122-684ff513dbf5}</UniqueIdentifier>\r
</Filter>\r
- <Filter Include="source\producer\frame">\r
- <UniqueIdentifier>{b19721c1-8dd1-45fb-b9e3-212b548ebbb6}</UniqueIdentifier>\r
- </Filter>\r
<Filter Include="source\producer\separated">\r
<UniqueIdentifier>{cf834e89-32d6-47bc-8d5a-10e032f88e15}</UniqueIdentifier>\r
</Filter>\r
<Filter Include="source\mixer\gpu\image">\r
<UniqueIdentifier>{d8d99a8a-42f9-48a3-b8a5-c07228226eab}</UniqueIdentifier>\r
</Filter>\r
+ <Filter Include="source\frame">\r
+ <UniqueIdentifier>{b19721c1-8dd1-45fb-b9e3-212b548ebbb6}</UniqueIdentifier>\r
+ </Filter>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="producer\transition\transition_producer.h">\r
<ClInclude Include="producer\layer.h">\r
<Filter>source\producer</Filter>\r
</ClInclude>\r
- <ClInclude Include="producer\frame\basic_frame.h">\r
- <Filter>source\producer\frame</Filter>\r
- </ClInclude>\r
- <ClInclude Include="producer\frame\pixel_format.h">\r
- <Filter>source\producer\frame</Filter>\r
- </ClInclude>\r
- <ClInclude Include="producer\frame\frame_visitor.h">\r
- <Filter>source\producer\frame</Filter>\r
- </ClInclude>\r
- <ClInclude Include="producer\frame\frame_factory.h">\r
- <Filter>source\producer\frame</Filter>\r
- </ClInclude>\r
<ClInclude Include="mixer\image\image_mixer.h">\r
<Filter>source\mixer\image</Filter>\r
</ClInclude>\r
<ClInclude Include="video_channel.h">\r
<Filter>source</Filter>\r
</ClInclude>\r
- <ClInclude Include="producer\frame\frame_transform.h">\r
- <Filter>source\producer\frame</Filter>\r
- </ClInclude>\r
<ClInclude Include="mixer\audio\audio_util.h">\r
<Filter>source\mixer\audio</Filter>\r
</ClInclude>\r
<ClInclude Include="mixer\gpu\accelerator.h">\r
<Filter>source\mixer\gpu</Filter>\r
</ClInclude>\r
- <ClInclude Include="frame.h">\r
- <Filter>source</Filter>\r
+ <ClInclude Include="frame\frame_factory.h">\r
+ <Filter>source\frame</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="frame\frame_transform.h">\r
+ <Filter>source\frame</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="frame\frame_visitor.h">\r
+ <Filter>source\frame</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="frame\pixel_format.h">\r
+ <Filter>source\frame</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="frame\data_frame.h">\r
+ <Filter>source\frame</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="frame\draw_frame.h">\r
+ <Filter>source\frame</Filter>\r
</ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="producer\layer.cpp">\r
<Filter>source\producer</Filter>\r
</ClCompile>\r
- <ClCompile Include="producer\frame\basic_frame.cpp">\r
- <Filter>source\producer\frame</Filter>\r
- </ClCompile>\r
<ClCompile Include="mixer\audio\audio_mixer.cpp">\r
<Filter>source\mixer\audio</Filter>\r
</ClCompile>\r
<ClCompile Include="video_format.cpp">\r
<Filter>source</Filter>\r
</ClCompile>\r
- <ClCompile Include="producer\frame\frame_transform.cpp">\r
- <Filter>source\producer\frame</Filter>\r
- </ClCompile>\r
<ClCompile Include="producer\frame_producer.cpp">\r
<Filter>source\producer</Filter>\r
</ClCompile>\r
<ClCompile Include="mixer\gpu\accelerator.cpp">\r
<Filter>source\mixer\gpu</Filter>\r
</ClCompile>\r
+ <ClCompile Include="frame\frame_transform.cpp">\r
+ <Filter>source\frame</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="frame\draw_frame.cpp">\r
+ <Filter>source\frame</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
\r
#include <stdint.h>\r
\r
-#include "producer/frame/pixel_format.h"\r
+#include "frame/pixel_format.h"\r
#include "video_format.h"\r
\r
namespace caspar { namespace core {\r
\r
-struct frame : boost::noncopyable\r
+struct data_frame : boost::noncopyable\r
{\r
virtual ~frame()\r
{\r
--- /dev/null
+#pragma once\r
+\r
+#include <boost/noncopyable.hpp>\r
+#include <boost/range.hpp>\r
+\r
+#include <stdint.h>\r
+\r
+#include "pixel_format.h"\r
+#include "../video_format.h"\r
+\r
+namespace caspar { namespace core {\r
+\r
+struct data_frame : boost::noncopyable\r
+{\r
+ virtual ~data_frame()\r
+ {\r
+ }\r
+\r
+ virtual const struct pixel_format_desc& get_pixel_format_desc() const = 0;\r
+\r
+ virtual const boost::iterator_range<const uint8_t*> image_data() const = 0;\r
+ virtual const boost::iterator_range<const int32_t*> audio_data() const = 0;\r
+ \r
+ virtual const boost::iterator_range<uint8_t*> image_data() = 0;\r
+ virtual const boost::iterator_range<int32_t*> audio_data() = 0;\r
+\r
+ virtual double get_frame_rate() const = 0;\r
+ virtual field_mode get_field_mode() const = 0;\r
+\r
+ virtual int width() const = 0;\r
+ virtual int height() const = 0;\r
+\r
+ static safe_ptr<data_frame> empty()\r
+ {\r
+ struct empty_frame : public data_frame\r
+ {\r
+ virtual const struct video_format_desc& get_video_format_desc() const\r
+ {\r
+ static video_format_desc invalid;\r
+ return invalid;\r
+ }\r
+ virtual const struct pixel_format_desc& get_pixel_format_desc() const \r
+ {\r
+ static pixel_format_desc invalid;\r
+ return invalid;\r
+ }\r
+ virtual const boost::iterator_range<const uint8_t*> image_data() const \r
+ {\r
+ return boost::iterator_range<const uint8_t*>();\r
+ }\r
+ virtual const boost::iterator_range<const int32_t*> audio_data() const \r
+ {\r
+ return boost::iterator_range<const int32_t*>();\r
+ }\r
+ const boost::iterator_range<uint8_t*> image_data()\r
+ {\r
+ return boost::iterator_range<uint8_t*>();\r
+ }\r
+ const boost::iterator_range<int32_t*> audio_data()\r
+ {\r
+ return boost::iterator_range<int32_t*>();\r
+ }\r
+ virtual double get_frame_rate() const\r
+ {\r
+ return 0.0;\r
+ }\r
+ virtual field_mode get_field_mode() const\r
+ {\r
+ return field_mode::empty;\r
+ }\r
+ virtual int width() const\r
+ {\r
+ return 0;\r
+ }\r
+ virtual int height() const\r
+ {\r
+ return 0;\r
+ }\r
+ };\r
+\r
+ static safe_ptr<empty_frame> empty;\r
+ return empty;\r
+ }\r
+};\r
+\r
+}}
\ No newline at end of file
--- /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
+#include "../../stdafx.h"\r
+\r
+#include "draw_frame.h"\r
+\r
+#include "frame_transform.h"\r
+\r
+#include <boost/foreach.hpp>\r
+\r
+namespace caspar { namespace core {\r
+ \r
+struct draw_frame::impl\r
+{ \r
+ std::vector<safe_ptr<draw_frame>> frames_;\r
+\r
+ frame_transform frame_transform_; \r
+public:\r
+ impl(const std::vector<safe_ptr<draw_frame>>& frames) : frames_(frames) \r
+ {\r
+ }\r
+\r
+ impl(std::vector<safe_ptr<draw_frame>>&& frames) : frames_(std::move(frames))\r
+ {\r
+ }\r
+\r
+ impl(safe_ptr<draw_frame>&& frame) \r
+ {\r
+ frames_.push_back(std::move(frame));\r
+ }\r
+\r
+ impl(const safe_ptr<draw_frame>& frame) \r
+ { \r
+ frames_.push_back(frame);\r
+ }\r
+ \r
+ void accept(draw_frame& self, frame_visitor& visitor)\r
+ {\r
+ visitor.begin(self);\r
+ BOOST_FOREACH(auto frame, frames_)\r
+ frame->accept(visitor);\r
+ visitor.end();\r
+ } \r
+};\r
+ \r
+draw_frame::draw_frame() : impl_(new impl(std::vector<safe_ptr<draw_frame>>())){}\r
+draw_frame::draw_frame(const std::vector<safe_ptr<draw_frame>>& frames) : impl_(new impl(frames)){}\r
+draw_frame::draw_frame(const draw_frame& other) : impl_(new impl(*other.impl_)){}\r
+draw_frame::draw_frame(std::vector<safe_ptr<draw_frame>>&& frames) : impl_(new impl(frames)){}\r
+draw_frame::draw_frame(const safe_ptr<draw_frame>& frame) : impl_(new impl(frame)){}\r
+draw_frame::draw_frame(safe_ptr<draw_frame>&& frame) : impl_(new impl(std::move(frame))){}\r
+draw_frame::draw_frame(draw_frame&& other) : impl_(std::move(other.impl_)){}\r
+draw_frame& draw_frame::operator=(draw_frame other)\r
+{\r
+ other.swap(*this);\r
+ return *this;\r
+}\r
+void draw_frame::swap(draw_frame& other){impl_.swap(other.impl_);}\r
+\r
+const frame_transform& draw_frame::get_frame_transform() const { return impl_->frame_transform_;}\r
+frame_transform& draw_frame::get_frame_transform() { return impl_->frame_transform_;}\r
+void draw_frame::accept(frame_visitor& visitor){impl_->accept(*this, visitor);}\r
+\r
+safe_ptr<draw_frame> draw_frame::interlace(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2, field_mode mode)\r
+{ \r
+ if(frame1 == draw_frame::eof() || frame2 == draw_frame::eof())\r
+ return draw_frame::eof();\r
+\r
+ if(frame1 == draw_frame::empty() && frame2 == draw_frame::empty())\r
+ return draw_frame::empty();\r
+ \r
+ if(frame1 == frame2 || mode == field_mode::progressive)\r
+ return frame2;\r
+\r
+ auto my_frame1 = make_safe<draw_frame>(frame1);\r
+ auto my_frame2 = make_safe<draw_frame>(frame2);\r
+ if(mode == field_mode::upper)\r
+ {\r
+ my_frame1->get_frame_transform().field_mode = field_mode::upper; \r
+ my_frame2->get_frame_transform().field_mode = field_mode::lower; \r
+ } \r
+ else \r
+ { \r
+ my_frame1->get_frame_transform().field_mode = field_mode::lower; \r
+ my_frame2->get_frame_transform().field_mode = field_mode::upper; \r
+ }\r
+\r
+ std::vector<safe_ptr<draw_frame>> frames;\r
+ frames.push_back(my_frame1);\r
+ frames.push_back(my_frame2);\r
+ return make_safe<draw_frame>(std::move(frames));\r
+}\r
+\r
+safe_ptr<draw_frame> draw_frame::combine(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2)\r
+{ \r
+ if(frame1 == draw_frame::eof() || frame2 == draw_frame::eof())\r
+ return draw_frame::eof();\r
+ \r
+ if(frame1 == draw_frame::empty() && frame2 == draw_frame::empty())\r
+ return draw_frame::empty();\r
+\r
+ std::vector<safe_ptr<draw_frame>> frames;\r
+ frames.push_back(frame1);\r
+ frames.push_back(frame2);\r
+ return make_safe<draw_frame>(std::move(frames));\r
+}\r
+\r
+safe_ptr<draw_frame> draw_frame::fill_and_key(const safe_ptr<draw_frame>& fill, const safe_ptr<draw_frame>& key)\r
+{ \r
+ if(fill == draw_frame::eof() || key == draw_frame::eof())\r
+ return draw_frame::eof();\r
+\r
+ if(fill == draw_frame::empty() || key == draw_frame::empty())\r
+ return draw_frame::empty();\r
+\r
+ std::vector<safe_ptr<draw_frame>> frames;\r
+ key->get_frame_transform().is_key = true;\r
+ frames.push_back(key);\r
+ frames.push_back(fill);\r
+ return make_safe<draw_frame>(std::move(frames));\r
+}\r
+ \r
+safe_ptr<draw_frame> disable_audio(const safe_ptr<draw_frame>& frame)\r
+{\r
+ auto frame2 = make_safe<draw_frame>(frame);\r
+ frame2->get_frame_transform().volume = 0.0;\r
+ return frame2;\r
+}\r
+ \r
+}}
\ No newline at end of file
\r
namespace caspar { namespace core {\r
\r
-class basic_frame\r
+class draw_frame\r
{\r
public:\r
- basic_frame(); \r
- basic_frame(const safe_ptr<basic_frame>& frame);\r
- basic_frame(safe_ptr<basic_frame>&& frame);\r
- basic_frame(const std::vector<safe_ptr<basic_frame>>& frames);\r
- basic_frame(std::vector<safe_ptr<basic_frame>>&& frames);\r
- basic_frame(const basic_frame& other);\r
- basic_frame(basic_frame&& other);\r
+ draw_frame(); \r
+ draw_frame(const safe_ptr<draw_frame>& frame);\r
+ draw_frame(safe_ptr<draw_frame>&& frame);\r
+ draw_frame(const std::vector<safe_ptr<draw_frame>>& frames);\r
+ draw_frame(std::vector<safe_ptr<draw_frame>>&& frames);\r
+ draw_frame(const draw_frame& other);\r
+ draw_frame(draw_frame&& other);\r
\r
- basic_frame& operator=(basic_frame other);\r
+ draw_frame& operator=(draw_frame other);\r
\r
- void swap(basic_frame& other);\r
+ void swap(draw_frame& other);\r
\r
const struct frame_transform& get_frame_transform() const;\r
struct frame_transform& get_frame_transform();\r
\r
- static safe_ptr<basic_frame> interlace(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2, field_mode mode);\r
- static safe_ptr<basic_frame> combine(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2);\r
- static safe_ptr<basic_frame> fill_and_key(const safe_ptr<basic_frame>& fill, const safe_ptr<basic_frame>& key);\r
+ static safe_ptr<draw_frame> interlace(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2, field_mode mode);\r
+ static safe_ptr<draw_frame> combine(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2);\r
+ static safe_ptr<draw_frame> fill_and_key(const safe_ptr<draw_frame>& fill, const safe_ptr<draw_frame>& key);\r
\r
- static const safe_ptr<basic_frame>& eof()\r
+ static const safe_ptr<draw_frame>& eof()\r
{\r
- static safe_ptr<basic_frame> frame = make_safe<basic_frame>();\r
+ static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
return frame;\r
}\r
\r
- static const safe_ptr<basic_frame>& empty()\r
+ static const safe_ptr<draw_frame>& empty()\r
{\r
- static safe_ptr<basic_frame> frame = make_safe<basic_frame>();\r
+ static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
return frame;\r
}\r
\r
- static const safe_ptr<basic_frame>& late()\r
+ static const safe_ptr<draw_frame>& late()\r
{\r
- static safe_ptr<basic_frame> frame = make_safe<basic_frame>();\r
+ static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
return frame;\r
}\r
\r
safe_ptr<impl> impl_;\r
};\r
\r
-safe_ptr<basic_frame> disable_audio(const safe_ptr<basic_frame>& frame);\r
+safe_ptr<draw_frame> disable_audio(const safe_ptr<draw_frame>& frame);\r
\r
}}
\ No newline at end of file
\r
struct frame_visitor : boost::noncopyable\r
{\r
- virtual void begin(class basic_frame& frame) = 0;\r
+ virtual void begin(class draw_frame& frame) = 0;\r
virtual void end() = 0;\r
virtual void visit(class write_frame& frame) = 0;\r
};\r
#include "audio_mixer.h"\r
\r
#include <core/mixer/write_frame.h>\r
-#include <core/producer/frame/frame_transform.h>\r
+#include <core/frame/frame_transform.h>\r
#include <common/diagnostics/graph.h>\r
\r
#include <boost/range/adaptors.hpp>\r
transform_stack_.push(core::frame_transform());\r
}\r
\r
- void begin(core::basic_frame& frame)\r
+ void begin(core::draw_frame& frame)\r
{\r
transform_stack_.push(transform_stack_.top()*frame.get_frame_transform());\r
}\r
};\r
\r
audio_mixer::audio_mixer() : impl_(new impl()){}\r
-void audio_mixer::begin(core::basic_frame& frame){impl_->begin(frame);}\r
+void audio_mixer::begin(core::draw_frame& frame){impl_->begin(frame);}\r
void audio_mixer::visit(core::write_frame& frame){impl_->visit(frame);}\r
void audio_mixer::end(){impl_->end();}\r
audio_buffer audio_mixer::operator()(const video_format_desc& format_desc){return impl_->mix(format_desc);}\r
#include <common/forward.h>\r
#include <common/memory/safe_ptr.h>\r
\r
-#include <core/producer/frame/frame_visitor.h>\r
+#include <core/frame/frame_visitor.h>\r
\r
#include <tbb/cache_aligned_allocator.h>\r
\r
public:\r
audio_mixer();\r
\r
- virtual void begin(core::basic_frame& frame);\r
+ virtual void begin(core::draw_frame& frame);\r
virtual void visit(core::write_frame& frame);\r
virtual void end();\r
\r
#include <common/env.h>\r
\r
#include <core/video_format.h>\r
-#include <core/producer/frame/pixel_format.h>\r
-#include <core/producer/frame/frame_transform.h>\r
+#include <core/frame/pixel_format.h>\r
+#include <core/frame/frame_transform.h>\r
\r
#include <boost/noncopyable.hpp>\r
#include <common/assert.h>\r
#include <common/enum_class.h>\r
#include <common/memory/safe_ptr.h>\r
\r
-#include <core/producer/frame/pixel_format.h>\r
-#include <core/producer/frame/frame_transform.h>\r
+#include <core/frame/pixel_format.h>\r
+#include <core/frame/frame_transform.h>\r
\r
#include <boost/noncopyable.hpp>\r
\r
\r
#include <common/gl/gl_check.h>\r
\r
-#include <core/producer/frame/frame_transform.h>\r
-#include <core/producer/frame/pixel_format.h>\r
+#include <core/frame/frame_transform.h>\r
+#include <core/frame/pixel_format.h>\r
#include <core/video_format.h>\r
\r
#include <gl/glew.h>\r
layers_.push_back(std::make_pair(blend_mode, std::vector<item>()));\r
}\r
\r
- void begin(basic_frame& frame)\r
+ void begin(draw_frame& frame)\r
{\r
transform_stack_.push_back(transform_stack_.back()*frame.get_frame_transform());\r
}\r
};\r
\r
image_mixer::image_mixer(const safe_ptr<accelerator>& ogl) : impl_(new impl(ogl)){}\r
-void image_mixer::begin(basic_frame& frame){impl_->begin(frame);}\r
+void image_mixer::begin(draw_frame& frame){impl_->begin(frame);}\r
void image_mixer::visit(write_frame& frame){impl_->visit(frame);}\r
void image_mixer::end(){impl_->end();}\r
boost::unique_future<safe_ptr<host_buffer>> image_mixer::operator()(const video_format_desc& format_desc){return impl_->render(format_desc);}\r
#include <common/forward.h>\r
#include <common/memory/safe_ptr.h>\r
\r
-#include <core/producer/frame/frame_visitor.h>\r
+#include <core/frame/frame_visitor.h>\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
\r
public:\r
image_mixer(const safe_ptr<class accelerator>& ogl);\r
\r
- virtual void begin(class basic_frame& frame);\r
+ virtual void begin(class draw_frame& frame);\r
virtual void visit(class write_frame& frame);\r
virtual void end();\r
\r
#include <common/forward.h>\r
#include <common/memory/safe_ptr.h>\r
\r
-#include <core/producer/frame/frame_visitor.h>\r
+#include <core/frame/frame_visitor.h>\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
FORWARD3(caspar, core, gpu, class host_buffer);\r
{\r
virtual ~image_mixer(){}\r
\r
- virtual void begin(class basic_frame& frame) = 0;\r
+ virtual void begin(class draw_frame& frame) = 0;\r
virtual void visit(class write_frame& frame) = 0;\r
virtual void end() = 0;\r
\r
#include <common/gl/gl_check.h>\r
#include <common/utility/tweener.h>\r
\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_factory.h>\r
-#include <core/producer/frame/frame_transform.h>\r
-#include <core/producer/frame/pixel_format.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/video_format.h>\r
\r
#include <boost/foreach.hpp>\r
{ \r
} \r
\r
- safe_ptr<const frame> operator()(std::map<int, safe_ptr<basic_frame>> frames, const video_format_desc& format_desc)\r
+ safe_ptr<const data_frame> operator()(std::map<int, safe_ptr<draw_frame>> frames, const video_format_desc& format_desc)\r
{ \r
- return executor_.invoke([=]() mutable -> safe_ptr<const struct frame>\r
+ return executor_.invoke([=]() mutable -> safe_ptr<const struct data_frame>\r
{ \r
try\r
{ \r
catch(...)\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
- return frame::empty();\r
+ return data_frame::empty();\r
} \r
}); \r
}\r
: impl_(new impl(ogl)){}\r
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
-safe_ptr<const frame> mixer::operator()(std::map<int, safe_ptr<basic_frame>> frames, const struct video_format_desc& format_desc){return (*impl_)(std::move(frames), format_desc);}\r
+safe_ptr<const data_frame> mixer::operator()(std::map<int, safe_ptr<draw_frame>> frames, const struct video_format_desc& format_desc){return (*impl_)(std::move(frames), format_desc);}\r
}}
\ No newline at end of file
\r
// subject\r
\r
- safe_ptr<const struct frame> operator()(std::map<int, safe_ptr<class basic_frame>> frames, const struct video_format_desc& format_desc);\r
+ safe_ptr<const struct data_frame> operator()(std::map<int, safe_ptr<class draw_frame>> frames, const struct video_format_desc& format_desc);\r
\r
private:\r
struct impl;\r
\r
#include "read_frame.h"\r
#include "../video_format.h"\r
-#include "../producer/frame/pixel_format.h"\r
+#include "../frame/pixel_format.h"\r
\r
#include "gpu/host_buffer.h" \r
\r
//\r
//void CopyFrame( void * pSrc, void * pDest, UINT width, UINT height, UINT pitch );\r
//\r
-//void* copy_frame(void* dest, const safe_ptr<const frame>& frame)\r
+//void* copy_frame(void* dest, const safe_ptr<const data_frame>& frame)\r
//{\r
// auto src = frame->image_data().begin();\r
// auto height = 720;\r
\r
#pragma once\r
\r
-#include "../frame.h"\r
+#include "../frame/data_frame.h"\r
\r
#include <common/memory/safe_ptr.h>\r
#include <common/forward.h>\r
\r
namespace caspar { namespace core {\r
\r
-class read_frame sealed : public frame\r
+class read_frame sealed : public data_frame\r
{\r
read_frame(boost::unique_future<safe_ptr<gpu::host_buffer>>&& image_data, audio_buffer&& audio_data, const struct video_format_desc& format_desc);\r
public:\r
#include "gpu/device_buffer.h"\r
\r
#include <common/exception/exceptions.h>\r
-#include <core/producer/frame/frame_visitor.h>\r
-#include <core/producer/frame/pixel_format.h>\r
+#include <core/frame/frame_visitor.h>\r
+#include <core/frame/pixel_format.h>\r
\r
#include <boost/lexical_cast.hpp>\r
\r
#include <common/memory/safe_ptr.h>\r
#include <common/forward.h>\r
\r
-#include <core/producer/frame/basic_frame.h>\r
+#include <core/frame/draw_frame.h>\r
#include <core/video_format.h>\r
#include <core/mixer/audio/audio_mixer.h>\r
\r
\r
namespace caspar { namespace core {\r
\r
-class write_frame sealed : public core::basic_frame\r
+class write_frame sealed : public core::draw_frame\r
{\r
public: \r
explicit write_frame(const void* tag);\r
write_frame(write_frame&& other);\r
write_frame& operator=(write_frame&& other);\r
\r
- // basic_frame\r
+ // draw_frame\r
\r
virtual void accept(struct frame_visitor& visitor) override;\r
\r
#include "color_producer.h"\r
\r
#include "../frame_producer.h"\r
-#include "../frame/basic_frame.h"\r
-#include "../frame/frame_factory.h"\r
-#include "../frame/pixel_format.h"\r
+#include "../../frame/draw_frame.h"\r
+#include "../../frame/frame_factory.h"\r
+#include "../../frame/pixel_format.h"\r
#include "../../mixer/write_frame.h"\r
\r
#include <common/exception/exceptions.h>\r
\r
class color_producer : public frame_producer\r
{\r
- safe_ptr<basic_frame> frame_;\r
+ safe_ptr<draw_frame> frame_;\r
const std::wstring color_str_;\r
\r
public:\r
\r
// frame_producer\r
\r
- virtual safe_ptr<basic_frame> receive(int) override\r
+ virtual safe_ptr<draw_frame> receive(int) override\r
{\r
return frame_;\r
} \r
\r
- virtual safe_ptr<basic_frame> last_frame() const override\r
+ virtual safe_ptr<draw_frame> last_frame() const override\r
{\r
return frame_; \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
-#include "../../stdafx.h"\r
-\r
-#include "basic_frame.h"\r
-\r
-#include "frame_transform.h"\r
-\r
-#include <boost/foreach.hpp>\r
-\r
-namespace caspar { namespace core {\r
- \r
-struct basic_frame::impl\r
-{ \r
- std::vector<safe_ptr<basic_frame>> frames_;\r
-\r
- frame_transform frame_transform_; \r
-public:\r
- impl(const std::vector<safe_ptr<basic_frame>>& frames) : frames_(frames) \r
- {\r
- }\r
-\r
- impl(std::vector<safe_ptr<basic_frame>>&& frames) : frames_(std::move(frames))\r
- {\r
- }\r
-\r
- impl(safe_ptr<basic_frame>&& frame) \r
- {\r
- frames_.push_back(std::move(frame));\r
- }\r
-\r
- impl(const safe_ptr<basic_frame>& frame) \r
- { \r
- frames_.push_back(frame);\r
- }\r
- \r
- void accept(basic_frame& self, frame_visitor& visitor)\r
- {\r
- visitor.begin(self);\r
- BOOST_FOREACH(auto frame, frames_)\r
- frame->accept(visitor);\r
- visitor.end();\r
- } \r
-};\r
- \r
-basic_frame::basic_frame() : impl_(new impl(std::vector<safe_ptr<basic_frame>>())){}\r
-basic_frame::basic_frame(const std::vector<safe_ptr<basic_frame>>& frames) : impl_(new impl(frames)){}\r
-basic_frame::basic_frame(const basic_frame& other) : impl_(new impl(*other.impl_)){}\r
-basic_frame::basic_frame(std::vector<safe_ptr<basic_frame>>&& frames) : impl_(new impl(frames)){}\r
-basic_frame::basic_frame(const safe_ptr<basic_frame>& frame) : impl_(new impl(frame)){}\r
-basic_frame::basic_frame(safe_ptr<basic_frame>&& frame) : impl_(new impl(std::move(frame))){}\r
-basic_frame::basic_frame(basic_frame&& other) : impl_(std::move(other.impl_)){}\r
-basic_frame& basic_frame::operator=(basic_frame other)\r
-{\r
- other.swap(*this);\r
- return *this;\r
-}\r
-void basic_frame::swap(basic_frame& other){impl_.swap(other.impl_);}\r
-\r
-const frame_transform& basic_frame::get_frame_transform() const { return impl_->frame_transform_;}\r
-frame_transform& basic_frame::get_frame_transform() { return impl_->frame_transform_;}\r
-void basic_frame::accept(frame_visitor& visitor){impl_->accept(*this, visitor);}\r
-\r
-safe_ptr<basic_frame> basic_frame::interlace(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2, field_mode mode)\r
-{ \r
- if(frame1 == basic_frame::eof() || frame2 == basic_frame::eof())\r
- return basic_frame::eof();\r
-\r
- if(frame1 == basic_frame::empty() && frame2 == basic_frame::empty())\r
- return basic_frame::empty();\r
- \r
- if(frame1 == frame2 || mode == field_mode::progressive)\r
- return frame2;\r
-\r
- auto my_frame1 = make_safe<basic_frame>(frame1);\r
- auto my_frame2 = make_safe<basic_frame>(frame2);\r
- if(mode == field_mode::upper)\r
- {\r
- my_frame1->get_frame_transform().field_mode = field_mode::upper; \r
- my_frame2->get_frame_transform().field_mode = field_mode::lower; \r
- } \r
- else \r
- { \r
- my_frame1->get_frame_transform().field_mode = field_mode::lower; \r
- my_frame2->get_frame_transform().field_mode = field_mode::upper; \r
- }\r
-\r
- std::vector<safe_ptr<basic_frame>> frames;\r
- frames.push_back(my_frame1);\r
- frames.push_back(my_frame2);\r
- return make_safe<basic_frame>(std::move(frames));\r
-}\r
-\r
-safe_ptr<basic_frame> basic_frame::combine(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2)\r
-{ \r
- if(frame1 == basic_frame::eof() || frame2 == basic_frame::eof())\r
- return basic_frame::eof();\r
- \r
- if(frame1 == basic_frame::empty() && frame2 == basic_frame::empty())\r
- return basic_frame::empty();\r
-\r
- std::vector<safe_ptr<basic_frame>> frames;\r
- frames.push_back(frame1);\r
- frames.push_back(frame2);\r
- return make_safe<basic_frame>(std::move(frames));\r
-}\r
-\r
-safe_ptr<basic_frame> basic_frame::fill_and_key(const safe_ptr<basic_frame>& fill, const safe_ptr<basic_frame>& key)\r
-{ \r
- if(fill == basic_frame::eof() || key == basic_frame::eof())\r
- return basic_frame::eof();\r
-\r
- if(fill == basic_frame::empty() || key == basic_frame::empty())\r
- return basic_frame::empty();\r
-\r
- std::vector<safe_ptr<basic_frame>> frames;\r
- key->get_frame_transform().is_key = true;\r
- frames.push_back(key);\r
- frames.push_back(fill);\r
- return make_safe<basic_frame>(std::move(frames));\r
-}\r
- \r
-safe_ptr<basic_frame> disable_audio(const safe_ptr<basic_frame>& frame)\r
-{\r
- auto frame2 = make_safe<basic_frame>(frame);\r
- frame2->get_frame_transform().volume = 0.0;\r
- return frame2;\r
-}\r
- \r
-}}
\ No newline at end of file
#include "../StdAfx.h"\r
\r
#include "frame_producer.h"\r
-#include "frame/basic_frame.h"\r
-#include "frame/frame_transform.h"\r
+\r
+#include "../frame/draw_frame.h"\r
+#include "../frame/frame_transform.h"\r
\r
#include "color/color_producer.h"\r
#include "separated/separated_producer.h"\r
}\r
}\r
\r
- virtual safe_ptr<basic_frame> receive(int hints) override {return (*producer_)->receive(hints);}\r
- virtual safe_ptr<basic_frame> last_frame() const override {return (*producer_)->last_frame();}\r
+ virtual safe_ptr<draw_frame> receive(int hints) override {return (*producer_)->receive(hints);}\r
+ virtual safe_ptr<draw_frame> last_frame() const override {return (*producer_)->last_frame();}\r
virtual std::wstring print() const override {return (*producer_)->print();}\r
virtual boost::property_tree::wptree info() const override {return (*producer_)->info();}\r
virtual boost::unique_future<std::wstring> call(const std::wstring& str) override {return (*producer_)->call(str);}\r
CASPAR_LOG(info) << str << L" Uninitialized.";\r
}\r
\r
- virtual safe_ptr<basic_frame> receive(int hints) override {return (producer_)->receive(hints);}\r
- virtual safe_ptr<basic_frame> last_frame() const override {return (producer_)->last_frame();}\r
+ virtual safe_ptr<draw_frame> receive(int hints) override {return (producer_)->receive(hints);}\r
+ virtual safe_ptr<draw_frame> last_frame() const override {return (producer_)->last_frame();}\r
virtual std::wstring print() const override {return (producer_)->print();}\r
virtual boost::property_tree::wptree info() const override {return (producer_)->info();}\r
virtual boost::unique_future<std::wstring> call(const std::wstring& str) override {return (producer_)->call(str);}\r
class last_frame_producer : public frame_producer\r
{\r
const std::wstring print_;\r
- const safe_ptr<basic_frame> frame_;\r
+ const safe_ptr<draw_frame> frame_;\r
const uint32_t nb_frames_;\r
public:\r
last_frame_producer(const safe_ptr<frame_producer>& producer) \r
: print_(producer->print())\r
- , frame_(producer->last_frame() != basic_frame::eof() ? producer->last_frame() : basic_frame::empty())\r
+ , frame_(producer->last_frame() != draw_frame::eof() ? producer->last_frame() : draw_frame::empty())\r
, nb_frames_(producer->nb_frames())\r
{\r
}\r
\r
- virtual safe_ptr<basic_frame> receive(int){return frame_;}\r
- virtual safe_ptr<core::basic_frame> last_frame() const{return frame_;}\r
+ virtual safe_ptr<draw_frame> receive(int){return frame_;}\r
+ virtual safe_ptr<core::draw_frame> last_frame() const{return frame_;}\r
virtual std::wstring print() const{return L"dummy[" + print_ + L"]";}\r
virtual uint32_t nb_frames() const {return nb_frames_;} \r
virtual boost::property_tree::wptree info() const override\r
\r
struct empty_frame_producer : public frame_producer\r
{\r
- virtual safe_ptr<basic_frame> receive(int){return basic_frame::empty();}\r
- virtual safe_ptr<basic_frame> last_frame() const{return basic_frame::empty();}\r
+ virtual safe_ptr<draw_frame> receive(int){return draw_frame::empty();}\r
+ virtual safe_ptr<draw_frame> last_frame() const{return draw_frame::empty();}\r
virtual void set_frame_factory(const safe_ptr<frame_factory>&){}\r
virtual uint32_t nb_frames() const {return 0;}\r
virtual std::wstring print() const { return L"empty";}\r
return producer;\r
} \r
\r
-safe_ptr<basic_frame> receive_and_follow(safe_ptr<frame_producer>& producer, int hints)\r
+safe_ptr<draw_frame> receive_and_follow(safe_ptr<frame_producer>& producer, int hints)\r
{ \r
auto frame = producer->receive(hints);\r
- if(frame == basic_frame::eof())\r
+ if(frame == draw_frame::eof())\r
{\r
CASPAR_LOG(info) << producer->print() << " End Of File.";\r
auto following = producer->get_following_producer();\r
\r
virtual uint32_t nb_frames() const {return std::numeric_limits<uint32_t>::max();}\r
\r
- virtual safe_ptr<class basic_frame> receive(int flags) = 0;\r
- virtual safe_ptr<class basic_frame> last_frame() const = 0;\r
+ virtual safe_ptr<class draw_frame> receive(int flags) = 0;\r
+ virtual safe_ptr<class draw_frame> last_frame() const = 0;\r
\r
static const safe_ptr<frame_producer>& empty(); // nothrow\r
};\r
\r
-safe_ptr<class basic_frame> receive_and_follow(safe_ptr<frame_producer>& producer, int flags);\r
+safe_ptr<class draw_frame> receive_and_follow(safe_ptr<frame_producer>& producer, int flags);\r
\r
typedef std::function<safe_ptr<core::frame_producer>(const safe_ptr<struct frame_factory>&, const std::vector<std::wstring>&)> producer_factory_t;\r
void register_producer_factory(const producer_factory_t& factory); // Not thread-safe.\r
#include "layer.h"\r
\r
#include "frame_producer.h"\r
-#include "frame/basic_frame.h"\r
-#include "frame/frame_transform.h"\r
+\r
+#include "../frame/draw_frame.h"\r
+#include "../frame/frame_transform.h"\r
\r
#include <boost/optional.hpp>\r
#include <boost/thread/future.hpp>\r
is_paused_ = true;\r
}\r
\r
- safe_ptr<basic_frame> receive(int flags)\r
+ safe_ptr<draw_frame> receive(int flags)\r
{ \r
try\r
{\r
return disable_audio(foreground_->last_frame());\r
\r
auto frame = receive_and_follow(foreground_, flags);\r
- if(frame == core::basic_frame::late())\r
+ if(frame == core::draw_frame::late())\r
return disable_audio(foreground_->last_frame());\r
\r
if(auto_play_delta_)\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
stop();\r
- return core::basic_frame::empty();\r
+ return core::draw_frame::empty();\r
}\r
}\r
\r
void layer::stop(){impl_->stop();}\r
bool layer::is_paused() const{return impl_->is_paused_;}\r
int64_t layer::frame_number() const{return impl_->frame_number_;}\r
-safe_ptr<basic_frame> layer::receive(int flags) {return impl_->receive(flags);}\r
+safe_ptr<draw_frame> layer::receive(int flags) {return impl_->receive(flags);}\r
safe_ptr<frame_producer> layer::foreground() const { return impl_->foreground_;}\r
safe_ptr<frame_producer> layer::background() const { return impl_->background_;}\r
bool layer::empty() const {return impl_->empty();}\r
safe_ptr<struct frame_producer> foreground() const; // nothrow\r
safe_ptr<struct frame_producer> background() const; // nothrow\r
\r
- safe_ptr<class basic_frame> receive(int flags); // nothrow\r
+ safe_ptr<class draw_frame> receive(int flags); // nothrow\r
\r
boost::property_tree::wptree info() const;\r
private:\r
#include "separated_producer.h"\r
\r
#include "../frame_producer.h"\r
-#include "../frame/basic_frame.h"\r
+#include "../../frame/draw_frame.h"\r
\r
#include <tbb/parallel_invoke.h>\r
\r
{ \r
safe_ptr<frame_producer> fill_producer_;\r
safe_ptr<frame_producer> key_producer_;\r
- safe_ptr<basic_frame> fill_;\r
- safe_ptr<basic_frame> key_;\r
- safe_ptr<basic_frame> last_frame_;\r
+ safe_ptr<draw_frame> fill_;\r
+ safe_ptr<draw_frame> key_;\r
+ safe_ptr<draw_frame> last_frame_;\r
\r
explicit separated_producer(const safe_ptr<frame_producer>& fill, const safe_ptr<frame_producer>& key) \r
: fill_producer_(fill)\r
, key_producer_(key)\r
- , fill_(core::basic_frame::late())\r
- , key_(core::basic_frame::late())\r
- , last_frame_(core::basic_frame::empty())\r
+ , fill_(core::draw_frame::late())\r
+ , key_(core::draw_frame::late())\r
+ , last_frame_(core::draw_frame::empty())\r
{\r
}\r
\r
// frame_producer\r
\r
- virtual safe_ptr<basic_frame> receive(int flags) override\r
+ virtual safe_ptr<draw_frame> receive(int flags) override\r
{\r
tbb::parallel_invoke(\r
[&]\r
{\r
- if(fill_ == core::basic_frame::late())\r
+ if(fill_ == core::draw_frame::late())\r
fill_ = receive_and_follow(fill_producer_, flags);\r
},\r
[&]\r
{\r
- if(key_ == core::basic_frame::late())\r
+ if(key_ == core::draw_frame::late())\r
key_ = receive_and_follow(key_producer_, flags | frame_producer::flags::alpha_only);\r
});\r
\r
- if(fill_ == basic_frame::eof() || key_ == basic_frame::eof())\r
- return basic_frame::eof();\r
+ if(fill_ == draw_frame::eof() || key_ == draw_frame::eof())\r
+ return draw_frame::eof();\r
\r
- if(fill_ == core::basic_frame::late() || key_ == core::basic_frame::late()) // One of the producers is lagging, keep them in sync.\r
- return core::basic_frame::late();\r
+ if(fill_ == core::draw_frame::late() || key_ == core::draw_frame::late()) // One of the producers is lagging, keep them in sync.\r
+ return core::draw_frame::late();\r
\r
- auto frame = basic_frame::fill_and_key(fill_, key_);\r
+ auto frame = draw_frame::fill_and_key(fill_, key_);\r
\r
- fill_ = basic_frame::late();\r
- key_ = basic_frame::late();\r
+ fill_ = draw_frame::late();\r
+ key_ = draw_frame::late();\r
\r
return last_frame_ = frame;\r
}\r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return last_frame_;\r
}\r
\r
#include "layer.h"\r
\r
-#include "frame/basic_frame.h"\r
-#include "frame/frame_factory.h"\r
+#include "../frame/draw_frame.h"\r
+#include "../frame/frame_factory.h"\r
\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
\r
-#include <core/producer/frame/frame_transform.h>\r
+#include <core/frame/frame_transform.h>\r
\r
#include <boost/foreach.hpp>\r
#include <boost/timer.hpp>\r
{\r
}\r
\r
- std::map<int, safe_ptr<basic_frame>> operator()(const struct video_format_desc& format_desc)\r
+ std::map<int, safe_ptr<draw_frame>> operator()(const struct video_format_desc& format_desc)\r
{ \r
- return executor_.invoke([=]() -> std::map<int, safe_ptr<basic_frame>>\r
+ return executor_.invoke([=]() -> std::map<int, safe_ptr<draw_frame>>\r
{\r
- std::map<int, safe_ptr<class basic_frame>> result;\r
+ std::map<int, safe_ptr<class draw_frame>> result;\r
\r
try\r
{ \r
BOOST_FOREACH(auto& layer, layers_) \r
- result[layer.first] = basic_frame::empty(); \r
+ result[layer.first] = draw_frame::empty(); \r
\r
auto format_desc2 = format_desc;\r
\r
\r
auto frame = layer.second.receive(flags); \r
\r
- auto frame1 = make_safe<core::basic_frame>(frame);\r
+ auto frame1 = make_safe<core::draw_frame>(frame);\r
frame1->get_frame_transform() = transform;\r
\r
if(format_desc2.field_mode != core::field_mode::progressive)\r
{ \r
- auto frame2 = make_safe<core::basic_frame>(frame);\r
+ auto frame2 = make_safe<core::draw_frame>(frame);\r
frame2->get_frame_transform() = transforms_[layer.first].fetch_and_tick(1);\r
- frame1 = core::basic_frame::interlace(frame1, frame2, format_desc2.field_mode);\r
+ frame1 = core::draw_frame::interlace(frame1, frame2, format_desc2.field_mode);\r
}\r
\r
result[layer.first] = frame1;\r
boost::unique_future<std::wstring> stage::call(int index, bool foreground, const std::wstring& param){return impl_->call(index, foreground, param);}\r
boost::unique_future<boost::property_tree::wptree> stage::info() const{return impl_->info();}\r
boost::unique_future<boost::property_tree::wptree> stage::info(int index) const{return impl_->info(index);}\r
-std::map<int, safe_ptr<class basic_frame>> stage::operator()(const video_format_desc& format_desc){return (*impl_)(format_desc);}\r
+std::map<int, safe_ptr<class draw_frame>> stage::operator()(const video_format_desc& format_desc){return (*impl_)(format_desc);}\r
}}
\ No newline at end of file
\r
stage();\r
\r
- std::map<int, safe_ptr<class basic_frame>> operator()(const struct video_format_desc& format_desc);\r
+ std::map<int, safe_ptr<class draw_frame>> operator()(const struct video_format_desc& format_desc);\r
\r
void apply_transforms(const std::vector<transform_tuple_t>& transforms);\r
void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
#include "transition_producer.h"\r
\r
#include "../frame_producer.h"\r
-#include "../frame/basic_frame.h"\r
-#include "../frame/frame_transform.h"\r
+#include "../../frame/draw_frame.h"\r
+#include "../../frame/frame_transform.h"\r
\r
#include <tbb/parallel_invoke.h>\r
\r
safe_ptr<frame_producer> dest_producer_;\r
safe_ptr<frame_producer> source_producer_;\r
\r
- safe_ptr<basic_frame> last_frame_;\r
+ safe_ptr<draw_frame> last_frame_;\r
\r
explicit transition_producer(const field_mode& mode, const safe_ptr<frame_producer>& dest, const transition_info& info) \r
: mode_(mode)\r
, info_(info)\r
, dest_producer_(dest)\r
, source_producer_(frame_producer::empty())\r
- , last_frame_(basic_frame::empty()){}\r
+ , last_frame_(draw_frame::empty()){}\r
\r
// frame_producer\r
\r
source_producer_ = producer;\r
}\r
\r
- virtual safe_ptr<basic_frame> receive(int flags) override\r
+ virtual safe_ptr<draw_frame> receive(int flags) override\r
{\r
if(++current_frame_ >= info_.duration)\r
- return basic_frame::eof();\r
+ return draw_frame::eof();\r
\r
- auto dest = basic_frame::empty();\r
- auto source = basic_frame::empty();\r
+ auto dest = draw_frame::empty();\r
+ auto source = draw_frame::empty();\r
\r
tbb::parallel_invoke(\r
[&]\r
{\r
dest = receive_and_follow(dest_producer_, flags);\r
- if(dest == core::basic_frame::late())\r
+ if(dest == core::draw_frame::late())\r
dest = dest_producer_->last_frame();\r
},\r
[&]\r
{\r
source = receive_and_follow(source_producer_, flags);\r
- if(source == core::basic_frame::late())\r
+ if(source == core::draw_frame::late())\r
source = source_producer_->last_frame();\r
});\r
\r
return compose(dest, source);\r
}\r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return last_frame_;\r
}\r
\r
// transition_producer\r
\r
- safe_ptr<basic_frame> compose(const safe_ptr<basic_frame>& dest_frame, const safe_ptr<basic_frame>& src_frame) \r
+ safe_ptr<draw_frame> compose(const safe_ptr<draw_frame>& dest_frame, const safe_ptr<draw_frame>& src_frame) \r
{ \r
if(info_.type == transition_type::cut) \r
return src_frame;\r
\r
// For interlaced transitions. Seperate fields into seperate frames which are transitioned accordingly.\r
\r
- auto s_frame1 = make_safe<basic_frame>(src_frame);\r
- auto s_frame2 = make_safe<basic_frame>(src_frame);\r
+ auto s_frame1 = make_safe<draw_frame>(src_frame);\r
+ auto s_frame2 = make_safe<draw_frame>(src_frame);\r
\r
s_frame1->get_frame_transform().volume = 0.0;\r
s_frame2->get_frame_transform().volume = 1.0-delta2;\r
\r
- auto d_frame1 = make_safe<basic_frame>(dest_frame);\r
- auto d_frame2 = make_safe<basic_frame>(dest_frame);\r
+ auto d_frame1 = make_safe<draw_frame>(dest_frame);\r
+ auto d_frame2 = make_safe<draw_frame>(dest_frame);\r
\r
d_frame1->get_frame_transform().volume = 0.0;\r
d_frame2->get_frame_transform().volume = delta2;\r
d_frame2->get_frame_transform().clip_scale[0] = delta2; \r
}\r
\r
- const auto s_frame = s_frame1->get_frame_transform() == s_frame2->get_frame_transform() ? s_frame2 : basic_frame::interlace(s_frame1, s_frame2, mode_);\r
- const auto d_frame = d_frame1->get_frame_transform() == d_frame2->get_frame_transform() ? d_frame2 : basic_frame::interlace(d_frame1, d_frame2, mode_);\r
+ const auto s_frame = s_frame1->get_frame_transform() == s_frame2->get_frame_transform() ? s_frame2 : draw_frame::interlace(s_frame1, s_frame2, mode_);\r
+ const auto d_frame = d_frame1->get_frame_transform() == d_frame2->get_frame_transform() ? d_frame2 : draw_frame::interlace(d_frame1, d_frame2, mode_);\r
\r
- last_frame_ = basic_frame::combine(s_frame2, d_frame2);\r
+ last_frame_ = draw_frame::combine(s_frame2, d_frame2);\r
\r
- return basic_frame::combine(s_frame, d_frame);\r
+ return draw_frame::combine(s_frame, d_frame);\r
}\r
};\r
\r
#include "mixer/mixer.h"\r
#include "mixer/write_frame.h"\r
#include "mixer/gpu/accelerator.h"\r
-#include "frame.h"\r
+#include "frame/data_frame.h"\r
#include "producer/stage.h"\r
-#include "producer/frame/frame_factory.h"\r
+#include "frame/frame_factory.h"\r
\r
#include <common/diagnostics/graph.h>\r
#include <common/env.h>\r
\r
struct video_channel::impl sealed : public frame_factory\r
{\r
- reactive::basic_subject<safe_ptr<const frame>> frame_subject_;\r
+ reactive::basic_subject<safe_ptr<const data_frame>> frame_subject_;\r
const int index_;\r
\r
mutable tbb::spin_mutex format_desc_mutex_;\r
\r
namespace caspar { namespace core {\r
\r
-class video_channel sealed : public reactive::observable<safe_ptr<const struct frame>>\r
+class video_channel sealed : public reactive::observable<safe_ptr<const struct data_frame>>\r
, boost::noncopyable\r
{\r
public:\r
#include "../util/memory.h"\r
\r
#include <core/video_format.h>\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
unsigned int vid_fmt_;\r
\r
std::array<blue_dma_buffer_ptr, 4> reserved_frames_; \r
- tbb::concurrent_bounded_queue<std::shared_ptr<const core::frame>> frame_buffer_;\r
+ tbb::concurrent_bounded_queue<std::shared_ptr<const core::data_frame>> frame_buffer_;\r
\r
const bool embedded_audio_;\r
const bool key_only_;\r
CASPAR_LOG(error)<< print() << TEXT(" Failed to disable video output."); \r
}\r
\r
- void send(const safe_ptr<const core::frame>& frame)\r
+ void send(const safe_ptr<const core::data_frame>& frame)\r
{ \r
executor_.begin_invoke([=]\r
{\r
});\r
}\r
\r
- void display_frame(const safe_ptr<const core::frame>& frame)\r
+ void display_frame(const safe_ptr<const core::data_frame>& frame)\r
{\r
// Sync\r
\r
CASPAR_LOG(info) << print() << L" Successfully Initialized."; \r
}\r
\r
- virtual bool send(const safe_ptr<const core::frame>& frame) override\r
+ virtual bool send(const safe_ptr<const core::data_frame>& frame) override\r
{\r
CASPAR_VERIFY(audio_cadence_.front() == static_cast<size_t>(frame->audio_data().size()));\r
boost::range::rotate(audio_cadence_, std::begin(audio_cadence_)+1);\r
\r
#include "../interop/DeckLinkAPI_h.h"\r
\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/mixer/audio/audio_mixer.h>\r
\r
#include <common/concurrency/executor.h>\r
class decklink_frame : public IDeckLinkVideoFrame\r
{\r
tbb::atomic<int> ref_count_;\r
- std::shared_ptr<const core::frame> frame_;\r
+ std::shared_ptr<const core::data_frame> frame_;\r
const core::video_format_desc format_desc_;\r
\r
const bool key_only_;\r
std::vector<uint8_t, tbb::cache_aligned_allocator<uint8_t>> data_;\r
public:\r
- decklink_frame(const safe_ptr<const core::frame>& frame, const core::video_format_desc& format_desc, bool key_only)\r
+ decklink_frame(const safe_ptr<const core::data_frame>& frame, const core::video_format_desc& format_desc, bool key_only)\r
: frame_(frame)\r
, format_desc_(format_desc)\r
, key_only_(key_only)\r
\r
boost::circular_buffer<std::vector<int32_t>> audio_container_;\r
\r
- tbb::concurrent_bounded_queue<std::shared_ptr<const core::frame>> video_frame_buffer_;\r
- tbb::concurrent_bounded_queue<std::shared_ptr<const core::frame>> audio_frame_buffer_;\r
+ tbb::concurrent_bounded_queue<std::shared_ptr<const core::data_frame>> video_frame_buffer_;\r
+ tbb::concurrent_bounded_queue<std::shared_ptr<const core::data_frame>> audio_frame_buffer_;\r
\r
safe_ptr<diagnostics::graph> graph_;\r
boost::timer tick_timer_;\r
output_->BeginAudioPreroll(); \r
\r
for(int n = 0; n < buffer_size_; ++n)\r
- schedule_next_video(core::frame::empty());\r
+ schedule_next_video(core::data_frame::empty());\r
\r
if(!config.embedded_audio)\r
start_playback();\r
~decklink_consumer()\r
{ \r
is_running_ = false;\r
- video_frame_buffer_.try_push(core::frame::empty());\r
- audio_frame_buffer_.try_push(core::frame::empty());\r
+ video_frame_buffer_.try_push(core::data_frame::empty());\r
+ audio_frame_buffer_.try_push(core::data_frame::empty());\r
\r
if(output_ != nullptr) \r
{\r
else if(result == bmdOutputFrameFlushed)\r
graph_->set_tag("flushed-frame");\r
\r
- std::shared_ptr<const core::frame> frame; \r
+ std::shared_ptr<const core::data_frame> frame; \r
video_frame_buffer_.pop(frame); \r
schedule_next_video(make_safe_ptr(frame)); \r
\r
}\r
else\r
{\r
- std::shared_ptr<const core::frame> frame;\r
+ std::shared_ptr<const core::data_frame> frame;\r
audio_frame_buffer_.pop(frame);\r
schedule_next_audio(frame->audio_data());\r
}\r
audio_scheduled_ += sample_frame_count;\r
}\r
\r
- void schedule_next_video(const safe_ptr<const core::frame>& frame)\r
+ void schedule_next_video(const safe_ptr<const core::data_frame>& frame)\r
{\r
CComPtr<IDeckLinkVideoFrame> frame2(new decklink_frame(frame, format_desc_, config_.key_only));\r
if(FAILED(output_->ScheduleVideoFrame(frame2, video_scheduled_, format_desc_.duration, format_desc_.time_scale)))\r
tick_timer_.restart();\r
}\r
\r
- void send(const safe_ptr<const core::frame>& frame)\r
+ void send(const safe_ptr<const core::data_frame>& frame)\r
{\r
auto exception = lock(exception_mutex_, [&]\r
{\r
});\r
}\r
\r
- virtual bool send(const safe_ptr<const core::frame>& frame) override\r
+ virtual bool send(const safe_ptr<const core::data_frame>& frame) override\r
{\r
CASPAR_VERIFY(audio_cadence_.front() == static_cast<int>(frame->audio_data().size()));\r
boost::range::rotate(audio_cadence_, std::begin(audio_cadence_)+1);\r
#include <common/utility/param.h>\r
\r
#include <core/mixer/write_frame.h>\r
-#include <core/producer/frame/frame_transform.h>\r
-#include <core/producer/frame/frame_factory.h>\r
+#include <core/frame/frame_transform.h>\r
+#include <core/frame/frame_factory.h>\r
\r
#include <tbb/concurrent_queue.h>\r
\r
safe_ptr<core::frame_factory> frame_factory_;\r
std::vector<int> audio_cadence_;\r
\r
- tbb::concurrent_bounded_queue<safe_ptr<core::basic_frame>> frame_buffer_;\r
+ tbb::concurrent_bounded_queue<safe_ptr<core::draw_frame>> frame_buffer_;\r
\r
std::exception_ptr exception_;\r
\r
return S_OK;\r
}\r
\r
- safe_ptr<core::basic_frame> get_frame(int flags)\r
+ safe_ptr<core::draw_frame> get_frame(int flags)\r
{\r
if(exception_ != nullptr)\r
std::rethrow_exception(exception_);\r
\r
flags_ = flags;\r
\r
- safe_ptr<core::basic_frame> frame = core::basic_frame::late();\r
+ safe_ptr<core::draw_frame> frame = core::draw_frame::late();\r
if(!frame_buffer_.try_pop(frame))\r
graph_->set_tag("late-frame");\r
graph_->set_value("output-buffer", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity())); \r
\r
class decklink_producer_proxy : public core::frame_producer\r
{ \r
- safe_ptr<core::basic_frame> last_frame_;\r
+ safe_ptr<core::draw_frame> last_frame_;\r
com_context<decklink_producer> context_;\r
const uint32_t length_;\r
public:\r
\r
explicit decklink_producer_proxy(const safe_ptr<core::frame_factory>& frame_factory, const core::video_format_desc& format_desc, size_t device_index, const std::wstring& filter_str, uint32_t length)\r
: context_(L"decklink_producer[" + boost::lexical_cast<std::wstring>(device_index) + L"]")\r
- , last_frame_(core::basic_frame::empty())\r
+ , last_frame_(core::draw_frame::empty())\r
, length_(length)\r
{\r
context_.reset([&]{return new decklink_producer(format_desc, device_index, frame_factory, filter_str);}); \r
\r
// frame_producer\r
\r
- virtual safe_ptr<core::basic_frame> receive(int flags) override\r
+ virtual safe_ptr<core::draw_frame> receive(int flags) override\r
{\r
auto frame = context_->get_frame(flags);\r
- if(frame != core::basic_frame::late())\r
+ if(frame != core::draw_frame::late())\r
last_frame_ = frame;\r
return frame;\r
}\r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return last_frame_;\r
}\r
\r
#include "ffmpeg_consumer.h"\r
\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/mixer/audio/audio_util.h>\r
#include <core/consumer/frame_consumer.h>\r
#include <core/video_format.h>\r
});\r
}\r
\r
- std::shared_ptr<AVFrame> convert_video_frame(const safe_ptr<const core::frame>& frame, AVCodecContext* c)\r
+ std::shared_ptr<AVFrame> convert_video_frame(const safe_ptr<const core::data_frame>& frame, AVCodecContext* c)\r
{\r
if(!sws_) \r
{\r
return local_av_frame;\r
}\r
\r
- std::shared_ptr<AVPacket> encode_video_frame(const safe_ptr<const core::frame>& frame)\r
+ std::shared_ptr<AVPacket> encode_video_frame(const safe_ptr<const core::data_frame>& frame)\r
{ \r
auto c = video_st_->codec;\r
\r
return nullptr;\r
}\r
\r
- std::shared_ptr<AVPacket> encode_audio_frame(const safe_ptr<const core::frame>& frame)\r
+ std::shared_ptr<AVPacket> encode_audio_frame(const safe_ptr<const core::data_frame>& frame)\r
{ \r
auto c = audio_st_->codec;\r
\r
return pkt;\r
}\r
\r
- void send(const safe_ptr<const core::frame>& frame)\r
+ void send(const safe_ptr<const core::data_frame>& frame)\r
{\r
executor_.begin_invoke([=]\r
{ \r
consumer_.reset(new ffmpeg_consumer(filename_, format_desc, codec_, options_));\r
}\r
\r
- virtual bool send(const safe_ptr<const core::frame>& frame) override\r
+ virtual bool send(const safe_ptr<const core::data_frame>& frame) override\r
{\r
consumer_->send(frame);\r
return true;\r
\r
#include <core/video_format.h>\r
#include <core/producer/frame_producer.h>\r
-#include <core/producer/frame/frame_factory.h>\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_transform.h>\r
+#include <core/frame/frame_factory.h>\r
+#include <core/frame/draw_frame.h>\r
+#include <core/frame/frame_transform.h>\r
\r
#include <boost/algorithm/string.hpp>\r
#include <common/assert.h>\r
const uint32_t start_;\r
const uint32_t length_;\r
\r
- safe_ptr<core::basic_frame> last_frame_;\r
+ safe_ptr<core::draw_frame> last_frame_;\r
\r
- std::queue<std::pair<safe_ptr<core::basic_frame>, uint32_t>> frame_buffer_;\r
+ std::queue<std::pair<safe_ptr<core::draw_frame>, uint32_t>> frame_buffer_;\r
\r
int64_t frame_number_;\r
uint32_t file_frame_number_;\r
, fps_(read_fps(*input_.context(), format_desc_.fps))\r
, start_(start)\r
, length_(length)\r
- , last_frame_(core::basic_frame::empty())\r
+ , last_frame_(core::draw_frame::empty())\r
, frame_number_(0)\r
{\r
graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
\r
// frame_producer\r
\r
- virtual safe_ptr<core::basic_frame> receive(int flags) override\r
+ virtual safe_ptr<core::draw_frame> receive(int flags) override\r
{ \r
frame_timer_.restart();\r
\r
if(frame_buffer_.empty())\r
{\r
graph_->set_tag("underflow"); \r
- return core::basic_frame::late(); \r
+ return core::draw_frame::late(); \r
}\r
\r
auto frame = frame_buffer_.front(); \r
return last_frame_ = frame.first;\r
}\r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return last_frame_;\r
}\r
#include "../util/util.h"\r
\r
#include <core/producer/frame_producer.h>\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_transform.h>\r
-#include <core/producer/frame/pixel_format.h>\r
-#include <core/producer/frame/frame_factory.h>\r
+#include <core/frame/draw_frame.h>\r
+#include <core/frame/frame_transform.h>\r
+#include <core/frame/pixel_format.h>\r
+#include <core/frame/frame_factory.h>\r
#include <core/mixer/write_frame.h>\r
\r
#include <common/env.h>\r
{ \r
std::queue<std::queue<safe_ptr<write_frame>>> video_streams_;\r
std::queue<core::audio_buffer> audio_streams_;\r
- std::queue<safe_ptr<basic_frame>> frame_buffer_;\r
+ std::queue<safe_ptr<draw_frame>> frame_buffer_;\r
display_mode display_mode_;\r
const double in_fps_;\r
const video_format_desc format_desc_;\r
}\r
}\r
\r
- std::shared_ptr<basic_frame> poll()\r
+ std::shared_ptr<draw_frame> poll()\r
{\r
if(!frame_buffer_.empty())\r
{\r
{ \r
auto frame2 = pop_video();\r
\r
- frame_buffer_.push(core::basic_frame::interlace(frame1, frame2, format_desc_.field_mode)); \r
+ frame_buffer_.push(core::draw_frame::interlace(frame1, frame2, format_desc_.field_mode)); \r
break;\r
}\r
case display_mode::duplicate: \r
: impl_(new impl(in_fps, frame_factory, filter)){}\r
void frame_muxer::push(const std::shared_ptr<AVFrame>& video_frame, int flags){impl_->push(video_frame, flags);}\r
void frame_muxer::push(const std::shared_ptr<core::audio_buffer>& audio_samples){return impl_->push(audio_samples);}\r
-std::shared_ptr<basic_frame> frame_muxer::poll(){return impl_->poll();}\r
+std::shared_ptr<draw_frame> frame_muxer::poll(){return impl_->poll();}\r
uint32_t frame_muxer::calc_nb_frames(uint32_t nb_frames) const {return impl_->calc_nb_frames(nb_frames);}\r
bool frame_muxer::video_ready() const{return impl_->video_ready();}\r
bool frame_muxer::audio_ready() const{return impl_->audio_ready();}\r
namespace core {\r
\r
class write_frame;\r
-class basic_frame;\r
+class draw_frame;\r
struct frame_factory;\r
\r
}\r
bool video_ready() const;\r
bool audio_ready() const;\r
\r
- std::shared_ptr<core::basic_frame> poll();\r
+ std::shared_ptr<core::draw_frame> poll();\r
\r
uint32_t calc_nb_frames(uint32_t nb_frames) const;\r
private:\r
#include <tbb/concurrent_unordered_map.h>\r
#include <tbb/concurrent_queue.h>\r
\r
-#include <core/producer/frame/frame_transform.h>\r
-#include <core/producer/frame/frame_factory.h>\r
+#include <core/frame/frame_transform.h>\r
+#include <core/frame/frame_factory.h>\r
#include <core/producer/frame_producer.h>\r
#include <core/mixer/write_frame.h>\r
\r
#include <common/memory/safe_ptr.h>\r
\r
#include <core/video_format.h>\r
-#include <core/producer/frame/pixel_format.h>\r
+#include <core/frame/pixel_format.h>\r
#include <core/mixer/audio/audio_mixer.h>\r
\r
enum PixelFormat;\r
#include "../../ffmpeg_error.h"\r
\r
#include <common/log.h>\r
-#include <core/producer/frame/frame_transform.h>\r
-#include <core/producer/frame/frame_factory.h>\r
+#include <core/frame/frame_transform.h>\r
+#include <core/frame/frame_factory.h>\r
\r
#include <boost/range/algorithm_ext/push_back.hpp>\r
#include <boost/filesystem.hpp>\r
return flash_producer_->call(str);\r
}\r
\r
- safe_ptr<core::basic_frame> receive(int flags)\r
+ safe_ptr<core::draw_frame> receive(int flags)\r
{\r
return flash_producer_->receive(flags);\r
}\r
\r
- safe_ptr<core::basic_frame> last_frame() const\r
+ safe_ptr<core::draw_frame> last_frame() const\r
{\r
return flash_producer_->last_frame();\r
} \r
\r
cg_producer::cg_producer(const safe_ptr<core::frame_producer>& frame_producer) : impl_(new impl(frame_producer)){}\r
cg_producer::cg_producer(cg_producer&& other) : impl_(std::move(other.impl_)){}\r
-safe_ptr<core::basic_frame> cg_producer::receive(int flags){return impl_->receive(flags);}\r
-safe_ptr<core::basic_frame> cg_producer::last_frame() const{return impl_->last_frame();}\r
+safe_ptr<core::draw_frame> cg_producer::receive(int flags){return impl_->receive(flags);}\r
+safe_ptr<core::draw_frame> cg_producer::last_frame() const{return impl_->last_frame();}\r
void cg_producer::add(int layer, const std::wstring& template_name, bool play_on_load, const std::wstring& startFromLabel, const std::wstring& data){impl_->add(layer, template_name, play_on_load, startFromLabel, data);}\r
void cg_producer::remove(int layer){impl_->remove(layer);}\r
void cg_producer::play(int layer){impl_->play(layer);}\r
\r
// frame_producer\r
\r
- virtual safe_ptr<core::basic_frame> receive(int) override;\r
- virtual safe_ptr<core::basic_frame> last_frame() const override;\r
+ virtual safe_ptr<core::draw_frame> receive(int) override;\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override;\r
virtual std::wstring print() const override;\r
virtual boost::unique_future<std::wstring> call(const std::wstring&) override;\r
virtual boost::property_tree::wptree info() const override;\r
\r
#include <core/video_format.h>\r
\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_factory.h>\r
-#include <core/producer/frame/pixel_format.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/mixer/write_frame.h>\r
\r
#include <common/env.h>\r
const std::shared_ptr<core::frame_factory> frame_factory_;\r
\r
CComObject<caspar::flash::FlashAxContainer>* ax_;\r
- safe_ptr<core::basic_frame> head_;\r
+ safe_ptr<core::draw_frame> head_;\r
bitmap bmp_;\r
\r
safe_ptr<diagnostics::graph> graph_;\r
, filename_(filename)\r
, frame_factory_(frame_factory)\r
, ax_(nullptr)\r
- , head_(core::basic_frame::empty())\r
+ , head_(core::draw_frame::empty())\r
, bmp_(width, height)\r
, width_(width)\r
, height_(height)\r
return result;\r
}\r
\r
- safe_ptr<core::basic_frame> render_frame(bool sync)\r
+ safe_ptr<core::draw_frame> render_frame(bool sync)\r
{\r
float frame_time = 1.0f/ax_->GetFPS();\r
\r
tick_timer_.restart();\r
\r
if(ax_->IsEmpty())\r
- return core::basic_frame::empty(); \r
+ return core::draw_frame::empty(); \r
\r
if(sync) \r
timer_.tick(frame_time); // This will block the thread.\r
\r
safe_ptr<diagnostics::graph> graph_;\r
\r
- std::queue<safe_ptr<core::basic_frame>> frame_buffer_;\r
- tbb::concurrent_bounded_queue<safe_ptr<core::basic_frame>> output_buffer_;\r
+ std::queue<safe_ptr<core::draw_frame>> frame_buffer_;\r
+ tbb::concurrent_bounded_queue<safe_ptr<core::draw_frame>> output_buffer_;\r
\r
mutable tbb::spin_mutex last_frame_mutex_;\r
- safe_ptr<core::basic_frame> last_frame_;\r
+ safe_ptr<core::draw_frame> last_frame_;\r
\r
std::unique_ptr<flash_renderer> renderer_;\r
\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
- , last_frame_(core::basic_frame::empty())\r
+ , last_frame_(core::draw_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
, buffer_size_(env::properties().get(L"configuration.flash.buffer-depth", frame_factory_->get_video_format_desc().fps > 30.0 ? 3 : 2))\r
\r
// frame_producer\r
\r
- virtual safe_ptr<core::basic_frame> receive(int) override\r
+ virtual safe_ptr<core::draw_frame> receive(int) override\r
{ \r
- auto frame = core::basic_frame::late();\r
+ auto frame = core::draw_frame::late();\r
\r
graph_->set_value("buffer-size", static_cast<float>(output_buffer_.size())/static_cast<float>(buffer_size_));\r
sync_ = output_buffer_.size() == buffer_size_;\r
return frame;\r
}\r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return lock(last_frame_mutex_, [this]\r
{\r
renderer_.reset(new flash_renderer(graph_, frame_factory_, filename_, width_, height_));\r
\r
while(output_buffer_.size() < buffer_size_)\r
- output_buffer_.push(core::basic_frame::empty());\r
+ output_buffer_.push(core::draw_frame::empty());\r
}\r
\r
return renderer_->call(param); \r
executor_.begin_invoke([this]\r
{\r
if(!renderer_)\r
- frame_buffer_.push(core::basic_frame::empty());\r
+ frame_buffer_.push(core::draw_frame::empty());\r
\r
if(frame_buffer_.empty())\r
{\r
{\r
auto frame1 = render_frame();\r
auto frame2 = render_frame();\r
- frame_buffer_.push(core::basic_frame::interlace(frame1, frame2, format_desc.field_mode));\r
+ frame_buffer_.push(core::draw_frame::interlace(frame1, frame2, format_desc.field_mode));\r
}\r
else if(abs(renderer_->fps() - format_desc.fps/2.0) < 2.0) // format == 2 * flash -> duplicate\r
{\r
});\r
}\r
\r
- safe_ptr<core::basic_frame> render_frame()\r
+ safe_ptr<core::draw_frame> render_frame()\r
{ \r
auto frame = renderer_->render_frame(sync_);\r
lock(last_frame_mutex_, [&]\r
\r
#include <core/consumer/frame_consumer.h>\r
#include <core/video_format.h>\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
\r
#include <boost/date_time/posix_time/posix_time.hpp>\r
#include <boost/thread.hpp>\r
{\r
}\r
\r
- virtual bool send(const safe_ptr<const core::frame>& frame) override\r
+ virtual bool send(const safe_ptr<const core::data_frame>& frame) override\r
{ \r
boost::thread async([frame]\r
{\r
\r
#include <core/video_format.h>\r
\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_factory.h>\r
-#include <core/producer/frame/pixel_format.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/mixer/write_frame.h>\r
\r
#include <common/env.h>\r
struct image_producer : public core::frame_producer\r
{ \r
const std::wstring filename_;\r
- safe_ptr<core::basic_frame> frame_;\r
+ safe_ptr<core::draw_frame> frame_;\r
\r
explicit image_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename) \r
: filename_(filename)\r
- , frame_(core::basic_frame::empty()) \r
+ , frame_(core::draw_frame::empty()) \r
{\r
auto bitmap = load_image(filename_);\r
FreeImage_FlipVertical(bitmap.get());\r
\r
// frame_producer\r
\r
- virtual safe_ptr<core::basic_frame> receive(int) override\r
+ virtual safe_ptr<core::draw_frame> receive(int) override\r
{\r
return frame_;\r
}\r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return frame_;\r
}\r
\r
#include <core/video_format.h>\r
\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_factory.h>\r
-#include <core/producer/frame/frame_transform.h>\r
-#include <core/producer/frame/pixel_format.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/mixer/write_frame.h>\r
\r
#include <common/env.h>\r
struct image_scroll_producer : public core::frame_producer\r
{ \r
const std::wstring filename_;\r
- std::vector<safe_ptr<core::basic_frame>> frames_;\r
+ std::vector<safe_ptr<core::draw_frame>> frames_;\r
core::video_format_desc format_desc_;\r
int width_;\r
int height_;\r
\r
std::array<double, 2> start_offset_;\r
\r
- safe_ptr<core::basic_frame> last_frame_;\r
+ safe_ptr<core::draw_frame> last_frame_;\r
\r
explicit image_scroll_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, int speed) \r
: filename_(filename)\r
, delta_(0)\r
, format_desc_(frame_factory->get_video_format_desc())\r
, speed_(speed)\r
- , last_frame_(core::basic_frame::empty())\r
+ , last_frame_(core::draw_frame::empty())\r
{\r
start_offset_.assign(0.0);\r
\r
\r
// frame_producer\r
\r
- virtual safe_ptr<core::basic_frame> receive(int) override\r
+ virtual safe_ptr<core::draw_frame> receive(int) override\r
{ \r
delta_ += speed_;\r
\r
if(frames_.empty())\r
- return core::basic_frame::eof();\r
+ return core::draw_frame::eof();\r
\r
if(height_ > format_desc_.height)\r
{\r
if(static_cast<int>(std::abs(delta_)) >= height_ - format_desc_.height)\r
- return core::basic_frame::eof();\r
+ return core::draw_frame::eof();\r
\r
for(int n = 0; n < frames_.size(); ++n)\r
{\r
else\r
{\r
if(static_cast<int>(std::abs(delta_)) >= width_ - format_desc_.width)\r
- return core::basic_frame::eof();\r
+ return core::draw_frame::eof();\r
\r
for(int n = 0; n < frames_.size(); ++n)\r
{\r
}\r
}\r
\r
- return last_frame_ = make_safe<core::basic_frame>(frames_);\r
+ return last_frame_ = make_safe<core::draw_frame>(frames_);\r
}\r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return last_frame_;\r
}\r
#include <core/mixer/audio/audio_mixer.h>\r
#include <core/video_format.h>\r
\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
\r
#include <SFML/Audio/SoundStream.hpp>\r
\r
CASPAR_LOG(info) << print() << " Sucessfully Initialized.";\r
}\r
\r
- virtual bool send(const safe_ptr<const core::frame>& frame) override\r
+ virtual bool send(const safe_ptr<const core::data_frame>& frame) override\r
{ \r
input_.push(std::make_shared<audio_buffer_16>(core::audio_32_to_16(frame->audio_data())));\r
return true;\r
#include <ffmpeg/producer/filter/filter.h>\r
\r
#include <core/video_format.h>\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
#include <core/consumer/frame_consumer.h>\r
\r
#include <boost/timer.hpp>\r
boost::timer perf_timer_;\r
boost::timer tick_timer_;\r
\r
- tbb::concurrent_bounded_queue<std::shared_ptr<const core::frame>> frame_buffer_;\r
+ tbb::concurrent_bounded_queue<std::shared_ptr<const core::data_frame>> frame_buffer_;\r
\r
boost::thread thread_;\r
tbb::atomic<bool> is_running_;\r
~ogl_consumer()\r
{\r
is_running_ = false;\r
- frame_buffer_.try_push(core::frame::empty());\r
+ frame_buffer_.try_push(core::data_frame::empty());\r
thread_.join();\r
}\r
\r
is_running_ = false;\r
}\r
\r
- std::shared_ptr<const core::frame> frame;\r
+ std::shared_ptr<const core::data_frame> frame;\r
frame_buffer_.pop(frame);\r
\r
perf_timer_.restart();\r
return av_frame;\r
}\r
\r
- void render(const safe_ptr<const core::frame>& frame)\r
+ void render(const safe_ptr<const core::data_frame>& frame)\r
{ \r
if(static_cast<int>(frame->image_data().size()) != format_desc_.size)\r
return;\r
std::rotate(pbos_.begin(), pbos_.begin() + 1, pbos_.end());\r
}\r
\r
- bool send(const safe_ptr<const core::frame>& frame)\r
+ bool send(const safe_ptr<const core::data_frame>& frame)\r
{\r
if(!frame_buffer_.try_push(frame))\r
graph_->set_tag("dropped-frame");\r
CASPAR_LOG(info) << print() << L" Successfully Initialized."; \r
}\r
\r
- virtual bool send(const safe_ptr<const core::frame>& frame) override\r
+ virtual bool send(const safe_ptr<const core::data_frame>& frame) override\r
{\r
return consumer_->send(frame);\r
}\r
#include "reroute_producer.h"\r
\r
#include <core/producer/frame_producer.h>\r
-#include <core/producer/frame/basic_frame.h>\r
-#include <core/producer/frame/frame_factory.h>\r
-#include <core/producer/frame/pixel_format.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/mixer/write_frame.h>\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
\r
#include <common/exception/exceptions.h>\r
#include <common/diagnostics/graph.h>\r
\r
namespace caspar { namespace reroute {\r
\r
-class reroute_producer : public reactive::observer<safe_ptr<const core::frame>>\r
+class reroute_producer : public reactive::observer<safe_ptr<const core::data_frame>>\r
, public core::frame_producer\r
, public enable_safe_from_this<reroute_producer>\r
{\r
const safe_ptr<diagnostics::graph> graph_;\r
const safe_ptr<core::frame_factory> frame_factory_;\r
\r
- tbb::concurrent_bounded_queue<std::shared_ptr<const core::frame>> input_buffer_;\r
- std::queue<safe_ptr<core::basic_frame>> frame_buffer_;\r
- safe_ptr<core::basic_frame> last_frame_;\r
+ tbb::concurrent_bounded_queue<std::shared_ptr<const core::data_frame>> input_buffer_;\r
+ std::queue<safe_ptr<core::draw_frame>> frame_buffer_;\r
+ safe_ptr<core::draw_frame> last_frame_;\r
uint64_t frame_number_;\r
\r
public:\r
explicit reroute_producer(const safe_ptr<core::frame_factory>& frame_factory) \r
: frame_factory_(frame_factory)\r
- , last_frame_(core::basic_frame::empty())\r
+ , last_frame_(core::draw_frame::empty())\r
, frame_number_(0)\r
{\r
graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.3f));\r
\r
// observable\r
\r
- void on_next(const safe_ptr<const core::frame>& frame)\r
+ void on_next(const safe_ptr<const core::data_frame>& frame)\r
{\r
if(!input_buffer_.try_push(frame))\r
graph_->set_tag("dropped-frame");\r
\r
// frame_producer\r
\r
- virtual safe_ptr<core::basic_frame> receive(int) override\r
+ virtual safe_ptr<core::draw_frame> receive(int) override\r
{\r
if(!frame_buffer_.empty())\r
{\r
return last_frame_ = frame;\r
}\r
\r
- std::shared_ptr<const core::frame> read_frame;\r
+ std::shared_ptr<const core::data_frame> read_frame;\r
if(input_buffer_.try_pop(read_frame) || read_frame->image_data().empty())\r
{\r
graph_->set_tag("late-frame");\r
- return core::basic_frame::late(); \r
+ return core::draw_frame::late(); \r
}\r
\r
frame_number_++;\r
return receive(0);\r
} \r
\r
- virtual safe_ptr<core::basic_frame> last_frame() const override\r
+ virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
return last_frame_; \r
} \r
}\r
};\r
\r
-safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factory>& frame_factory, reactive::observable<safe_ptr<const core::frame>>& o)\r
+safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factory>& frame_factory, reactive::observable<safe_ptr<const core::data_frame>>& o)\r
{\r
auto producer = make_safe<reroute_producer>(frame_factory);\r
o.subscribe(producer);\r
#include <common/reactive.h>\r
#include <common/forward.h>\r
\r
-#include <core/producer/frame/frame_factory.h>\r
+#include <core/frame/frame_factory.h>\r
#include <core/producer/frame_producer.h>\r
-#include <core/frame.h>\r
+#include <core/frame/data_frame.h>\r
\r
namespace caspar { namespace reroute {\r
\r
-safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factory>& frame_factory, reactive::observable<safe_ptr<const core::frame>>& o);\r
+safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factory>& frame_factory, reactive::observable<safe_ptr<const core::data_frame>>& o);\r
\r
}}\r
#include <core/producer/frame_producer.h>\r
#include <core/video_format.h>\r
#include <core/producer/transition/transition_producer.h>\r
-#include <core/producer/frame/frame_transform.h>\r
+#include <core/frame/frame_transform.h>\r
#include <core/producer/stage.h>\r
#include <core/producer/layer.h>\r
#include <core/mixer/mixer.h>\r