]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2: - Removed AUTO_PLAY from LOADBG Command.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 21 Apr 2011 11:30:53 +0000 (11:30 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 21 Apr 2011 11:30:53 +0000 (11:30 +0000)
         - Possible to send media in PLAY command, e.g PLAY 1-1 MY_VIDEO, which will load the media on the layer before playing.
         - Refactored layer.
         - Fixed swap of all layers between channels.

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

core/producer/frame_producer_device.cpp
core/producer/frame_producer_device.h
core/producer/layer.cpp
core/producer/layer.h
protocol/amcp/AMCPCommandsImpl.cpp
shell/caspar.config

index 2ebb1756111eb18575e602fe45bb3b8dd355f554..a2f16cef5cf59cfd3d9db96619452b50363b05f7 100644 (file)
@@ -61,15 +61,7 @@ public:
                output_(draw());\r
                executor_.begin_invoke([=]{tick();});\r
        }\r
-               \r
-       layer& get_layer(int index)\r
-       {\r
-               auto it = layers_.find(index);\r
-               if(it == layers_.end())\r
-                       it = layers_.insert(std::make_pair(index, layer(index))).first;\r
-               return it->second;\r
-       }\r
-       \r
+                       \r
        std::vector<safe_ptr<basic_frame>> draw()\r
        {       \r
                std::vector<safe_ptr<basic_frame>> frames(layers_.size(), basic_frame::empty());\r
@@ -86,24 +78,24 @@ public:
                return frames;\r
        }\r
 \r
-       void load(int index, const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview)\r
+       void load(int index, const safe_ptr<frame_producer>& producer, bool preview)\r
        {\r
-               executor_.invoke([&]{get_layer(index).load(producer, play_on_load, preview);});\r
+               executor_.invoke([&]{layers_[index].load(producer, preview);});\r
        }\r
 \r
        void pause(int index)\r
        {               \r
-               executor_.invoke([&]{get_layer(index).pause();});\r
+               executor_.invoke([&]{layers_[index].pause();});\r
        }\r
 \r
        void play(int index)\r
        {               \r
-               executor_.invoke([&]{get_layer(index).play();});\r
+               executor_.invoke([&]{layers_[index].play();});\r
        }\r
 \r
        void stop(int index)\r
        {               \r
-               executor_.invoke([&]{get_layer(index).stop();});\r
+               executor_.invoke([&]{layers_[index].stop();});\r
        }\r
 \r
        void clear(int index)\r
@@ -120,7 +112,7 @@ public:
        {\r
                executor_.invoke([&]\r
                {\r
-                       get_layer(index).swap(layers_[other_index]);\r
+                       layers_[index].swap(layers_[other_index]);\r
                });\r
        }\r
 \r
@@ -135,7 +127,7 @@ public:
 \r
                        auto func = [&]\r
                        {\r
-                               get_layer(index).swap(other.impl_->layers_.at(other_index));            \r
+                               layers_[index].swap(other.impl_->layers_.at(other_index));              \r
 \r
                                CASPAR_LOG(info) << print() << L" Swapped layer " << index << L" with " << other.impl_->print() << L" layer " << other_index << L".";   \r
                        };\r
@@ -154,19 +146,15 @@ public:
 \r
                auto func = [&]\r
                {\r
-                       std::set<int> my_indices;\r
-                       BOOST_FOREACH(auto& pair, layers_)\r
-                               my_indices.insert(pair.first);\r
+                       auto sel_first = [](const decltype(*layers_.begin())& pair){return pair.first;};\r
 \r
-                       std::set<int> other_indicies;\r
-                       BOOST_FOREACH(auto& pair, other.impl_->layers_)\r
-                               other_indicies.insert(pair.first);\r
-                       \r
-                       std::vector<int> indices;\r
-                       std::set_union(my_indices.begin(), my_indices.end(), other_indicies.begin(), other_indicies.end(), std::back_inserter(indices));\r
-                       \r
-                       BOOST_FOREACH(auto index, indices)\r
-                               get_layer(index).swap(other.impl_->get_layer(index));\r
+                       std::set<int> indices;\r
+                       std::transform(layers_.begin(), layers_.end(), std::inserter(indices, indices.begin()), sel_first);\r
+                       std::transform(other.impl_->layers_.begin(), other.impl_->layers_.end(), std::inserter(indices, indices.begin()), sel_first);\r
+                       std::for_each(indices.begin(), indices.end(), [&](int index)\r
+                       {\r
+                               layers_[index].swap(other.impl_->layers_[index]);\r
+                       });                                     \r
 \r
                        CASPAR_LOG(info) << print() << L" Swapped layers with " << other.impl_->print() << L".";\r
                };\r
@@ -193,7 +181,7 @@ frame_producer_device::frame_producer_device(const video_format_desc& format_des
 frame_producer_device::frame_producer_device(frame_producer_device&& other) : impl_(std::move(other.impl_)){}\r
 boost::signals2::connection frame_producer_device::connect(const output_t::slot_type& subscriber){return impl_->connect(subscriber);}\r
 void frame_producer_device::swap(frame_producer_device& other){impl_->swap(other);}\r
-void frame_producer_device::load(int index, const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview){impl_->load(index, producer, play_on_load, preview);}\r
+void frame_producer_device::load(int index, const safe_ptr<frame_producer>& producer, bool preview){impl_->load(index, producer, preview);}\r
 void frame_producer_device::pause(int index){impl_->pause(index);}\r
 void frame_producer_device::play(int index){impl_->play(index);}\r
 void frame_producer_device::stop(int index){impl_->stop(index);}\r
index 8f5972b5227daa7972478bf1c54357cf028da19b..72959ff6de7fa13b4205887fab5188a2f3d54691 100644 (file)
@@ -35,7 +35,7 @@ public:
        frame_producer_device(frame_producer_device&& other);\r
        void swap(frame_producer_device& other);\r
                \r
-       void load(int index, const safe_ptr<frame_producer>& producer, bool play_on_load = false, bool preview = false);\r
+       void load(int index, const safe_ptr<frame_producer>& producer, bool preview = false);\r
        void pause(int index);\r
        void play(int index);\r
        void stop(int index);\r
index 227c0293daa3db445b85552ec2420ec49cc3697e..f85f407f39b03785ed541beb99015986abd6f28e 100644 (file)
@@ -10,15 +10,13 @@ namespace caspar { namespace core {
        \r
 struct layer::implementation : boost::noncopyable\r
 {                              \r
-       int                                                     index_; \r
        safe_ptr<frame_producer>        foreground_;\r
        safe_ptr<frame_producer>        background_;\r
        safe_ptr<basic_frame>           last_frame_;\r
        bool                                            is_paused_;\r
 public:\r
-       implementation(int index) \r
-               : index_(index)\r
-               , foreground_(frame_producer::empty())\r
+       implementation() \r
+               : foreground_(frame_producer::empty())\r
                , background_(frame_producer::empty())\r
                , last_frame_(basic_frame::empty())\r
                , is_paused_(false){}\r
@@ -30,25 +28,19 @@ public:
 \r
        void resume()\r
        {\r
-               if(is_paused_)\r
-                       CASPAR_LOG(info) << foreground_->print() << L" Resumed.";\r
                is_paused_ = false;\r
        }\r
 \r
-       void load(const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview)\r
+       void load(const safe_ptr<frame_producer>& producer, bool preview)\r
        {               \r
                background_ = producer;\r
 \r
-               if(play_on_load)\r
-                       play();         \r
-               else if(preview)\r
+               if(preview)\r
                {\r
                        play();\r
                        receive();\r
                        pause();\r
                }\r
-\r
-               CASPAR_LOG(info) << producer->print() << L" Loaded.";\r
        }\r
        \r
        void play()\r
@@ -58,7 +50,6 @@ public:
                        background_->set_leading_producer(foreground_);\r
                        foreground_ = background_;\r
                        background_ = frame_producer::empty();\r
-                       CASPAR_LOG(info) << foreground_->print() << L" Active.";\r
                }\r
                resume();\r
        }\r
@@ -79,14 +70,9 @@ public:
 \r
                return last_frame_;\r
        }\r
-               \r
-       std::wstring print() const\r
-       {\r
-               return L"layer[" + boost::lexical_cast<std::wstring>(index_) + L"]";\r
-       }\r
 };\r
 \r
-layer::layer(int index) : impl_(new implementation(index)){}\r
+layer::layer() : impl_(new implementation()){}\r
 layer::layer(layer&& other) : impl_(std::move(other.impl_)){}\r
 layer& layer::operator=(layer&& other)\r
 {\r
@@ -95,17 +81,13 @@ layer& layer::operator=(layer&& other)
 }\r
 void layer::swap(layer& other)\r
 {      \r
-       impl_->foreground_.swap(other.impl_->foreground_);\r
-       impl_->background_.swap(other.impl_->background_);\r
-       impl_->last_frame_.swap(other.impl_->last_frame_);\r
-       std::swap(impl_->is_paused_     , other.impl_->is_paused_ );\r
+       impl_.swap(other.impl_);\r
 }\r
-void layer::load(const safe_ptr<frame_producer>& frame_producer, bool play_on_load, bool preview){return impl_->load(frame_producer, play_on_load, preview);}  \r
+void layer::load(const safe_ptr<frame_producer>& frame_producer, bool preview){return impl_->load(frame_producer, preview);}   \r
 void layer::play(){impl_->play();}\r
 void layer::pause(){impl_->pause();}\r
 void layer::stop(){impl_->stop();}\r
 safe_ptr<basic_frame> layer::receive() {return impl_->receive();}\r
 safe_ptr<frame_producer> layer::foreground() const { return impl_->foreground_;}\r
 safe_ptr<frame_producer> layer::background() const { return impl_->background_;}\r
-std::wstring layer::print() const { return impl_->print();}\r
 }}
\ No newline at end of file
index 52ea01e98b939af49857f2e78c462c438f4e348b..c4db351350337a7acb17e5fc9422c376af45e274 100644 (file)
@@ -15,13 +15,13 @@ class basic_frame;
 class layer : boost::noncopyable\r
 {\r
 public:\r
-       explicit layer(int index = std::numeric_limits<int>::min()); // nothrow\r
+       layer(); // nothrow\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<frame_producer>& producer, bool play_on_load, bool preview); // nothrow\r
+       void load(const safe_ptr<frame_producer>& producer, bool preview); // nothrow\r
        void play(); // nothrow\r
        void pause(); // nothrow\r
        void stop(); // nothrow\r
@@ -30,8 +30,6 @@ public:
        safe_ptr<frame_producer> background() const; // nothrow\r
 \r
        safe_ptr<basic_frame> receive(); // nothrow\r
-\r
-       std::wstring print() const;\r
 private:\r
        struct implementation;\r
        std::shared_ptr<implementation> impl_;\r
index 1fd15c53dc16817d1b91c8bb3fb826fa67f76452..5cbf298ff750574c959fcecb22d909bb89ae9b15 100644 (file)
@@ -452,7 +452,7 @@ bool LoadCommand::DoExecute()
        {\r
                _parameters[0] = _parameters[0];\r
                auto pFP = create_producer(GetChannel()->mixer(), _parameters);         \r
-               GetChannel()->producer()->load(GetLayerIndex(), pFP, false, true);\r
+               GetChannel()->producer()->load(GetLayerIndex(), pFP, true);\r
        \r
                CASPAR_LOG(info) << "Loaded " <<  _parameters[0] << TEXT(" successfully");\r
 \r
@@ -564,8 +564,7 @@ bool LoadbgCommand::DoExecute()
                        BOOST_THROW_EXCEPTION(file_not_found() << msg_info(_parameters.size() > 0 ? narrow(_parameters[0]) : ""));\r
 \r
                auto pFP2 = create_transition_producer(GetChannel()->get_video_format_desc(), pFP, transitionInfo);\r
-               bool autoPlay = std::find(_parameters.begin(), _parameters.end(), TEXT("AUTOPLAY")) != _parameters.end();\r
-               GetChannel()->producer()->load(GetLayerIndex(), pFP2, autoPlay); // TODO: LOOP\r
+               GetChannel()->producer()->load(GetLayerIndex(), pFP2); // TODO: LOOP\r
        \r
                CASPAR_LOG(info) << "Loaded " << _parameters[0] << TEXT(" successfully to background");\r
                SetReplyString(TEXT("202 LOADBG OK\r\n"));\r
@@ -606,7 +605,21 @@ bool PlayCommand::DoExecute()
 {\r
        try\r
        {\r
+               if(!_parameters.empty())\r
+               {\r
+                       LoadbgCommand lbg;\r
+                       lbg.SetChannel(GetChannel());\r
+                       lbg.SetChannelIndex(GetChannelIndex());\r
+                       lbg.SetLayerIntex(GetLayerIndex());\r
+                       lbg.SetClientInfo(GetClientInfo());\r
+                       for(auto it = _parameters.begin(); it != _parameters.end(); ++it)\r
+                               lbg.AddParameter(*it);\r
+                       if(!lbg.Execute())\r
+                               CASPAR_LOG(warning) << " Failed to play.";\r
+               }\r
+\r
                GetChannel()->producer()->play(GetLayerIndex());\r
+               \r
                SetReplyString(TEXT("202 PLAY OK\r\n"));\r
                return true;\r
        }\r
index 835907bf90467a768f1452ea2f659a725b2239d6..12182036102d7ca932aa50723da3b22771ff59ec 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>\r
 <configuration>\r
   <paths>\r
-    <media-path>C:\\Casparcg\\_media\\</media-path>\r
-    <log-path>C:\\Casparcg\\_log\\</log-path>\r
-    <data-path>C:\\Casparcg\\_data\\</data-path>\r
-    <template-path>C:\\Casparcg\\</template-path>\r
+    <media-path>F:\\Casparcg\\_media\\</media-path>\r
+    <log-path>F:\\Casparcg\\_log\\</log-path>\r
+    <data-path>F:\\Casparcg\\_data\\</data-path>\r
+    <template-path>F:\\Casparcg\\_templates\\</template-path>\r
     <template-host>cg.fth.18</template-host>\r
   </paths>\r
   <diagnostics>\r
     <channel>\r
       <videomode>1080i5000</videomode>\r
       <consumers>\r
-        <!--<decklink>\r
+        <decklink>\r
           <device>1</device>\r
           <embedded-audio>true</embedded-audio>\r
           <internal-key>false</internal-key>\r
-        </decklink>-->\r
+        </decklink>\r
         <ogl>\r
           <device>0</device>\r
           <stretch>uniform</stretch>\r