]> git.sesse.net Git - casparcg/commitdiff
2.0.2: INFO further improved. STATUS 1-1 removed in favor of INFO 1-1.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 2 Dec 2011 21:23:24 +0000 (21:23 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 2 Dec 2011 21:23:24 +0000 (21:23 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.2@1761 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

38 files changed:
core/consumer/frame_consumer.cpp
core/consumer/frame_consumer.h
core/consumer/output.cpp
core/core.vcxproj.filters
core/producer/color/color_producer.cpp
core/producer/frame_producer.cpp
core/producer/frame_producer.h
core/producer/layer.cpp
core/producer/layer.h
core/producer/playlist/playlist_producer.cpp
core/producer/separated/separated_producer.cpp
core/producer/stage.cpp
core/producer/stage.h
core/producer/transition/transition_producer.cpp
core/video_channel.cpp
modules/bluefish/consumer/bluefish_consumer.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/decklink/interop/DeckLinkAPI_h.h
modules/decklink/interop/DeckLinkAPI_i.c
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/StdAfx.h
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/flash/StdAfx.h
modules/flash/producer/cg_producer.cpp
modules/flash/producer/cg_producer.h
modules/flash/producer/flash_producer.cpp
modules/image/consumer/image_consumer.cpp
modules/image/producer/image_producer.cpp
modules/image/producer/image_scroll_producer.cpp
modules/oal/consumer/oal_consumer.cpp
modules/ogl/consumer/ogl_consumer.cpp
protocol/amcp/AMCPCommandQueue.cpp
protocol/amcp/AMCPCommandQueue.h
protocol/amcp/AMCPCommandsImpl.cpp
protocol/amcp/AMCPCommandsImpl.h
protocol/amcp/AMCPProtocolStrategy.cpp
shell/casparcg.config

index 45974d014b790d5574f1deda6f2c3b77fb58f043..c6b1a540f0e198df9acba13311e1fdb59397898e 100644 (file)
@@ -110,6 +110,11 @@ public:
                return consumer_->print();\r
        }\r
 \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               return consumer_->info();\r
+       }\r
+\r
        virtual bool has_synchronization_clock() const override\r
        {\r
                return consumer_->has_synchronization_clock();\r
@@ -131,4 +136,25 @@ safe_ptr<frame_consumer> create_consumer_cadence_guard(const safe_ptr<frame_cons
        return make_safe<cadence_guard>(std::move(consumer));\r
 }\r
 \r
+const safe_ptr<frame_consumer>& frame_consumer::empty()\r
+{\r
+       struct empty_frame_consumer : public frame_consumer\r
+       {\r
+               virtual bool send(const safe_ptr<read_frame>&) override {return false;}\r
+               virtual void initialize(const video_format_desc&, int) override{}\r
+               virtual std::wstring print() const override {return L"empty";}\r
+               virtual bool has_synchronization_clock() const override {return false;}\r
+               virtual size_t buffer_depth() const override {return 0;};\r
+               virtual int index() const{return -1;}\r
+               virtual boost::property_tree::wptree info() const override\r
+               {\r
+                       boost::property_tree::wptree info;\r
+                       info.add(L"type", L"empty-consumer");\r
+                       return info;\r
+               }\r
+       };\r
+       static safe_ptr<frame_consumer> consumer = make_safe<empty_frame_consumer>();\r
+       return consumer;\r
+}\r
+\r
 }}
\ No newline at end of file
index a75882a5a97bc2af433f9bd0878f05f07008aaa6..e199abba757aeaf3ca1c08735bdc3161e53d2777 100644 (file)
@@ -22,6 +22,7 @@
 #include <common/memory/safe_ptr.h>\r
 \r
 #include <boost/noncopyable.hpp>\r
+#include <boost/property_tree/ptree_fwd.hpp>\r
 \r
 #include <functional>\r
 #include <string>\r
@@ -39,24 +40,12 @@ struct frame_consumer : boost::noncopyable
        virtual bool send(const safe_ptr<read_frame>& frame) = 0;\r
        virtual void initialize(const video_format_desc& format_desc, int channel_index) = 0;\r
        virtual std::wstring print() const = 0;\r
+       virtual boost::property_tree::wptree info() const = 0;\r
        virtual bool has_synchronization_clock() const {return true;}\r
        virtual size_t buffer_depth() const = 0;\r
        virtual int index() const = 0;\r
 \r
-       static const safe_ptr<frame_consumer>& empty()\r
-       {\r
-               struct empty_frame_consumer : public frame_consumer\r
-               {\r
-                       virtual bool send(const safe_ptr<read_frame>&) override {return false;}\r
-                       virtual void initialize(const video_format_desc&, int) override{}\r
-                       virtual std::wstring print() const override {return L"empty";}\r
-                       virtual bool has_synchronization_clock() const override {return false;}\r
-                       virtual size_t buffer_depth() const override {return 0;};\r
-                       virtual int index() const{return -1;}\r
-               };\r
-               static safe_ptr<frame_consumer> consumer = make_safe<empty_frame_consumer>();\r
-               return consumer;\r
-       }\r
+       static const safe_ptr<frame_consumer>& empty();\r
 };\r
 \r
 safe_ptr<frame_consumer> create_consumer_cadence_guard(const safe_ptr<frame_consumer>& consumer);\r
index b2258e912c9e6a96e093fc174c4eee4edc04e237..391c4382758141356d5cc6bf79433f7830880b6d 100644 (file)
@@ -244,9 +244,8 @@ public:
                        boost::property_tree::wptree info;\r
                        BOOST_FOREACH(auto& consumer, consumers_)\r
                        {\r
-                               auto& node = info.add(L"output.devices.device", L"");\r
-                               node.add(L"index", consumer.first);\r
-                               node.add(L"consumer", consumer.second->print());\r
+                               info.add_child(L"consumers.consumer", consumer.second->info())\r
+                                       .add(L"index", consumer.first); \r
                        }\r
                        return info;\r
                }, high_priority));\r
index 9e786645c49ede2619833feab176a73d65488563..c9c93e2161817135781719cefecd36f4ed845fab 100644 (file)
     <ClCompile Include="consumer\frame_consumer.cpp">\r
       <Filter>source\consumer</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="producer\frame_producer.cpp">\r
-      <Filter>source\producer</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="producer\color\color_producer.cpp">\r
       <Filter>source\producer\color</Filter>\r
     </ClCompile>\r
     <ClCompile Include="producer\playlist\playlist_producer.cpp">\r
       <Filter>source\producer\playlist</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="producer\frame_producer.cpp">\r
+      <Filter>source\producer</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index b7d4ab7e294064a62a03864ab35cb2c8f12c8d0a..710b309dad4a8678d91bc1ed4dca983778757ad0 100644 (file)
@@ -60,6 +60,14 @@ public:
        {\r
                return L"color[" + color_str_ + L"]";\r
        }\r
+\r
+       boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"color-producer");\r
+               info.add(L"color", color_str_);\r
+               return info;\r
+       }\r
 };\r
 \r
 std::wstring get_hex_color(const std::wstring& str)\r
index ef93ee8cde6e9de9170500a1f50314e37a12f5da..cec9a5557693081d1ad7147399cd28e384dd16b6 100644 (file)
@@ -91,16 +91,14 @@ public:
                }\r
        }\r
 \r
-       virtual safe_ptr<basic_frame>                           receive(int hints) override                                                                                             {return (*producer_)->receive(hints);}\r
-       virtual safe_ptr<basic_frame>                           last_frame() const override                                                                                             {return (*producer_)->last_frame();}\r
-       virtual std::wstring                                            print() const override                                                                                                  {return (*producer_)->print();}\r
-       virtual boost::unique_future<std::wstring>      call(const std::wstring& str) override                                                                  {return (*producer_)->call(str);}\r
-       virtual safe_ptr<frame_producer>                        get_following_producer() const override                                                                 {return (*producer_)->get_following_producer();}\r
-       virtual void                                                            set_leading_producer(const safe_ptr<frame_producer>& producer) override {(*producer_)->set_leading_producer(producer);}\r
-       virtual int64_t                                                         nb_frames() const override                                                                                              {return (*producer_)->nb_frames();}\r
-       virtual int64_t                                                         file_nb_frames() const override                                                                                 {return (*producer_)->file_nb_frames();}\r
-       virtual int64_t                                                         frame_number() const override                                                                                   {return (*producer_)->frame_number();}\r
-       virtual int64_t                                                         file_frame_number() const override                                                                              {return (*producer_)->file_frame_number();}\r
+       virtual safe_ptr<basic_frame>                                                           receive(int hints) override                                                                                             {return (*producer_)->receive(hints);}\r
+       virtual safe_ptr<basic_frame>                                                           last_frame() const override                                                                                             {return (*producer_)->last_frame();}\r
+       virtual std::wstring                                                                            print() const override                                                                                                  {return (*producer_)->print();}\r
+       virtual boost::property_tree::wptree                                            info() const override                                                                                                   {return (*producer_)->info();}\r
+       virtual boost::unique_future<std::wstring>                                      call(const std::wstring& str) override                                                                  {return (*producer_)->call(str);}\r
+       virtual safe_ptr<frame_producer>                                                        get_following_producer() const override                                                                 {return (*producer_)->get_following_producer();}\r
+       virtual void                                                                                            set_leading_producer(const safe_ptr<frame_producer>& producer) override {(*producer_)->set_leading_producer(producer);}\r
+       virtual int64_t                                                                                         nb_frames() const override                                                                                              {return (*producer_)->nb_frames();}\r
 };\r
 \r
 safe_ptr<core::frame_producer> create_producer_destroy_proxy(safe_ptr<core::frame_producer>&& producer)\r
@@ -125,6 +123,12 @@ public:
        virtual safe_ptr<core::basic_frame> last_frame() const{return frame_;}\r
        virtual std::wstring print() const{return L"dummy[" + print_ + L"]";}\r
        virtual int64_t nb_frames() const {return nb_frames_;}  \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"last-frame-producer");\r
+               return info;\r
+       }\r
 };\r
 \r
 struct empty_frame_producer : public frame_producer\r
@@ -134,6 +138,13 @@ struct empty_frame_producer : public frame_producer
        virtual void set_frame_factory(const safe_ptr<frame_factory>&){}\r
        virtual int64_t nb_frames() const {return 0;}\r
        virtual std::wstring print() const { return L"empty";}\r
+       \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"empty-producer");\r
+               return info;\r
+       }\r
 };\r
 \r
 const safe_ptr<frame_producer>& frame_producer::empty() // nothrow\r
index 93c45ddfe1019e564c34f161d8987a616ebd361a..56a2c4aa6ae5775b5f310781ead01de755133cf0 100644 (file)
@@ -31,7 +31,7 @@
 #include <numeric>\r
 \r
 #include <boost/thread/future.hpp>\r
-#include <boost/property_tree/ptree.hpp>\r
+#include <boost/property_tree/ptree_fwd.hpp>\r
 \r
 namespace caspar { \r
        \r
@@ -54,6 +54,7 @@ public:
        virtual ~frame_producer(){}     \r
 \r
        virtual std::wstring print() const = 0; // nothrow\r
+       virtual boost::property_tree::wptree info() const = 0;\r
 \r
        virtual boost::unique_future<std::wstring> call(const std::wstring&) \r
        {\r
@@ -62,21 +63,10 @@ public:
                return promise.get_future();\r
        }\r
 \r
-       virtual boost::property_tree::wptree info() const\r
-       {\r
-               boost::property_tree::wptree info;\r
-               info.push_front(std::make_pair(L"producer", print()));\r
-               return info;\r
-       }\r
-\r
        virtual safe_ptr<frame_producer> get_following_producer() const {return frame_producer::empty();}  // nothrow\r
        virtual void set_leading_producer(const safe_ptr<frame_producer>&) {}  // nothrow\r
                \r
        virtual int64_t nb_frames() const {return std::numeric_limits<int>::max();}\r
-       virtual int64_t file_nb_frames() const {return nb_frames();}\r
-\r
-       virtual int64_t frame_number() const {return 0;}\r
-       virtual int64_t file_frame_number() const {return frame_number();}\r
        \r
        virtual safe_ptr<basic_frame> receive(int hints) = 0;\r
        virtual safe_ptr<core::basic_frame> last_frame() const = 0;\r
index 7548ab9902c2c04d8ab74ee1d595c9f6864118ca..a9a41b9e1106932a7374fd4688c8d69e4dd9df75 100644 (file)
@@ -123,20 +123,6 @@ public:
                }\r
        }\r
 \r
-       layer_status status() const\r
-       {\r
-               layer_status status;\r
-               status.foreground                       = foreground_->print();\r
-               status.background                       = background_->print();\r
-               status.is_paused                        = is_paused_;\r
-               status.nb_frames                        = foreground_->nb_frames();\r
-               status.frame_number                     = std::max(frame_number_, foreground_->frame_number());\r
-               status.file_nb_frames           = foreground_->file_nb_frames();\r
-               status.file_frame_number        = foreground_->file_frame_number();\r
-\r
-               return status;\r
-       }\r
-\r
        boost::unique_future<std::wstring> call(bool foreground, const std::wstring& param)\r
        {\r
                return (foreground ? foreground_ : background_)->call(param);\r
@@ -150,10 +136,16 @@ public:
        boost::property_tree::wptree info() const\r
        {\r
                boost::property_tree::wptree info;\r
-               info.add_child(L"layer.foreground", foreground_->info());\r
-               info.add_child(L"layer.background", foreground_->info());\r
-               info.add(L"layer.status",     is_paused_ ? L"paused" : (foreground_ == frame_producer::empty() ? L"stopped" : L"playing"));\r
-               info.add(L"layer.auto_delta", auto_play_delta_);\r
+               info.add(L"status",             is_paused_ ? L"paused" : (foreground_ == frame_producer::empty() ? L"stopped" : L"playing"));\r
+               info.add(L"auto_delta", auto_play_delta_);\r
+               info.add(L"frame-number", frame_number_);\r
+\r
+               auto nb_frames = foreground_->nb_frames();\r
+\r
+               info.add(L"nb_frames",   nb_frames == std::numeric_limits<int64_t>::max() ? -1 : nb_frames);\r
+               info.add(L"frames-left", nb_frames == std::numeric_limits<int64_t>::max() ? -1 : (foreground_->nb_frames() - frame_number_ - auto_play_delta_));\r
+               info.add_child(L"foreground", foreground_->info());\r
+               info.add_child(L"background", background_->info());\r
                return info;\r
        }\r
 };\r
@@ -182,7 +174,6 @@ void layer::pause(){impl_->pause();}
 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
-layer_status layer::status() const {return impl_->status();}\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
index cd8e57e6ca3e2000087a691d3d2d8b1c3608cf83..8a0f407ba0b4baa5e826f2d122c54a9ac94c44eb 100644 (file)
@@ -33,17 +33,6 @@ namespace caspar { namespace core {
 struct frame_producer;\r
 class basic_frame;\r
 \r
-struct layer_status\r
-{\r
-       std::wstring    foreground;\r
-       std::wstring    background;\r
-       bool                    is_paused;\r
-       int64_t                 nb_frames;\r
-       int64_t                 frame_number;\r
-       int64_t                 file_nb_frames;\r
-       int64_t                 file_frame_number;\r
-};\r
-\r
 class layer : boost::noncopyable\r
 {\r
 public:\r
@@ -63,9 +52,7 @@ public:
 \r
        bool is_paused() const;\r
        int64_t frame_number() const;\r
-\r
-       layer_status status() const;\r
-\r
+       \r
        bool empty() const;\r
 \r
        safe_ptr<frame_producer> foreground() const; // nothrow\r
index f7066a1d2fd09fc1195942880d3609684966ecb3..62b50806e78974e9911b67eb21abdf00fea3270f 100644 (file)
@@ -25,6 +25,7 @@
 #include <core/producer/frame/basic_frame.h>\r
 \r
 #include <boost/regex.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <deque>\r
 \r
@@ -74,6 +75,13 @@ struct playlist_producer : public frame_producer
                return L"playlist[" + current_->print() + L"]";\r
        }       \r
 \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"playlist-producer");\r
+               return info;\r
+       }\r
+\r
        virtual int64_t nb_frames() const  override\r
        {\r
                return std::numeric_limits<int>::max();\r
index cd1774adcbe8096bcbb7fbaa11596353f59ec55b..9c796e92a0f2bc721327693561051df732dd7a11 100644 (file)
@@ -79,29 +79,23 @@ struct separated_producer : public frame_producer
                return disable_audio(last_frame_);\r
        }\r
 \r
-       virtual std::wstring print() const override\r
-       {\r
-               return L"separated[fill:" + fill_producer_->print() + L"|key:" + key_producer_->print() + L"]";\r
-       }       \r
-\r
        virtual int64_t nb_frames() const override\r
        {\r
                return std::min(fill_producer_->nb_frames(), key_producer_->nb_frames());\r
        }\r
-               \r
-       virtual int64_t file_nb_frames() const override\r
-       {\r
-               return std::min(fill_producer_->file_nb_frames(), key_producer_->file_nb_frames());\r
-       }\r
-       \r
-       virtual int64_t frame_number() const override\r
+\r
+       virtual std::wstring print() const override\r
        {\r
-               return std::max(fill_producer_->frame_number(), key_producer_->frame_number());\r
-       }\r
-       \r
-       virtual int64_t file_frame_number() const override\r
+               return L"separated[fill:" + fill_producer_->print() + L"|key:" + key_producer_->print() + L"]";\r
+       }       \r
+\r
+       boost::property_tree::wptree info() const override\r
        {\r
-               return std::max(fill_producer_->file_frame_number(), key_producer_->file_frame_number());\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"separated-producer");\r
+               info.add_child(L"fill.producer",        fill_producer_->info());\r
+               info.add_child(L"key.producer", key_producer_->info());\r
+               return info;\r
        }\r
 };\r
 \r
index 1d0434815d0ee55698e1a6768115421ff2e68d5e..6f1ba98b48e331273a8ac8996668e82018e98c38 100644 (file)
@@ -203,15 +203,7 @@ public:
                        }, high_priority);\r
                }\r
        }\r
-\r
-       boost::unique_future<layer_status> get_status(int index)\r
-       {               \r
-               return executor_.begin_invoke([=]\r
-               {\r
-                       return layers_[index].status();\r
-               }, high_priority );\r
-       }\r
-       \r
+               \r
        boost::unique_future<safe_ptr<frame_producer>> foreground(int index)\r
        {\r
                return executor_.begin_invoke([=]\r
@@ -241,17 +233,20 @@ public:
                return std::move(executor_.begin_invoke([&]() -> boost::property_tree::wptree\r
                {\r
                        boost::property_tree::wptree info;\r
-                       auto& layers_node = info.add(L"stage.layers", L"");\r
-                       BOOST_FOREACH(auto& layer, layers_)\r
-                       {\r
-                               auto layer_info = layer.second.info();\r
-                               layer_info.add(L"layer.index", layer.first);\r
-                               BOOST_FOREACH(auto& update, layer_info)   \r
-                                       layers_node.add_child(update.first, update.second);\r
-                       }\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
        }\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
+               {\r
+                       return layers_[index].info();\r
+               }, high_priority));\r
+       }\r
 };\r
 \r
 stage::stage(const safe_ptr<diagnostics::graph>& graph, const safe_ptr<target_t>& target, const video_format_desc& format_desc) : impl_(new implementation(graph, target, format_desc)){}\r
@@ -265,10 +260,10 @@ void stage::clear(){impl_->clear();}
 void stage::swap_layers(const safe_ptr<stage>& other){impl_->swap_layers(other);}\r
 void stage::swap_layer(int index, size_t other_index){impl_->swap_layer(index, other_index);}\r
 void stage::swap_layer(int index, size_t other_index, const safe_ptr<stage>& other){impl_->swap_layer(index, other_index, other);}\r
-boost::unique_future<layer_status> stage::get_status(int index){return impl_->get_status(index);}\r
-boost::unique_future<safe_ptr<frame_producer>> stage::foreground(size_t index) {return impl_->foreground(index);}\r
-boost::unique_future<safe_ptr<frame_producer>> stage::background(size_t index) {return impl_->background(index);}\r
+boost::unique_future<safe_ptr<frame_producer>> stage::foreground(int index) {return impl_->foreground(index);}\r
+boost::unique_future<safe_ptr<frame_producer>> stage::background(int index) {return impl_->background(index);}\r
 boost::unique_future<std::wstring> stage::call(int index, bool foreground, const std::wstring& param){return impl_->call(index, foreground, param);}\r
 void stage::set_video_format_desc(const video_format_desc& format_desc){impl_->set_video_format_desc(format_desc);}\r
 boost::unique_future<boost::property_tree::wptree> stage::info() const{return impl_->info();}\r
+boost::unique_future<boost::property_tree::wptree> stage::info(int index) const{return impl_->info(index);}\r
 }}
\ No newline at end of file
index eff2545b7079c5d6bf3e32fedafd25adeb679e7a..f825b6370460e735dc4d189b64566ec21847e489 100644 (file)
@@ -45,7 +45,6 @@ public:
        // stage\r
 \r
        void spawn_token();\r
-\r
                        \r
        void load(int index, const safe_ptr<frame_producer>& producer, bool preview = false, int auto_play_delta = -1);\r
        void pause(int index);\r
@@ -58,13 +57,13 @@ public:
        void swap_layer(int index, size_t other_index, const safe_ptr<stage>& other);\r
        \r
        boost::unique_future<std::wstring>                              call(int index, bool foreground, const std::wstring& param);\r
-       boost::unique_future<layer_status>                              get_status(int index);\r
-       boost::unique_future<safe_ptr<frame_producer>>  foreground(size_t index);\r
-       boost::unique_future<safe_ptr<frame_producer>>  background(size_t index);\r
-       \r
-       void set_video_format_desc(const video_format_desc& format_desc);\r
+       boost::unique_future<safe_ptr<frame_producer>>  foreground(int index);\r
+       boost::unique_future<safe_ptr<frame_producer>>  background(int index);\r
 \r
        boost::unique_future<boost::property_tree::wptree> info() const;\r
+       boost::unique_future<boost::property_tree::wptree> info(int layer) const;\r
+       \r
+       void set_video_format_desc(const video_format_desc& format_desc);\r
 \r
 private:\r
        struct implementation;\r
index e04f6dd792ec1e70f6dadb3b49d16833c375d6e3..fa661d5b19958251e019b237ae0df70307d2d3b5 100644 (file)
@@ -100,27 +100,21 @@ struct transition_producer : public frame_producer
        {\r
                return get_following_producer()->nb_frames();\r
        }\r
-       \r
-       virtual int64_t file_nb_frames() const override\r
-       {\r
-               return get_following_producer()->file_nb_frames();\r
-       }\r
-       \r
-       virtual int64_t frame_number() const override\r
-       {\r
-               return get_following_producer()->frame_number();\r
-       }\r
-       \r
-       virtual int64_t file_frame_number() const override\r
-       {\r
-               return get_following_producer()->file_frame_number();\r
-       }\r
 \r
        virtual std::wstring print() const override\r
        {\r
                return L"transition[" + source_producer_->print() + L"|" + dest_producer_->print() + L"]";\r
        }\r
        \r
+       boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"transition-producer");\r
+               info.add_child(L"source.producer",         source_producer_->info());\r
+               info.add_child(L"destination.producer", dest_producer_->info());\r
+               return info;\r
+       }\r
+\r
        // transition_producer\r
                                                \r
        safe_ptr<basic_frame> compose(const safe_ptr<basic_frame>& dest_frame, const safe_ptr<basic_frame>& src_frame) \r
index 5cca96834c72d28d1f0a5cff01ec61728d9c73e6..904fc4cbf9b8f4bc582f4c9adf15dc361bac417b 100644 (file)
@@ -92,19 +92,19 @@ public:
        boost::property_tree::wptree info() const\r
        {\r
                boost::property_tree::wptree info;\r
-               info.put(L"channel.video-mode", format_desc_.name);\r
 \r
-               auto& channel_node = info.get_child(L"channel");\r
                auto stage_info  = stage_->info();\r
                auto mixer_info  = mixer_->info();\r
                auto output_info = output_->info();\r
 \r
-               BOOST_FOREACH(auto& update, stage_info.get())   \r
-                       channel_node.put_child(update.first, update.second);\r
-               BOOST_FOREACH(auto& update, mixer_info.get())   \r
-                       channel_node.put_child(update.first, update.second);\r
-               BOOST_FOREACH(auto& update, output_info.get())   \r
-                       channel_node.put_child(update.first, update.second);\r
+               stage_info.timed_wait(boost::posix_time::seconds(2));\r
+               mixer_info.timed_wait(boost::posix_time::seconds(2));\r
+               output_info.timed_wait(boost::posix_time::seconds(2));\r
+               \r
+               info.add(L"video-mode", format_desc_.name);\r
+               info.add_child(L"stage", stage_info.get());\r
+               info.add_child(L"mixer", mixer_info.get());\r
+               info.add_child(L"output", output_info.get());\r
    \r
                return info;                       \r
        }\r
index b3f859a8acb460523d123031f1031065e32569e7..14661432564447702e2e5e0382fea87aa8595c8e 100644 (file)
@@ -41,6 +41,7 @@
 \r
 #include <boost/timer.hpp>\r
 #include <boost/range/algorithm.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <memory>\r
 #include <array>\r
@@ -338,6 +339,16 @@ public:
                return consumer_ ? consumer_->print() : L"[bluefish_consumer]";\r
        }\r
 \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"bluefish-consumer");\r
+               info.add(L"key-only", key_only_);\r
+               info.add(L"device", device_index_);\r
+               info.add(L"embedded-audio", embedded_audio_);\r
+               return info;\r
+       }\r
+\r
        size_t buffer_depth() const override\r
        {\r
                return 1;\r
index d6bf924b24f371f15f41e5fea06c2b9fcc8b7751..3f1462933cf4c897852742bc1d61b28f770975b1 100644 (file)
@@ -42,6 +42,7 @@
 \r
 #include <boost/circular_buffer.hpp>\r
 #include <boost/timer.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 namespace caspar { namespace decklink { \r
        \r
@@ -476,7 +477,20 @@ public:
        virtual std::wstring print() const override\r
        {\r
                return context_ ? context_->print() : L"[decklink_consumer]";\r
-       }                       \r
+       }               \r
+\r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"decklink-consumer");\r
+               info.add(L"key-only", config_.key_only);\r
+               info.add(L"device", config_.device_index);\r
+               info.add(L"low-latency", config_.low_latency);\r
+               info.add(L"embedded-audio", config_.embedded_audio);\r
+               info.add(L"low-latency", config_.low_latency);\r
+               info.add(L"internal-key", config_.internal_key);\r
+               return info;\r
+       }\r
 \r
        virtual size_t buffer_depth() const override\r
        {\r
index c9abad893c5d5f8d0d6945ceec9f42d5294d76ee..6474be1510e5a4943d87e538459983216420487e 100644 (file)
@@ -4,7 +4,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Fri Dec 02 15:12:59 2011\r
+/* at Fri Dec 02 22:18:37 2011\r
  */\r
 /* Compiler settings for interop\DeckLinkAPI.idl:\r
     Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
index b150561c0813eec7e9b479ddd13e3a3b0ae0c658..ace0b473a921563ad496d77b01c2504b813394c1 100644 (file)
@@ -6,7 +6,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Fri Dec 02 15:12:59 2011\r
+/* at Fri Dec 02 22:18:37 2011\r
  */\r
 /* Compiler settings for interop\DeckLinkAPI.idl:\r
     Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
index 105f8d05a172b929e4230bfc816f5404f73a04df..9b01700fe45f15fc76805ccb02bc7ad24c242216 100644 (file)
@@ -43,6 +43,7 @@
 \r
 #include <boost/algorithm/string.hpp>\r
 #include <boost/foreach.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 #include <boost/timer.hpp>\r
 \r
 #if defined(_MSC_VER)\r
@@ -286,6 +287,13 @@ public:
        {\r
                return context_->print();\r
        }\r
+\r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"decklink-producer");\r
+               return info;\r
+       }\r
 };\r
 \r
 safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::vector<std::wstring>& params)\r
index fb398771232803c06fbc1e4c1009b53fec784dbd..1db5f5ad7a23ee687ca621cb2a4349db51bb1257 100644 (file)
@@ -49,6 +49,7 @@
 #include <boost/filesystem.hpp>\r
 #include <boost/foreach.hpp>\r
 #include <boost/range/algorithm.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <common/utility/string.h>\r
 #include <common/utility/assert.h>\r
index 2762100e10e4ee56b004b04b2d5d417857fe18e2..f488be7d0684d92b408560c5b6bcb1331a9d64c1 100644 (file)
 #include <common/utility/string.h>\r
 #include <common/env.h>\r
 \r
+#include <boost/algorithm/string.hpp>\r
 #include <boost/timer.hpp>\r
 #include <boost/thread/once.hpp>\r
 #include <boost/thread.hpp>\r
-#include <boost/algorithm/string.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <tbb/cache_aligned_allocator.h>\r
 #include <tbb/parallel_invoke.h>\r
@@ -385,14 +386,14 @@ struct ffmpeg_consumer_proxy : public core::frame_consumer
 {\r
        const std::wstring      filename_;\r
        const bool                      key_only_;\r
-       const std::string       codec_;\r
-       const std::string       options_;\r
+       const std::wstring      codec_;\r
+       const std::wstring      options_;\r
 \r
        std::unique_ptr<ffmpeg_consumer> consumer_;\r
 \r
 public:\r
 \r
-       ffmpeg_consumer_proxy(const std::wstring& filename, bool key_only, const std::string codec, const std::string& options)\r
+       ffmpeg_consumer_proxy(const std::wstring& filename, bool key_only, const std::wstring codec, const std::wstring& options)\r
                : filename_(filename)\r
                , key_only_(key_only)\r
                , codec_(boost::to_lower_copy(codec))\r
@@ -403,7 +404,7 @@ public:
        virtual void initialize(const core::video_format_desc& format_desc, int)\r
        {\r
                consumer_.reset();\r
-               consumer_.reset(new ffmpeg_consumer(narrow(filename_), format_desc, codec_, options_));\r
+               consumer_.reset(new ffmpeg_consumer(narrow(filename_), format_desc, narrow(codec_), narrow(options_)));\r
        }\r
        \r
        virtual bool send(const safe_ptr<core::read_frame>& frame) override\r
@@ -416,6 +417,17 @@ public:
        {\r
                return consumer_ ? consumer_->print() : L"[ffmpeg_consumer]";\r
        }\r
+\r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"ffmpeg-consumer");\r
+               info.add(L"key-only", key_only_);\r
+               info.add(L"filename", filename_);\r
+               info.add(L"codec", codec_);\r
+               info.add(L"options", options_);\r
+               return info;\r
+       }\r
                \r
        virtual bool has_synchronization_clock() const override\r
        {\r
@@ -442,21 +454,21 @@ safe_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>&
 \r
        bool key_only = std::find(params.begin(), params.end(), L"KEY_ONLY") != params.end();\r
 \r
-       std::string codec = "libx264";\r
+       std::wstring codec = L"libx264";\r
        auto codec_it = std::find(params.begin(), params.end(), L"CODEC");\r
        if(codec_it != params.end() && codec_it++ != params.end())\r
-               codec = narrow(*codec_it);\r
+               codec = *codec_it;\r
 \r
-       if(codec == "H264")\r
-               codec = "libx264";\r
+       if(codec == L"H264")\r
+               codec = L"libx264";\r
 \r
-       if(codec == "DVCPRO")\r
-               codec = "dvvideo";\r
+       if(codec == L"DVCPRO")\r
+               codec = L"dvvideo";\r
 \r
-       std::string options = "";\r
+       std::wstring options = L"";\r
        auto options_it = std::find(params.begin(), params.end(), L"OPTIONS");\r
        if(options_it != params.end() && options_it++ != params.end())\r
-               options = narrow(*options_it);\r
+               options = *options_it;\r
 \r
        return make_safe<ffmpeg_consumer_proxy>(env::media_folder() + filename, key_only, codec, boost::to_lower_copy(options));\r
 }\r
@@ -468,7 +480,7 @@ safe_ptr<core::frame_consumer> create_consumer(const boost::property_tree::ptree
        auto codec                       = ptree.get("codec", "libx264");\r
        auto options             = ptree.get("options", "");\r
        \r
-       return make_safe<ffmpeg_consumer_proxy>(env::media_folder() + widen(filename), key_only, codec, options);\r
+       return make_safe<ffmpeg_consumer_proxy>(env::media_folder() + widen(filename), key_only, widen(codec), widen(options));\r
 }\r
 \r
 }}\r
index 43612e4caec2ef708402cd43e7131420b2002dab..daf6528e3c000984bc93a5bbf3dfc23d8bfb7778 100644 (file)
@@ -184,7 +184,7 @@ public:
                return nb_frames - start_;\r
        }\r
 \r
-       virtual int64_t file_nb_frames() const override\r
+       virtual int64_t file_nb_frames() const\r
        {\r
                int64_t file_nb_frames = 0;\r
                file_nb_frames = std::max(file_nb_frames, video_decoder_ ? video_decoder_->nb_frames() : 0);\r
@@ -192,12 +192,12 @@ public:
                return file_nb_frames;\r
        }\r
 \r
-       virtual int64_t frame_number() const override\r
+       virtual int64_t frame_number() const\r
        {\r
                return frame_number_;\r
        }\r
 \r
-       virtual int64_t file_frame_number() const override\r
+       virtual int64_t file_frame_number() const\r
        {\r
                return file_frame_number_;\r
        }\r
@@ -211,16 +211,35 @@ public:
                                \r
        virtual std::wstring print() const override\r
        {\r
-               if(video_decoder_)\r
-               {\r
-                       return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"|" + print_mode(video_decoder_->width(), video_decoder_->height(), fps_, !video_decoder_->is_progressive())\r
-                                                         + L"|" + boost::lexical_cast<std::wstring>(file_frame_number()) + L"/" + boost::lexical_cast<std::wstring>(file_nb_frames()) + L"]";\r
-               }\r
-               \r
-               return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"]";\r
+               return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"|" \r
+                                                 + print_mode() + L"|" \r
+                                                 + boost::lexical_cast<std::wstring>(file_frame_number()) + L"/" + boost::lexical_cast<std::wstring>(file_nb_frames()) + L"]";\r
+       }\r
+\r
+       boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type",                               L"ffmpeg-producer");\r
+               info.add(L"filename",                   filename_);\r
+               info.add(L"width",                              video_decoder_ ? video_decoder_->width() : 0);\r
+               info.add(L"height",                             video_decoder_ ? video_decoder_->height() : 0);\r
+               info.add(L"progressive",                video_decoder_ ? video_decoder_->is_progressive() : false);\r
+               info.add(L"fps",                                fps_);\r
+               info.add(L"loop",                               input_.loop());\r
+               info.add(L"frame-number",               frame_number_);\r
+               auto nb_frames2 = nb_frames();\r
+               info.add(L"nb-frames",                  nb_frames2 == std::numeric_limits<int64_t>::max() ? -1 : nb_frames2);\r
+               info.add(L"file-frame-number",  file_frame_number_);\r
+               info.add(L"file-nb-frames",             file_nb_frames());\r
+               return info;\r
        }\r
 \r
        // ffmpeg_producer\r
+\r
+       std::wstring print_mode() const\r
+       {\r
+               return video_decoder_ ? ffmpeg::print_mode(video_decoder_->width(), video_decoder_->height(), fps_, !video_decoder_->is_progressive()) : L"";\r
+       }\r
                                        \r
        std::wstring do_call(const std::wstring& param)\r
        {\r
index 54eefef86351086facdc3ecce2f4976f1ef2c907..3de03c9fb2fc8a5519f13d2cfd8b048219c30947 100644 (file)
 #include <boost/filesystem.hpp>\r
 #include <boost/foreach.hpp>\r
 #include <boost/range/algorithm.hpp>\r
+#include <boost/format.hpp>\r
+#include <boost/algorithm/string.hpp>\r
+#include <boost/regex.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include "../common/utility/string.h"\r
 #include "../common/memory/safe_ptr.h"\r
index 26f04d4a5aaf2a28c60567962ae795d8420d3aa6..c920db2e92f173782f186d952ff0247cda073221 100644 (file)
@@ -31,6 +31,7 @@
 #include <boost/format.hpp>\r
 #include <boost/algorithm/string.hpp>\r
 #include <boost/regex.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
                \r
 namespace caspar { namespace flash {\r
        \r
@@ -102,7 +103,7 @@ public:
                return flash_producer_->call(str);\r
        }\r
 \r
-       boost::unique_future<std::wstring> info()\r
+       boost::unique_future<std::wstring> template_host_info()\r
        {\r
                auto str = (boost::wformat(L"<invoke name=\"GetInfo\" returntype=\"xml\"><arguments></arguments></invoke>")).str();\r
                CASPAR_LOG(info) << flash_producer_->print() << " Invoking info-command: " << str;\r
@@ -137,7 +138,7 @@ public:
                else if(boost::regex_match(str, what, description_exp))\r
                        return description(boost::lexical_cast<int>(what["LAYER"].str())); \r
                else if(boost::regex_match(str, what, invoke_exp))\r
-                       return info(); \r
+                       return template_host_info(); \r
 \r
                return flash_producer_->call(str);\r
        }\r
@@ -157,6 +158,13 @@ public:
                return flash_producer_->print();\r
        }\r
 \r
+       boost::property_tree::wptree info() const\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"cg-producer");\r
+               return info;\r
+       }\r
+\r
        std::wstring timed_invoke(int layer, const std::wstring& label)\r
        {\r
                auto result = invoke(layer, label);\r
@@ -171,9 +179,9 @@ public:
                        return result.get();\r
                return L"";\r
        }\r
-       std::wstring timed_info()\r
+       std::wstring timed_template_host_info()\r
        {\r
-               auto result = info();\r
+               auto result = template_host_info();\r
                if(result.timed_wait(boost::posix_time::seconds(2)))\r
                        return result.get();\r
                return L"";\r
@@ -233,6 +241,7 @@ std::wstring cg_producer::print() const{return impl_->print();}
 boost::unique_future<std::wstring> cg_producer::call(const std::wstring& str){return impl_->call(str);}\r
 std::wstring cg_producer::invoke(int layer, const std::wstring& label){return impl_->timed_invoke(layer, label);}\r
 std::wstring cg_producer::description(int layer){return impl_->timed_description(layer);}\r
-std::wstring cg_producer::info(){return impl_->timed_info();}\r
+std::wstring cg_producer::template_host_info(){return impl_->timed_template_host_info();}\r
+boost::property_tree::wptree cg_producer::info() const{return impl_->info();}\r
 \r
 }}
\ No newline at end of file
index 6b6cf224188d23b2b9f4b2b4f3517243d5b00829..4b5b45e210ce4212aee80a3bdd8a62eac328f427 100644 (file)
@@ -44,6 +44,7 @@ public:
        virtual safe_ptr<core::basic_frame> last_frame() const override;\r
        virtual std::wstring print() const override;\r
        virtual boost::unique_future<std::wstring> call(const std::wstring&) override;\r
+       virtual boost::property_tree::wptree info() const override;\r
 \r
        //cg_producer\r
 \r
@@ -55,7 +56,7 @@ public:
        void update(int layer, const std::wstring& data);\r
        std::wstring invoke(int layer, const std::wstring& label);\r
        std::wstring description(int layer);\r
-       std::wstring info();\r
+       std::wstring template_host_info();\r
 \r
 private:\r
        struct implementation;\r
index b3e0072ed4f298e2d085fa6b1026180549db142e..65457bfc5afbde8551ff1b2f64d473c6079be3b9 100644 (file)
@@ -42,6 +42,7 @@
 #include <common/utility/timer.h>\r
 \r
 #include <boost/filesystem.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 #include <boost/thread.hpp>\r
 #include <boost/timer.hpp>\r
 #include <boost/algorithm/string.hpp>\r
@@ -375,6 +376,13 @@ public:
                return L"flash[" + boost::filesystem::wpath(filename_).filename() + L"|" + boost::lexical_cast<std::wstring>(fps_) + L"]";              \r
        }       \r
 \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"flash-producer");\r
+               return info;\r
+       }\r
+\r
        // flash_producer\r
 \r
        void initialize()\r
index b4b7db10cf38ed3e2ec5da4f0d903ee5a584179d..dad828ccdbc231b22339a67a2f730c122756d6f2 100644 (file)
@@ -81,6 +81,13 @@ public:
                return L"image[]";\r
        }\r
 \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"image-consumer");\r
+               return info;\r
+       }\r
+\r
        virtual size_t buffer_depth() const override\r
        {\r
                return 0;\r
index 532fd9d216e141d624da7faaf8502d62167f7984..44947dd39069f5b9c02e2a53f4986049e8f6da25 100644 (file)
@@ -31,6 +31,7 @@
 \r
 #include <boost/assign.hpp>\r
 #include <boost/filesystem.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <algorithm>\r
 \r
@@ -76,6 +77,14 @@ struct image_producer : public core::frame_producer
        {\r
                return L"image_producer[" + filename_ + L"]";\r
        }\r
+\r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"image-producer");\r
+               info.add(L"filename", filename_);\r
+               return info;\r
+       }\r
 };\r
 \r
 safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::vector<std::wstring>& params)\r
index 860a0391e4fb0989fdaa11c02666737cdef016ef..b5d8fccb316121133921f64cd6a4a8385d2601f7 100644 (file)
@@ -39,6 +39,7 @@
 #include <boost/filesystem.hpp>\r
 #include <boost/foreach.hpp>\r
 #include <boost/lexical_cast.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <algorithm>\r
 #include <array>\r
@@ -202,6 +203,14 @@ struct image_scroll_producer : public core::frame_producer
                return L"image_scroll_producer[" + filename_ + L"]";\r
        }\r
 \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"image-scroll-producer");\r
+               info.add(L"filename", filename_);\r
+               return info;\r
+       }\r
+\r
        virtual int64_t nb_frames() const override\r
        {\r
                if(height_ > format_desc_.height)\r
index e554e2b5d263884b0dd53439846e2dc7768bf655..95211cee8ea260c92281424aa72b41e9cc38a58c 100644 (file)
@@ -35,6 +35,7 @@
 #include <SFML/Audio.hpp>\r
 \r
 #include <boost/circular_buffer.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 #include <boost/timer.hpp>\r
 \r
 #include <tbb/concurrent_queue.h>\r
@@ -106,6 +107,13 @@ public:
        {\r
                return L"oal[" + boost::lexical_cast<std::wstring>(channel_index_) + L"|" + format_desc_.name + L"]";\r
        }\r
+\r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"oal-consumer");\r
+               return info;\r
+       }\r
        \r
        virtual size_t buffer_depth() const override\r
        {\r
index f0ef11566c3db94b1d93f3cfc9514a24905a8fc3..e07d1974f09ef6d15635ea49f6f8930a2068e7e8 100644 (file)
@@ -42,6 +42,7 @@
 #include <boost/circular_buffer.hpp>\r
 #include <boost/foreach.hpp>\r
 #include <boost/thread.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <tbb/atomic.h>\r
 #include <tbb/concurrent_queue.h>\r
@@ -464,6 +465,16 @@ public:
                return consumer_ ? consumer_->print() : L"[ogl_consumer]";\r
        }\r
 \r
+       virtual boost::property_tree::wptree info() const override\r
+       {\r
+               boost::property_tree::wptree info;\r
+               info.add(L"type", L"ogl-consumer");\r
+               info.add(L"key-only", config_.key_only);\r
+               info.add(L"windowed", config_.windowed);\r
+               info.add(L"auto-deinterlace", config_.auto_deinterlace);\r
+               return info;\r
+       }\r
+\r
        virtual bool has_synchronization_clock() const override\r
        {\r
                return false;\r
index d5017cfc4e5e9d1a35e02322bf01e1333eafd71e..9343a02f7ae77de00f981c71a8e1da2f2ad8a34d 100644 (file)
 \r
 namespace caspar { namespace protocol { namespace amcp {\r
        \r
-AMCPCommandQueue::AMCPCommandQueue() : newCommandEvent_(FALSE, FALSE) \r
-{}\r
-\r
-AMCPCommandQueue::~AMCPCommandQueue() \r
-{\r
-       Stop();\r
-}\r
-\r
-bool AMCPCommandQueue::Start() \r
+AMCPCommandQueue::AMCPCommandQueue() \r
+       : executor_(L"AMCPCommandQueue")\r
 {\r
-       if(commandPump_.IsRunning())\r
-               return false;\r
-\r
-       return commandPump_.Start(this);\r
 }\r
 \r
-void AMCPCommandQueue::Stop() \r
+AMCPCommandQueue::~AMCPCommandQueue() \r
 {\r
-       commandPump_.Stop();\r
 }\r
 \r
-void AMCPCommandQueue::AddCommand(AMCPCommandPtr pNewCommand)\r
+void AMCPCommandQueue::AddCommand(AMCPCommandPtr pCurrentCommand)\r
 {\r
-       {\r
-               tbb::mutex::scoped_lock lock(mutex_);\r
+       if(!pCurrentCommand)\r
+               return;\r
 \r
-               if(pNewCommand->GetScheduling() == ImmediatelyAndClear) {\r
-                       //Clears the queue, objects are deleted automatically\r
-                       commands_.clear();\r
-\r
-                       commands_.push_back(pNewCommand);\r
-                       CASPAR_LOG(info) << "Cleared queue and added command";\r
-               }\r
-               else {\r
-                       commands_.push_back(pNewCommand);\r
-                       CASPAR_LOG(info) << "Added command to end of queue";\r
-               }\r
-       }\r
-\r
-       SetEvent(newCommandEvent_);\r
-}\r
-\r
-void AMCPCommandQueue::Run(HANDLE stopEvent)\r
-{\r
-       bool logTemporarilyBadState = true;\r
-       AMCPCommandPtr pCurrentCommand;\r
-\r
-       CASPAR_LOG(info) << "AMCP CommandPump started";\r
-\r
-       while(WaitForSingleObject(stopEvent, 0) != WAIT_OBJECT_0)\r
+       //if(pNewCommand->GetScheduling() == ImmediatelyAndClear)\r
+       //      executor_.clear();\r
+       \r
+       executor_.begin_invoke([=]\r
        {\r
-               DWORD waitResult = WaitForSingleObject(newCommandEvent_, 50);\r
-               if(waitResult == WAIT_OBJECT_0) \r
-               {\r
-                       tbb::mutex::scoped_lock lock(mutex_);\r
-\r
-                       if(commands_.size() > 0)\r
-                       {\r
-                               CASPAR_LOG(debug) << "Found " << commands_.size() << " commands in queue";\r
-\r
-                               AMCPCommandPtr pNextCommand = commands_.front();\r
-\r
-                               if(pCurrentCommand == 0 || pNextCommand->GetScheduling() == ImmediatelyAndClear) {\r
-                                       pCurrentCommand = pNextCommand;\r
-                                       commands_.pop_front();\r
-                               }\r
-                       }\r
-               }\r
-\r
-               if(pCurrentCommand != 0) \r
+               try\r
                {\r
                        try\r
                        {\r
@@ -109,32 +59,14 @@ void AMCPCommandQueue::Run(HANDLE stopEvent)
                        }\r
                                \r
                        pCurrentCommand->SendReply();\r
-                       pCurrentCommand.reset();\r
-\r
-                       newCommandEvent_.Set();\r
-                       logTemporarilyBadState = true;\r
-\r
+                       \r
                        CASPAR_LOG(info) << "Ready for a new command";\r
                }\r
-       }\r
-\r
-       CASPAR_LOG(info) << "CommandPump ended";\r
-}\r
-\r
-bool AMCPCommandQueue::OnUnhandledException(const std::exception& ex) throw() \r
-{\r
-       bool bDoRestart = true;\r
-\r
-       try \r
-       {\r
-               CASPAR_LOG(fatal) << "UNHANDLED EXCEPTION in commandqueue. Message: " << ex.what();\r
-       }\r
-       catch(...)\r
-       {\r
-               bDoRestart = false;\r
-       }\r
-\r
-       return bDoRestart;\r
+               catch(...)\r
+               {\r
+                       CASPAR_LOG_CURRENT_EXCEPTION();\r
+               }\r
+       });\r
 }\r
 \r
 }}}
\ No newline at end of file
index 54660e2cc2fa26fd6cb6228a8f142f52942d4af8..21829006fe9161a16665d0d8b6654dc8868094ab 100644 (file)
 \r
 #include "AMCPCommand.h"\r
 \r
+#include <common/concurrency/executor.h>\r
+\r
 #include <tbb\mutex.h>\r
 \r
 namespace caspar { namespace protocol { namespace amcp {\r
 \r
-class AMCPCommandQueue : public IRunnable\r
+class AMCPCommandQueue\r
 {\r
        AMCPCommandQueue(const AMCPCommandQueue&);\r
        AMCPCommandQueue& operator=(const AMCPCommandQueue&);\r
@@ -35,20 +37,10 @@ public:
        AMCPCommandQueue();\r
        ~AMCPCommandQueue();\r
 \r
-       bool Start();\r
-       void Stop();\r
        void AddCommand(AMCPCommandPtr pCommand);\r
 \r
 private:\r
-       Thread                          commandPump_;\r
-       virtual void Run(HANDLE stopEvent);\r
-       virtual bool OnUnhandledException(const std::exception& ex) throw();\r
-\r
-       Event newCommandEvent_;\r
-\r
-       //Needs synro-protection\r
-       std::list<AMCPCommandPtr>       commands_;\r
-       tbb::mutex mutex_;\r
+       executor                        executor_;\r
 };\r
 typedef std::tr1::shared_ptr<AMCPCommandQueue> AMCPCommandQueuePtr;\r
 \r
index ccd7590a197ca3e030fe8eada47c72eb0059eb37..cc7613facb9ed3c06f8f6c1523dc6cb3d1f9a623 100644 (file)
@@ -806,38 +806,6 @@ bool PrintCommand::DoExecute()
        return true;\r
 }\r
 \r
-bool StatusCommand::DoExecute()\r
-{                              \r
-       if (GetLayerIndex() > -1)\r
-       {\r
-               auto status = GetChannel()->stage()->get_status(GetLayerIndex()).get();\r
-               std::wstringstream status_text;\r
-               status_text\r
-                       << L"201 STATUS OK\r\n"\r
-                       << L"<layer>"\r
-                       << L"\n\t<index>"                               << GetLayerIndex() << L"</index>"\r
-                       << L"\n\t<foreground>"                  << status.foreground << L"</foreground>"\r
-                       << L"\n\t<background>"                  << status.background << L"</background>"\r
-                       << L"\n\t<status>"                              << (status.is_paused ? L"paused" : L"playing") << L"</status>"\r
-                       << L"\n\t<nb-frames>"                   << (status.nb_frames == std::numeric_limits<int64_t>::max() ? 0 : status.nb_frames) << L"</nb-frames>"\r
-                       << L"\n\t<frame-number>"                << status.frame_number << L"</frame-number>"\r
-                       << L"\n\t<file-nb-frames>"              << (status.file_nb_frames == std::numeric_limits<int64_t>::max() ? 0 : status.file_nb_frames) << L"</file-nb-frames>"\r
-                       << L"\n\t<file-frame-number>"   << status.file_frame_number << L"</file-frame-number>"\r
-                       << L"\n</layer>"\r
-                       << L"\r\n";\r
-\r
-               SetReplyString(status_text.str());\r
-               return true;\r
-       }\r
-       else\r
-       {\r
-               //NOTE: Possible to extend soo that "channel" status is returned when no layer is specified.\r
-\r
-               SetReplyString(TEXT("403 LAYER MUST BE SPECIFIED\r\n"));\r
-               return false;\r
-       }\r
-}\r
-\r
 bool LogCommand::DoExecute()\r
 {\r
        if(_parameters.at(0) == L"LEVEL")\r
@@ -1168,7 +1136,7 @@ bool CGCommand::DoExecuteInfo()
        }\r
        else \r
        {\r
-               auto info = flash::get_default_cg_producer(safe_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->info();\r
+               auto info = flash::get_default_cg_producer(safe_ptr<core::video_channel>(GetChannel()), GetLayerIndex(flash::cg_producer::DEFAULT_LAYER))->template_host_info();\r
                replyString << info << TEXT("\r\n"); \r
        }       \r
 \r
@@ -1360,22 +1328,28 @@ bool InfoCommand::DoExecute()
 \r
                        if(_parameters.size() >= 1)\r
                        {\r
-                               int channelIndex = boost::lexical_cast<int>(_parameters.at(0).c_str())-1;                                       \r
-                               boost::property_tree::xml_parser::write_xml(replyString, channels_.at(channelIndex)->info(), boost::property_tree::xml_writer_settings<wchar_t>(' ', 3));\r
+                               std::vector<std::wstring> split;\r
+                               boost::split(split, _parameters[0], boost::is_any_of("-"));\r
+                                       \r
+                               int layer = std::numeric_limits<int>::min();\r
+                               int channel = boost::lexical_cast<int>(split[0]) - 1;\r
+\r
+                               if(split.size() > 1)\r
+                                       layer = boost::lexical_cast<int>(split[1]);\r
+                               \r
+                               if(layer == std::numeric_limits<int>::min())\r
+                                       boost::property_tree::xml_parser::write_xml(replyString, channels_.at(channel)->info(), boost::property_tree::xml_writer_settings<wchar_t>(' ', 3));\r
+                               else\r
+                                       boost::property_tree::xml_parser::write_xml(replyString, channels_.at(channel)->stage()->info(layer).get(), boost::property_tree::xml_writer_settings<wchar_t>(' ', 3));\r
                        }\r
                        else\r
                        {\r
                                boost::property_tree::wptree info;\r
-                               auto& node = info.add(L"channels", L"");\r
                                int index = 0;\r
                                BOOST_FOREACH(auto channel, channels_)\r
-                               {\r
-                                       BOOST_FOREACH(auto update, channel->info())\r
-                                       {\r
-                                               auto& channel = node.add_child(update.first, update.second);\r
-                                               channel.push_front(std::make_pair(L"index", boost::lexical_cast<std::wstring>(++index)));\r
-                                       }\r
-                               }\r
+                                       info.add_child(L"channels.channel", channel->info())\r
+                                           .add(L"index", ++index);\r
+\r
                                boost::property_tree::xml_parser::write_xml(replyString, info, boost::property_tree::xml_writer_settings<wchar_t>(' ', 3));\r
                        }\r
                        replyString << TEXT("\r\n");\r
index ff7dda603c64da5d13b1459e7f137124038e143b..ca0cd0b3c42799fc02e3165a64044d0a8f7ea920 100644 (file)
@@ -108,12 +108,6 @@ class PrintCommand : public AMCPCommandBase<true, AddToQueue, 0>
        bool DoExecute();\r
 };\r
 \r
-class StatusCommand : public AMCPCommandBase<true, AddToQueue, 0>\r
-{\r
-       std::wstring print() const { return L"StatusCommand";}\r
-       bool DoExecute();\r
-};\r
-\r
 class LogCommand : public AMCPCommandBase<false, AddToQueue, 0>\r
 {\r
        std::wstring print() const { return L"LogCommand";}\r
index 0cb5d7a637babd4316f44a756c19118e91936462..38ea4e733bd46954e32ad33653715e032e9cf2af 100644 (file)
@@ -52,13 +52,7 @@ inline std::shared_ptr<core::video_channel> GetChannelSafe(unsigned int index, c
 \r
 AMCPProtocolStrategy::AMCPProtocolStrategy(const std::vector<safe_ptr<core::video_channel>>& channels) : channels_(channels) {\r
        AMCPCommandQueuePtr pGeneralCommandQueue(new AMCPCommandQueue());\r
-       if(!pGeneralCommandQueue->Start()) {\r
-               CASPAR_LOG(error) << "Failed to start the general command-queue";\r
-\r
-               //TODO: THROW!\r
-       }\r
-       else\r
-               commandQueues_.push_back(pGeneralCommandQueue);\r
+       commandQueues_.push_back(pGeneralCommandQueue);\r
 \r
 \r
        std::shared_ptr<core::video_channel> pChannel;\r
@@ -71,16 +65,8 @@ AMCPProtocolStrategy::AMCPProtocolStrategy(const std::vector<safe_ptr<core::vide
                //HACK: Perform real conversion from int to string\r
                TCHAR num = TEXT('1')+static_cast<TCHAR>(index);\r
                title += num;\r
-\r
-               if(!pChannelCommandQueue->Start()) {\r
-                       std::wstring logString = TEXT("Failed to start command-queue for ");\r
-                       logString += title;\r
-                       CASPAR_LOG(error) << logString;\r
-\r
-                       //TODO: THROW!\r
-               }\r
-               else\r
-                       commandQueues_.push_back(pChannelCommandQueue);\r
+               \r
+               commandQueues_.push_back(pChannelCommandQueue);\r
        }\r
 }\r
 \r
@@ -323,7 +309,6 @@ AMCPCommandPtr AMCPProtocolStrategy::CommandFactory(const std::wstring& str)
        else if(s == TEXT("STOP"))              return std::make_shared<StopCommand>();\r
        else if(s == TEXT("CLEAR"))             return std::make_shared<ClearCommand>();\r
        else if(s == TEXT("PRINT"))             return std::make_shared<PrintCommand>();\r
-       else if(s == TEXT("STATUS"))    return std::make_shared<StatusCommand>();\r
        else if(s == TEXT("LOG"))               return std::make_shared<LogCommand>();\r
        else if(s == TEXT("CG"))                return std::make_shared<CGCommand>();\r
        else if(s == TEXT("DATA"))              return std::make_shared<DataCommand>();\r
index 56068843d6fab207345858d83b33832f37218d4d..092fa0334fec5ec661480540c7b3a3c7b3a2d5a8 100644 (file)
@@ -7,14 +7,6 @@
     <template-path>D:\casparcg\_templates\</template-path>\r
   </paths>\r
   <channels>\r
-    <channel>\r
-      <video-mode>720p5000</video-mode>\r
-      <consumers>\r
-        <decklink>\r
-          <device>1</device>\r
-        </decklink>\r
-      </consumers>\r
-    </channel>\r
     <channel>\r
       <video-mode>720p5000</video-mode>\r
       <consumers>\r