]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorRonag <Ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 27 Jul 2011 18:13:18 +0000 (18:13 +0000)
committerRonag <Ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 27 Jul 2011 18:13:18 +0000 (18:13 +0000)
core/mixer/write_frame.cpp
core/mixer/write_frame.h
modules/ffmpeg/producer/video/video_decoder.cpp

index 1839a297e7621040de98fdfe6c3cbd79d52b1a07..ac57f244f24329bd796a4573bb9a2910d781bb8d 100644 (file)
@@ -32,7 +32,7 @@ namespace caspar { namespace core {
                                                                                                                                                                                                                                                                                                                        \r
 struct write_frame::implementation\r
 {                              \r
-       ogl_device&                                                                             ogl_;\r
+       ogl_device*                                                                             ogl_;\r
        std::vector<std::shared_ptr<host_buffer>>               buffers_;\r
        std::array<std::shared_ptr<device_buffer>, 4>   textures_;\r
        std::vector<int16_t>                                                    audio_data_;\r
@@ -40,17 +40,25 @@ struct write_frame::implementation
        int                                                                                             tag_;\r
        core::video_mode::type                                                  mode_;\r
 \r
+       implementation()\r
+       {\r
+       }\r
+\r
        implementation(ogl_device& ogl, int tag, const core::pixel_format_desc& desc) \r
-               : ogl_(ogl)\r
+               : ogl_(&ogl)\r
                , desc_(desc)\r
                , tag_(tag)\r
                , mode_(core::video_mode::progressive)\r
        {\r
-               ogl_.invoke([&]\r
+               ogl_->invoke([&]\r
                {\r
                        std::transform(desc.planes.begin(), desc.planes.end(), std::back_inserter(buffers_), [&](const core::pixel_format_desc::plane& plane)\r
                        {\r
-                               return ogl_.create_host_buffer(plane.size, host_buffer::write_only);\r
+                               return ogl_->create_host_buffer(plane.size, host_buffer::write_only);\r
+                       });\r
+                       std::transform(desc.planes.begin(), desc.planes.end(), std::back_inserter(textures_), [&](const core::pixel_format_desc::plane& plane)\r
+                       {\r
+                               return ogl_->create_device_buffer(plane.width, plane.height, plane.channels);   \r
                        });\r
                }, high_priority);\r
        }\r
@@ -58,7 +66,8 @@ struct write_frame::implementation
        void accept(write_frame& self, core::frame_visitor& visitor)\r
        {\r
                visitor.begin(self);\r
-               visitor.visit(self);\r
+               if(!desc_.planes().empty())\r
+                       visitor.visit(self);\r
                visitor.end();\r
        }\r
 \r
@@ -93,16 +102,19 @@ struct write_frame::implementation
 \r
                if(!buffer)\r
                        return;\r
+\r
+               auto texture\r
                \r
-               ogl_.begin_invoke([=]\r
+               ogl_->begin_invoke([=]\r
                {\r
                        auto plane = desc_.planes[plane_index];\r
-                       textures_[plane_index] = ogl_.create_device_buffer(plane.width, plane.height, plane.channels);                  \r
+                       textures_[plane_index] = ogl_->create_device_buffer(plane.width, plane.height, plane.channels);                 \r
                        textures_[plane_index]->read(*buffer);\r
                }, high_priority);\r
        }\r
 };\r
        \r
+write_frame::write_frame() : impl_(new implementation()){}\r
 write_frame::write_frame(ogl_device& ogl, int32_t tag, const core::pixel_format_desc& desc) \r
        : impl_(new implementation(ogl, tag, desc)){}\r
 write_frame::write_frame(const write_frame& other) : impl_(new implementation(*other.impl_)){}\r
index 45059272a3ba3cf8a4f7146008dc75d835e8300f..7827846809cf6518da8ec861a67f403486cff547 100644 (file)
@@ -41,6 +41,7 @@ class ogl_device;
 class write_frame : public core::basic_frame, boost::noncopyable\r
 {\r
 public:        \r
+       write_frame();\r
        explicit write_frame(ogl_device& ogl, int tag, const core::pixel_format_desc& desc);\r
        write_frame(const write_frame& other);\r
                        \r
@@ -65,7 +66,7 @@ public:
 private:\r
        friend class image_mixer;\r
        \r
-       const std::vector<safe_ptr<device_buffer>> get_textures() const;\r
+       const std::vector<safe_ptr<device_buffer>>& get_textures() const;\r
 \r
        struct implementation;\r
        safe_ptr<implementation> impl_;\r
index 1f6c0e64a94e5250b27a0af966e32bfef7d50626..86642d7f555d7288c4426df1e12dd64392d5303c 100644 (file)
@@ -111,7 +111,7 @@ public:
                std::vector<safe_ptr<core::write_frame>> result;\r
 \r
                if(!codec_context_)\r
-                       result.push_back(core::create_color_frame(this, frame_factory_, L"#00000000"));\r
+                       result.push_back(make_safe<core::write_frame>());\r
                else if(!packet_buffer_.empty())\r
                {\r
                        auto packet = std::move(packet_buffer_.front());\r