]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2:
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 13 May 2011 20:40:45 +0000 (20:40 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 13 May 2011 20:40:45 +0000 (20:40 +0000)
    - basic_frame: interlace, combine, fill_and_key now checks if both frames are either empty, if so it returns the proper pointer.

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@735 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/producer/frame/basic_frame.cpp
core/producer/frame/basic_frame.h
core/producer/transition/transition_producer.cpp

index 263f5e42f650d3101a8efb3f0232df751579089d..23b41493f8ac27e7f1b58ff92eeba9b0eb51799f 100644 (file)
@@ -53,7 +53,6 @@ public:
 };\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
@@ -68,21 +67,6 @@ basic_frame::basic_frame(safe_ptr<basic_frame>&& frame)
        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
@@ -108,7 +92,10 @@ safe_ptr<basic_frame> basic_frame::interlace(const safe_ptr<basic_frame>& frame1
 {                      \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
@@ -128,11 +115,31 @@ safe_ptr<basic_frame> basic_frame::interlace(const safe_ptr<basic_frame>& frame1
        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
@@ -140,7 +147,7 @@ safe_ptr<basic_frame> basic_frame::fill_and_key(const safe_ptr<basic_frame>& fil
        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
index 8f2cb789cee41b96fd473a172d5ee7333bc71734..db3da0c9a0f9bbfddd4a708aa1921565c68a027e 100644 (file)
@@ -38,14 +38,11 @@ class audio_transform;
                \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
@@ -62,6 +59,7 @@ public:
        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
index 27f9d6cc2157648da3479d11349acdd9f73efbc6..7f09532a6a86b1e8d8f06e26bac169f3bc480f45 100644 (file)
@@ -87,7 +87,7 @@ struct transition_producer : public frame_producer
                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
@@ -147,14 +147,8 @@ struct transition_producer : public frame_producer
                                \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