\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
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
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
\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
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
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