<ClInclude Include="StdAfx.h" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <ClCompile Include="frame\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
<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
+ <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
+ <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
<ClCompile Include="frame\draw_frame.cpp">\r
<Filter>source\frame</Filter>\r
</ClCompile>\r
+ <ClCompile Include="frame\data_frame.cpp">\r
+ <Filter>source\frame</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
--- /dev/null
+#include "../StdAfx.h"\r
+\r
+#include "data_frame.h"\r
+\r
+#include "pixel_format.h"\r
+\r
+namespace caspar { namespace core {\r
+\r
+data_frame::~data_frame()\r
+{\r
+}\r
+\r
+safe_ptr<data_frame> 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
+}}
\ No newline at end of file
#pragma once\r
\r
+#include <common/memory/safe_ptr.h>\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 pixel_format_desc;\r
+\r
struct data_frame : boost::noncopyable\r
{\r
- virtual ~data_frame()\r
- {\r
- }\r
+ virtual ~data_frame();\r
\r
virtual const struct pixel_format_desc& get_pixel_format_desc() 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
+ static safe_ptr<data_frame> empty();\r
};\r
\r
}}
\ No newline at end of file
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "draw_frame.h"\r
\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
+safe_ptr<draw_frame> draw_frame::over(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
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
+safe_ptr<draw_frame> draw_frame::mask(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
return make_safe<draw_frame>(std::move(frames));\r
}\r
\r
-safe_ptr<draw_frame> disable_audio(const safe_ptr<draw_frame>& frame)\r
+safe_ptr<draw_frame> draw_frame::silence(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
+const safe_ptr<draw_frame>& draw_frame::eof()\r
+{\r
+ static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
+ return frame;\r
+}\r
+\r
+const safe_ptr<draw_frame>& draw_frame::empty()\r
+{\r
+ static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
+ return frame;\r
+}\r
+\r
+const safe_ptr<draw_frame>& draw_frame::late()\r
+{\r
+ static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
+ return frame;\r
+}\r
\r
+\r
}}
\ No newline at end of file
{\r
public:\r
draw_frame(); \r
+ draw_frame(const draw_frame& other);\r
+ draw_frame(draw_frame&& other);\r
+ draw_frame& operator=(draw_frame other);\r
+\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
- draw_frame& operator=(draw_frame other);\r
- \r
+ \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<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
+ static safe_ptr<draw_frame> over(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2);\r
+ static safe_ptr<draw_frame> mask(const safe_ptr<draw_frame>& fill, const safe_ptr<draw_frame>& key);\r
+ static safe_ptr<draw_frame> silence(const safe_ptr<draw_frame>& frame);\r
\r
- static const safe_ptr<draw_frame>& eof()\r
- {\r
- static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
- return frame;\r
- }\r
-\r
- static const safe_ptr<draw_frame>& empty()\r
- {\r
- static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
- return frame;\r
- }\r
-\r
- static const safe_ptr<draw_frame>& late()\r
- {\r
- static safe_ptr<draw_frame> frame = make_safe<draw_frame>();\r
- return frame;\r
- }\r
+ static const safe_ptr<draw_frame>& eof();\r
+ static const safe_ptr<draw_frame>& empty();\r
+ static const safe_ptr<draw_frame>& late();\r
\r
+\r
virtual void accept(frame_visitor& visitor);\r
private:\r
struct impl;\r
safe_ptr<impl> impl_;\r
};\r
\r
-safe_ptr<draw_frame> disable_audio(const safe_ptr<draw_frame>& frame);\r
\r
}}
\ No newline at end of file
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "frame_transform.h"\r
\r
try\r
{\r
if(is_paused_)\r
- return disable_audio(foreground_->last_frame());\r
+ return draw_frame::silence(foreground_->last_frame());\r
\r
auto frame = receive_and_follow(foreground_, flags);\r
if(frame == core::draw_frame::late())\r
- return disable_audio(foreground_->last_frame());\r
+ return draw_frame::silence(foreground_->last_frame());\r
\r
if(auto_play_delta_)\r
{\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 = draw_frame::fill_and_key(fill_, key_);\r
+ auto frame = draw_frame::mask(fill_, key_);\r
\r
fill_ = draw_frame::late();\r
key_ = draw_frame::late();\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_ = draw_frame::combine(s_frame2, d_frame2);\r
+ last_frame_ = draw_frame::over(s_frame2, d_frame2);\r
\r
- return draw_frame::combine(s_frame, d_frame);\r
+ return draw_frame::over(s_frame, d_frame);\r
}\r
};\r
\r
graph_->set_value("frame-time", frame_timer_.elapsed()*format_desc_.fps*0.5);\r
\r
if(frame_buffer_.empty() && input_.eof())\r
- return disable_audio(last_frame());\r
+ return last_frame();\r
\r
if(frame_buffer_.empty())\r
{\r
\r
virtual safe_ptr<core::draw_frame> last_frame() const override\r
{\r
- return last_frame_;\r
+ return core::draw_frame::silence(last_frame_);\r
}\r
\r
virtual uint32_t nb_frames() const override\r