]> 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>
Thu, 2 Feb 2012 23:45:07 +0000 (23:45 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 2 Feb 2012 23:45:07 +0000 (23:45 +0000)
common/enum_class.h
core/producer/layer.cpp
core/producer/layer.h
core/producer/stage.cpp
core/producer/stage.h
protocol/amcp/AMCPCommandsImpl.cpp

index 2f16f264891705d180050be9cacdd2e13e0698a8..933f7cba169853f17b1cc035ea15f9b4e278d721 100644 (file)
@@ -24,10 +24,22 @@ public:
                return enum_class(static_cast<type>(val_ & s.val_));\r
        }\r
 \r
+       enum_class& operator&=(const enum_class& s)\r
+       {\r
+               val_ = static_cast<type>(val_ & s.val_);\r
+               return *this;\r
+       }\r
+\r
        enum_class operator|(const enum_class& s) const\r
        {\r
                return enum_class(static_cast<type>(val_ | s.val_));\r
        }\r
+       \r
+       enum_class& operator|=(const enum_class& s)\r
+       {\r
+               val_ = static_cast<type>(val_ | s.val_);\r
+               return *this;\r
+       }\r
 \r
        //operator inner()\r
        //{\r
index 9f50928fae17ac4c71545a1d8336602e62b5750b..0a53d39ee2de1e5e8264f27251e4042c441646ae 100644 (file)
@@ -60,20 +60,13 @@ public:
                is_paused_ = false;\r
        }\r
 \r
-       void load(const safe_ptr<frame_producer>& producer, bool preview, const boost::optional<int32_t>& auto_play_delta)\r
+       void load(const safe_ptr<frame_producer>& producer, const boost::optional<int32_t>& auto_play_delta)\r
        {               \r
                background_              = producer;\r
                auto_play_delta_ = auto_play_delta;\r
 \r
                if(auto_play_delta_ && foreground_ == frame_producer::empty())\r
                        play();\r
-\r
-               if(preview) // Play the first frame and pause.\r
-               {                       \r
-                       play();\r
-                       receive(frame_producer::flags::none);\r
-                       pause();\r
-               }\r
        }\r
        \r
        void play()\r
@@ -101,14 +94,14 @@ public:
                is_paused_                      = true;\r
        }\r
                \r
-       safe_ptr<draw_frame> receive(int flags)\r
+       safe_ptr<draw_frame> receive(frame_producer::flags flags)\r
        {               \r
                try\r
                {\r
                        if(is_paused_)\r
                                return draw_frame::silence(foreground_->last_frame());\r
                \r
-                       auto frame = receive_and_follow(foreground_, flags);\r
+                       auto frame = receive_and_follow(foreground_, flags.value());\r
                        if(frame == core::draw_frame::late())\r
                                return draw_frame::silence(foreground_->last_frame());\r
 \r
@@ -155,30 +148,24 @@ public:
 };\r
 \r
 layer::layer() : impl_(new impl()){}\r
-layer::layer(layer&& other) : impl_(std::move(other.impl_)){}\r
-layer& layer::operator=(layer&& other)\r
-{\r
-       impl_ = std::move(other.impl_);\r
-       return *this;\r
-}\r
 layer::layer(const layer& other) : impl_(new impl(*other.impl_)){}\r
-layer& layer::operator=(const layer& other)\r
+layer::layer(layer&& other) : impl_(std::move(other.impl_)){}\r
+layer& layer::operator=(layer other)\r
 {\r
-       layer temp(other);\r
-       temp.swap(*this);\r
+       other.swap(*this);\r
        return *this;\r
 }\r
 void layer::swap(layer& other)\r
 {      \r
        impl_.swap(other.impl_);\r
 }\r
-void layer::load(const safe_ptr<frame_producer>& frame_producer, bool preview, const boost::optional<int32_t>& auto_play_delta){return impl_->load(frame_producer, preview, auto_play_delta);} \r
+void layer::load(const safe_ptr<frame_producer>& frame_producer, const boost::optional<int32_t>& auto_play_delta){return impl_->load(frame_producer, auto_play_delta);}        \r
 void layer::play(){impl_->play();}\r
 void layer::pause(){impl_->pause();}\r
 void layer::stop(){impl_->stop();}\r
 bool layer::is_paused() const{return impl_->is_paused_;}\r
 int64_t layer::frame_number() const{return impl_->frame_number_;}\r
-safe_ptr<draw_frame> layer::receive(int flags) {return impl_->receive(flags);}\r
+safe_ptr<draw_frame> layer::receive(frame_producer::flags flags) {return impl_->receive(flags);}\r
 safe_ptr<frame_producer> layer::foreground() const { return impl_->foreground_;}\r
 safe_ptr<frame_producer> layer::background() const { return impl_->background_;}\r
 bool layer::empty() const {return impl_->empty();}\r
index e254c63c88ca6d6556ebba8135731d7f7d365cd5..cef2bc272096dd98d35634ea8442c015bba79bf3 100644 (file)
@@ -21,6 +21,8 @@
 \r
 #pragma once\r
 \r
+#include "frame_producer.h"\r
+\r
 #include <common/forward.h>\r
 #include <common/memory/safe_ptr.h>\r
 \r
@@ -37,14 +39,13 @@ class layer sealed
 {\r
 public:\r
        layer(); // nothrow\r
-       layer(layer&& other); // nothrow\r
-       layer& operator=(layer&& other); // nothrow\r
        layer(const layer&);\r
-       layer& operator=(const layer&);\r
+       layer(layer&& other); // nothrow\r
+       layer& operator=(layer other); // nothrow\r
 \r
        void swap(layer& other); // nothrow \r
                \r
-       void load(const safe_ptr<struct frame_producer>& producer, bool preview, const boost::optional<int32_t>& auto_play_delta = nullptr); // nothrow\r
+       void load(const safe_ptr<struct frame_producer>& producer, const boost::optional<int32_t>& auto_play_delta = nullptr); // nothrow\r
        void play(); // nothrow\r
        void pause(); // nothrow\r
        void stop(); // nothrow\r
@@ -58,7 +59,7 @@ public:
        safe_ptr<struct frame_producer> foreground() const; // nothrow\r
        safe_ptr<struct frame_producer> background() const; // nothrow\r
 \r
-       safe_ptr<class draw_frame> receive(int flags); // nothrow\r
+       safe_ptr<class draw_frame> receive(frame_producer::flags flags); // nothrow\r
 \r
        boost::property_tree::wptree info() const;\r
 private:\r
index 0667a44816d0c0eb53e652be7af484c6ec863ed5..40298d5cf43cad33e9926fb5f7c3fc7385ba482c 100644 (file)
@@ -72,7 +72,7 @@ public:
                                {\r
                                        auto transform = transforms_[layer.first].fetch_and_tick(1);\r
 \r
-                                       int flags = frame_producer::flags::none;\r
+                                       frame_producer::flags flags = frame_producer::flags::none;\r
                                        if(format_desc2.field_mode != field_mode::progressive)\r
                                        {\r
                                                flags |= std::abs(transform.fill_scale[1]  - 1.0) > 0.0001 ? frame_producer::flags::deinterlace : frame_producer::flags::none;\r
@@ -146,11 +146,11 @@ public:
                }, high_priority);\r
        }\r
                \r
-       void load(int index, const safe_ptr<frame_producer>& producer, bool preview, int auto_play_delta)\r
+       void load(int index, const safe_ptr<frame_producer>& producer, int auto_play_delta)\r
        {\r
                executor_.begin_invoke([=]\r
                {\r
-                       layers_[index].load(producer, preview, auto_play_delta);\r
+                       layers_[index].load(producer, auto_play_delta);\r
                }, high_priority);\r
        }\r
 \r
@@ -252,22 +252,22 @@ public:
 \r
        boost::unique_future<boost::property_tree::wptree> info()\r
        {\r
-               return std::move(executor_.begin_invoke([this]() -> boost::property_tree::wptree\r
+               return executor_.begin_invoke([this]() -> boost::property_tree::wptree\r
                {\r
                        boost::property_tree::wptree info;\r
                        BOOST_FOREACH(auto& layer, layers_)                     \r
                                info.add_child(L"layers.layer", layer.second.info())\r
                                        .add(L"index", layer.first);    \r
                        return info;\r
-               }, high_priority));\r
+               }, high_priority);\r
        }\r
 \r
        boost::unique_future<boost::property_tree::wptree> info(int index)\r
        {\r
-               return std::move(executor_.begin_invoke([=]() -> boost::property_tree::wptree\r
+               return executor_.begin_invoke([=]() -> boost::property_tree::wptree\r
                {\r
                        return layers_[index].info();\r
-               }, high_priority));\r
+               }, high_priority);\r
        }               \r
 };\r
 \r
@@ -276,7 +276,7 @@ void stage::apply_transforms(const std::vector<stage::transform_tuple_t>& transf
 void stage::apply_transform(int index, const std::function<core::frame_transform(core::frame_transform)>& transform, unsigned int mix_duration, const tweener& tween){impl_->apply_transform(index, transform, mix_duration, tween);}\r
 void stage::clear_transforms(int index){impl_->clear_transforms(index);}\r
 void stage::clear_transforms(){impl_->clear_transforms();}\r
-void stage::load(int index, const safe_ptr<frame_producer>& producer, bool preview, int auto_play_delta){impl_->load(index, producer, preview, auto_play_delta);}\r
+void stage::load(int index, const safe_ptr<frame_producer>& producer, int auto_play_delta){impl_->load(index, producer, auto_play_delta);}\r
 void stage::pause(int index){impl_->pause(index);}\r
 void stage::play(int index){impl_->play(index);}\r
 void stage::stop(int index){impl_->stop(index);}\r
index c3e59da1fd8873d04f881560d188160bdc9b7cd1..bd8b67e5388ddbafc66b7659a9ad94ec442b3626 100644 (file)
@@ -55,7 +55,7 @@ public:
        void clear_transforms(int index);\r
        void clear_transforms();\r
                                \r
-       void load(int index, const safe_ptr<struct frame_producer>& producer, bool preview = false, int auto_play_delta = -1);\r
+       void load(int index, const safe_ptr<struct frame_producer>& producer, int auto_play_delta = -1);\r
        void pause(int index);\r
        void play(int index);\r
        void stop(int index);\r
index 47753a7206348f528c6ced7b681cd19691c349a9..d4cede6e088978e695ad0da1cc4aba0a57b45788 100644 (file)
@@ -749,7 +749,7 @@ bool LoadbgCommand::DoExecute()
                bool auto_play = std::find(_parameters.begin(), _parameters.end(), L"AUTO") != _parameters.end();\r
 \r
                auto pFP2 = create_transition_producer(GetChannel()->get_video_format_desc().field_mode, pFP, transitionInfo);\r
-               GetChannel()->stage()->load(GetLayerIndex(), pFP2, false, auto_play ? transitionInfo.duration : -1); // TODO: LOOP\r
+               GetChannel()->stage()->load(GetLayerIndex(), pFP2, auto_play ? transitionInfo.duration : -1); // TODO: LOOP\r
        \r
                SetReplyString(TEXT("202 LOADBG OK\r\n"));\r
 \r