+\r
+private:\r
+ \r
+ safe_ptr<host_buffer> mix_image(std::map<int, safe_ptr<core::basic_frame>> frames)\r
+ { \r
+ auto& root_image_transform = boost::fusion::at_key<core::image_transform>(root_transforms_);\r
+ auto& image_transforms = boost::fusion::at_key<core::image_transform>(transforms_);\r
+ \r
+ BOOST_FOREACH(auto& frame, frames)\r
+ {\r
+ image_mixer_.begin_layer();\r
+ \r
+ if(channel_.format_desc.mode != core::video_mode::progressive)\r
+ {\r
+ auto frame1 = make_safe<core::basic_frame>(frame.second);\r
+ auto frame2 = make_safe<core::basic_frame>(frame.second);\r
+ \r
+ frame1->get_image_transform() = root_image_transform.fetch_and_tick(1)*image_transforms[frame.first].fetch_and_tick(1);\r
+ frame2->get_image_transform() = root_image_transform.fetch_and_tick(1)*image_transforms[frame.first].fetch_and_tick(1);\r
+\r
+ if(frame1->get_image_transform() != frame2->get_image_transform())\r
+ core::basic_frame::interlace(frame1, frame2, channel_.format_desc.mode)->accept(image_mixer_);\r
+ else\r
+ frame2->accept(image_mixer_);\r
+ }\r
+ else\r
+ {\r
+ auto frame1 = make_safe<core::basic_frame>(frame.second);\r
+ frame1->get_image_transform() = root_image_transform.fetch_and_tick(1)*image_transforms[frame.first].fetch_and_tick(1);\r
+ frame1->accept(image_mixer_);\r
+ }\r
+\r
+ image_mixer_.end_layer();\r
+ }\r
+\r
+ return image_mixer_.render();\r
+ }\r
+\r
+ std::vector<int16_t> mix_audio(const std::map<int, safe_ptr<core::basic_frame>>& frames)\r
+ {\r
+ auto& root_audio_transform = boost::fusion::at_key<core::audio_transform>(root_transforms_);\r
+ auto& audio_transforms = boost::fusion::at_key<core::audio_transform>(transforms_);\r
+\r
+ BOOST_FOREACH(auto& frame, frames)\r
+ {\r
+ const unsigned int num = channel_.format_desc.mode == core::video_mode::progressive ? 1 : 2;\r
+\r
+ auto frame1 = make_safe<core::basic_frame>(frame.second);\r
+ frame1->get_audio_transform() = root_audio_transform.fetch_and_tick(num)*audio_transforms[frame.first].fetch_and_tick(num);\r
+ frame1->accept(audio_mixer_);\r
+ }\r
+\r
+ return audio_mixer_.mix();\r
+ }\r