};\r
\r
basic_frame::basic_frame() : impl_(new implementation(std::vector<safe_ptr<basic_frame>>())){}\r
-basic_frame::basic_frame(const std::vector<safe_ptr<basic_frame>>& frames) : impl_(new implementation(frames)){}\r
basic_frame::basic_frame(std::vector<safe_ptr<basic_frame>>&& frames) : impl_(new implementation(std::move(frames))){}\r
basic_frame::basic_frame(const basic_frame& other) : impl_(new implementation(*other.impl_)){}\r
basic_frame::basic_frame(const safe_ptr<basic_frame>& frame)\r
frames.push_back(std::move(frame));\r
impl_.reset(new implementation(std::move(frames)));\r
}\r
-basic_frame::basic_frame(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2)\r
-{\r
- std::vector<safe_ptr<basic_frame>> frames;\r
- frames.push_back(frame1);\r
- frames.push_back(frame2);\r
- impl_.reset(new implementation(std::move(frames)));\r
-}\r
-basic_frame::basic_frame(safe_ptr<basic_frame>&& frame1, safe_ptr<basic_frame>&& frame2)\r
-{\r
- std::vector<safe_ptr<basic_frame>> frames;\r
- frames.push_back(std::move(frame1));\r
- frames.push_back(std::move(frame2));\r
- impl_.reset(new implementation(std::move(frames)));\r
-}\r
-\r
void basic_frame::swap(basic_frame& other){impl_.swap(other.impl_);}\r
basic_frame& basic_frame::operator=(const basic_frame& other)\r
{\r
{ \r
if(frame1 == basic_frame::empty() && frame2 == basic_frame::empty())\r
return basic_frame::empty();\r
-\r
+ \r
+ if(frame1 == basic_frame::eof() && frame2 == basic_frame::eof())\r
+ return basic_frame::eof();\r
+ \r
if(frame1 == frame2 || mode == video_mode::progressive)\r
return frame2;\r
\r
std::vector<safe_ptr<basic_frame>> frames;\r
frames.push_back(my_frame1);\r
frames.push_back(my_frame2);\r
- return make_safe<basic_frame>(frames);\r
+ return basic_frame(std::move(frames));\r
+}\r
+\r
+safe_ptr<basic_frame> basic_frame::combine(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2)\r
+{\r
+ if(frame1 == basic_frame::empty() && frame2 == basic_frame::empty())\r
+ return basic_frame::empty();\r
+ \r
+ if(frame1 == basic_frame::eof() && frame2 == basic_frame::eof())\r
+ return basic_frame::eof();\r
+ \r
+ std::vector<safe_ptr<basic_frame>> frames;\r
+ frames.push_back(frame1);\r
+ frames.push_back(frame2);\r
+ return basic_frame(std::move(frames));\r
}\r
\r
safe_ptr<basic_frame> basic_frame::fill_and_key(const safe_ptr<basic_frame>& fill, const safe_ptr<basic_frame>& key)\r
{\r
+ if(fill == basic_frame::empty() && key == basic_frame::empty())\r
+ return basic_frame::empty();\r
+ \r
+ if(fill == basic_frame::eof() && key == basic_frame::eof())\r
+ return basic_frame::eof();\r
+\r
if(key == basic_frame::empty())\r
return fill;\r
\r
key->get_image_transform().set_is_key(true);\r
frames.push_back(key);\r
frames.push_back(fill);\r
- return make_safe<basic_frame>(std::move(frames));\r
+ return basic_frame(std::move(frames));\r
}\r
\r
}}
\ No newline at end of file
\r
class basic_frame\r
{\r
+ basic_frame(std::vector<safe_ptr<basic_frame>>&& frames);\r
public:\r
basic_frame(); \r
basic_frame(const safe_ptr<basic_frame>& frame);\r
basic_frame(safe_ptr<basic_frame>&& frame);\r
- basic_frame(const std::vector<safe_ptr<basic_frame>>& frames);\r
- basic_frame(std::vector<safe_ptr<basic_frame>>&& frame);\r
- basic_frame(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2);\r
- basic_frame(safe_ptr<basic_frame>&& frame1, safe_ptr<basic_frame>&& frame2);\r
\r
void swap(basic_frame& other);\r
\r
audio_transform& get_audio_transform();\r
\r
static safe_ptr<basic_frame> interlace(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2, video_mode::type mode);\r
+ static safe_ptr<basic_frame> combine(const safe_ptr<basic_frame>& frame1, const safe_ptr<basic_frame>& frame2);\r
static safe_ptr<basic_frame> fill_and_key(const safe_ptr<basic_frame>& fill, const safe_ptr<basic_frame>& key);\r
\r
static const safe_ptr<basic_frame>& eof()\r
if(frame == basic_frame::late())\r
{\r
last_frame->get_audio_transform().set_has_audio(false);\r
- return last_frame;\r
+ frame = last_frame;\r
}\r
return frame;\r
}\r
\r
auto s_frame = s_frame1->get_image_transform() == s_frame2->get_image_transform() ? s_frame2 : basic_frame::interlace(s_frame1, s_frame2, mode_);\r
auto d_frame = d_frame1->get_image_transform() == d_frame2->get_image_transform() ? d_frame2 : basic_frame::interlace(d_frame1, d_frame2, mode_);\r
-\r
- if(dest_frame == core::basic_frame::empty())\r
- return s_frame;\r
-\r
- if(src_frame == core::basic_frame::empty())\r
- return d_frame;\r
-\r
- return basic_frame(s_frame, d_frame);\r
+ \r
+ return basic_frame::combine(s_frame, d_frame);\r
}\r
};\r
\r