]> git.sesse.net Git - casparcg/commitdiff
2.1.0: Refactored away "write_frame", only "data_frame" and "draw_frame" are needed.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 13 Feb 2012 22:40:23 +0000 (22:40 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 13 Feb 2012 22:40:23 +0000 (22:40 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2395 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

33 files changed:
accelerator/accelerator.vcxproj
accelerator/accelerator.vcxproj.filters
accelerator/cpu/image/image_mixer.cpp
accelerator/cpu/image/image_mixer.h
accelerator/cpu/util/data_frame.cpp [moved from accelerator/cpu/util/write_frame.cpp with 55% similarity]
accelerator/cpu/util/data_frame.h [moved from accelerator/cpu/util/write_frame.h with 75% similarity]
accelerator/ogl/image/image_mixer.cpp
accelerator/ogl/image/image_mixer.h
accelerator/ogl/util/data_frame.cpp [moved from accelerator/ogl/util/write_frame.cpp with 57% similarity]
accelerator/ogl/util/data_frame.h [moved from accelerator/ogl/util/write_frame.h with 74% similarity]
core/core.vcxproj
core/core.vcxproj.filters
core/frame/draw_frame.cpp
core/frame/draw_frame.h
core/frame/frame_factory.h
core/frame/write_frame.h [deleted file]
core/mixer/audio/audio_mixer.cpp
core/mixer/image/image_mixer.h
core/mixer/mixer.cpp
core/mixer/mixer.h
core/producer/color/color_producer.cpp
core/producer/color/color_producer.h
core/video_channel.cpp
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/producer/muxer/frame_muxer.cpp
modules/ffmpeg/producer/muxer/frame_muxer.h
modules/ffmpeg/producer/util/util.cpp
modules/ffmpeg/producer/util/util.h
modules/ffmpeg/producer/video/video_decoder.h
modules/flash/producer/flash_producer.cpp
modules/image/producer/image_producer.cpp
modules/image/producer/image_scroll_producer.cpp
modules/reroute/producer/reroute_producer.cpp

index c7cf81999913854fb6cfbe9506cd975faa902ba5..79bc8d896be79dddd3e77be59177eedf96646692 100644 (file)
   <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
index 3b078b2acf3fac00b848bff8bc78002d7993a9cd..57822db080ac5365f3c1d1267751d08601b6d2b2 100644 (file)
     <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
index ab24ad91969a948bc82855ac2158360e3483759e..cd92b75ee3c202b80fe3b5476a4487ef4e2e492f 100644 (file)
@@ -23,7 +23,7 @@
 \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
@@ -31,7 +31,7 @@
 #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
@@ -314,7 +314,7 @@ public:
                \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
@@ -349,9 +349,9 @@ public:
                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
@@ -362,6 +362,6 @@ void image_mixer::pop(){impl_->pop();}
 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
index 434f789ded8ce2a661c9aa5a4a79656d643e1135..75fdb3dab93bd747812e7e50c618b64f8b1709f4 100644 (file)
@@ -11,7 +11,7 @@
 \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
@@ -34,7 +34,7 @@ public:
        // 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
similarity index 55%
rename from accelerator/cpu/util/write_frame.cpp
rename to accelerator/cpu/util/data_frame.cpp
index 36853a13a89ad5ace962194d9e9df0225ac6ced2..1e7d4e1dc560d3dc7fbbddee69b78177ccf4f79f 100644 (file)
@@ -21,7 +21,7 @@
 \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
@@ -31,7 +31,7 @@
 \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
@@ -58,13 +58,6 @@ struct write_frame::impl : boost::noncopyable
                        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
@@ -75,27 +68,26 @@ struct write_frame::impl : boost::noncopyable
        }\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
similarity index 75%
rename from accelerator/cpu/util/write_frame.h
rename to accelerator/cpu/util/data_frame.h
index 87933fa0a222fe69afdcc29ff96ec0ca5978bfd3..7838c47e5d214ecf49912127ec3eb9dc6ef8ae0b 100644 (file)
@@ -24,8 +24,8 @@
 #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
@@ -40,23 +40,19 @@ namespace caspar { namespace accelerator { namespace cpu {
        \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
@@ -75,7 +71,7 @@ public:
                                                                \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
index ac6c9dbe6811c474aa2b253520360952348347ab..b521d46b777dd363d2053f534431547fb9e6f419 100644 (file)
@@ -25,7 +25,7 @@
 \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
@@ -34,7 +34,7 @@
 #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
@@ -59,13 +59,14 @@ typedef boost::shared_future<spl::shared_ptr<device_buffer>> future_texture;
 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
@@ -297,7 +298,19 @@ private:
                                   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
@@ -391,7 +404,7 @@ public:
                \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
@@ -406,6 +419,7 @@ public:
 \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
@@ -432,9 +446,9 @@ public:
                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
@@ -445,6 +459,6 @@ void image_mixer::pop(){impl_->pop();}
 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
index 1ef558d37b45248199c514fbcbbdc59217c22ea5..f0a2b3fe8f3c7a20ac0ed6d3b85479a8f6af6c8c 100644 (file)
@@ -31,7 +31,7 @@
 #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
@@ -54,7 +54,7 @@ public:
        // 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
similarity index 57%
rename from accelerator/ogl/util/write_frame.cpp
rename to accelerator/ogl/util/data_frame.cpp
index 740a175f60e527fb2b268575cd2dd6b8cbd8000e..591a6195c8501764ad06a9c9e9716f4c2583dd55 100644 (file)
@@ -21,7 +21,7 @@
 \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
@@ -35,7 +35,7 @@
 \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
@@ -65,13 +65,6 @@ struct write_frame::impl : boost::noncopyable
                });\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
@@ -81,27 +74,26 @@ struct write_frame::impl : boost::noncopyable
        }\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
similarity index 74%
rename from accelerator/ogl/util/write_frame.h
rename to accelerator/ogl/util/data_frame.h
index 1b64a7432ae56f024816733778866dadec06d396..b85c4eae1a9af1a0fa5734fbdf7d97df02f3f16b 100644 (file)
@@ -24,7 +24,8 @@
 #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
@@ -37,23 +38,19 @@ FORWARD2(caspar, core, struct pixel_format_desc);
 \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
@@ -72,7 +69,7 @@ public:
                                                                \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
index 1703f96a967542aef92f63a6e4d05250620b2ca7..3094dd60a7dd65e0ad29dbe0fd768ae759ccf21b 100644 (file)
     <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
index 125180bfc2983c805a29171ab9aa62b83698b922..0fc9cfb1bba8c87204ac9b1dbb39e03278034a08 100644 (file)
     <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
index e65054c4c5924dabe709a085baf43c1e520305d8..798b6ea1ad0b5c651b1b7ce2ee6f8b649a7e17a2 100644 (file)
@@ -32,32 +32,46 @@ namespace caspar { namespace core {
 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
@@ -65,9 +79,10 @@ public:
 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
index 4c6f1d3df42c6da8aa54d716096498b2830d5f71..5bfba4503b719614177ee9234eb6c0e6fea1d0ea 100644 (file)
@@ -41,7 +41,8 @@ public:
        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
index 78795fb45ead85d805f6b4e1886963c29f031177..351b5a6d95a3f0ff4f9eeaf71f785198b08b153d 100644 (file)
@@ -34,8 +34,8 @@ class frame_factory : boost::noncopyable
 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
diff --git a/core/frame/write_frame.h b/core/frame/write_frame.h
deleted file mode 100644 (file)
index 7a813c5..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*\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
index 52969e0dc46ce7c3658aff2a47b5375345f2210e..a1e624890087f7f8cc4e7ff2a234e84c8a007ed9 100644 (file)
@@ -23,7 +23,7 @@
 \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
index 2537b42a7e6585064508a8078ad1dd7ae74f6f6f..95d79033226a3e7cddf71d8ec19ca2c9af414f65 100644 (file)
@@ -34,7 +34,7 @@
 #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
@@ -52,7 +52,7 @@ public:
        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
index 39bbb3d89073dad5abb67cf5518f260393856e40..80fd82e32c787f10951075b6889275b195f65a06 100644 (file)
@@ -202,5 +202,5 @@ mixer::mixer(spl::shared_ptr<diagnostics::graph> graph, spl::unique_ptr<image_mi
 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
index 6d471db4bf8ff96c0919180ffa2eed5c1f76fe5a..1dd77fb821039406bca84051a1f06f708730c99f 100644 (file)
@@ -50,7 +50,7 @@ public:
 \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
index 66accfb943810c9b80056ffd0e0d61752203122a..2879623ef3bb0bc27454a8dd0905f179cf2a11c7 100644 (file)
 #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
@@ -131,7 +131,7 @@ spl::shared_ptr<frame_producer> create_color_producer(const spl::shared_ptr<fram
 \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
@@ -148,7 +148,7 @@ spl::shared_ptr<write_frame> create_color_frame(void* tag, const spl::shared_ptr
        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
index cec986dddb3354d668e7a71cd14bb6cbb4411f28..4dad08b5b9384889a6dcbbc8b4501cad24581c04 100644 (file)
@@ -29,6 +29,6 @@
 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
index 7a1f1d8ee5dfa8da7f2e0ef8222a5cfc0cfa62ab..7fe84e262bb85fd75b124fbc1b48f458dbc9d310 100644 (file)
@@ -86,7 +86,7 @@ public:
        \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
index 5961e999ce145694bfb4f867c387a5510e1bfcec..c59639e074ddd28d9994934dfdacceee88d54443 100644 (file)
@@ -37,7 +37,8 @@
 #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
index ed3e88dc76c7b3767bceff559b1b43253494e13f..80e4456f57c6ab52d791e1cbf0e201f98f49cb9e 100644 (file)
@@ -31,7 +31,7 @@
 #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
@@ -67,22 +67,22 @@ namespace caspar { namespace ffmpeg {
        \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
@@ -95,7 +95,7 @@ struct frame_muxer::impl : boost::noncopyable
                , 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
@@ -110,7 +110,7 @@ struct frame_muxer::impl : boost::noncopyable
                \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
@@ -144,7 +144,7 @@ struct frame_muxer::impl : boost::noncopyable
                                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
@@ -238,7 +238,7 @@ struct frame_muxer::impl : boost::noncopyable
                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
@@ -246,22 +246,22 @@ struct frame_muxer::impl : boost::noncopyable
                        {                               \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
@@ -269,7 +269,7 @@ struct frame_muxer::impl : boost::noncopyable
                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
@@ -344,7 +344,7 @@ struct frame_muxer::impl : boost::noncopyable
                                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
index 6eae65b9b6b2432b6ca7e5716c43c8c6006f15f5..6e0d83dfd37cfc94b2ebe690aad5686b5d689fbc 100644 (file)
@@ -35,7 +35,7 @@
 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
index e316afbdea8f813c7f83f40a736cf04ef91d6fb6..7c48a64c54e928bd323dd3b20e9c357777fd2c78 100644 (file)
@@ -33,8 +33,8 @@
 \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
@@ -171,7 +171,7 @@ int make_alpha_format(int format)
        }\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
@@ -185,7 +185,7 @@ spl::shared_ptr<core::write_frame> make_write_frame(const void* tag, const spl::
        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
@@ -273,19 +273,7 @@ spl::shared_ptr<core::write_frame> make_write_frame(const void* tag, const spl::
                        }, 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
index 270cb7fa4406f6d9900025e5c88f1e5c64a03afc..1044e2f2262e2e935a7cbe552eed432d28dc976a 100644 (file)
@@ -38,7 +38,7 @@ struct AVRational;
 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
@@ -55,7 +55,7 @@ static const int CASPAR_PIX_FMT_LUMA = 10; // Just hijack some unual pixel forma
 \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
index 07e1bec7e9c83fdc0e4bc00b8d95268132dc2338..740c72450d1c02bb64277477878dc778b96636d7 100644 (file)
@@ -32,9 +32,6 @@ struct AVFormatContext;
 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
index c07cdbd79749ebb51d46a925dbcc5b2ef6da5866..6555abc3ed38ffdfcc1a060452839aa35d0e5b73 100644 (file)
 \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
@@ -291,7 +291,7 @@ public:
                        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
index 18f779bc94599c5c9454b52e08b5d72581e4004e..f71acadc35613d8ceb96c724c4ce7b21ff5e7283 100644 (file)
 \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
@@ -60,7 +60,7 @@ struct image_producer : public core::frame_producer
                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
index f56627554c31d055b7306cba6d2dde62df0cbd91..e45bd1caa1b7f752338e0533dc2f19953fd1f190 100644 (file)
 \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
@@ -101,7 +101,7 @@ struct image_scroll_producer : public core::frame_producer
                                        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
@@ -137,7 +137,7 @@ struct image_scroll_producer : public core::frame_producer
                                        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
index 8af09340ff824b2babb1225570523d86e7031cb9..2fbe035ceafd802db7474447aff56939a781edb5 100644 (file)
@@ -27,7 +27,6 @@
 #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
@@ -110,11 +109,11 @@ public:
 \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