]> git.sesse.net Git - casparcg/commitdiff
2.0.2: - Send index information to consumers.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 25 Nov 2011 23:22:22 +0000 (23:22 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 25 Nov 2011 23:22:22 +0000 (23:22 +0000)
       - ogl_consumer: Now possible to set window title.

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

13 files changed:
core/consumer/frame_consumer.h
core/consumer/output.cpp
core/consumer/output.h
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/image/consumer/image_consumer.cpp
modules/oal/consumer/oal_consumer.cpp
modules/ogl/consumer/ogl_consumer.cpp
shell/casparcg.config
shell/server.cpp

index e1880102f2c080eed12d953418ed9e6bd0615f28..2fde6f778c780c41bfd77499ca067c3c889fa18d 100644 (file)
@@ -39,7 +39,7 @@ struct frame_consumer : boost::noncopyable
        virtual ~frame_consumer() {}\r
        \r
        virtual bool send(const safe_ptr<read_frame>& frame) = 0;\r
-       virtual void initialize(const video_format_desc& format_desc) = 0;\r
+       virtual void initialize(const video_format_desc& format_desc, int channel_index, int sub_index) = 0;\r
        virtual std::wstring print() const = 0;\r
        virtual bool has_synchronization_clock() const {return true;}\r
        virtual size_t buffer_depth() const = 0;\r
@@ -50,7 +50,7 @@ struct frame_consumer : boost::noncopyable
                {\r
                        core::video_format_desc format_desc;\r
                        virtual bool send(const safe_ptr<read_frame>&){return false;}\r
-                       virtual void initialize(const video_format_desc&){}\r
+                       virtual void initialize(const video_format_desc&, int, int){}\r
                        virtual std::wstring print() const {return L"empty";}\r
                        virtual bool has_synchronization_clock() const {return false;}\r
                        virtual size_t buffer_depth() const {return 0;};\r
index 96b4c80ee337026b7c155bf5a5a3cd2ea1796e17..2b488cf1667307fa62b8357e79ebe02263d9b218 100644 (file)
@@ -45,6 +45,7 @@ struct output::implementation
 {      \r
        typedef std::pair<safe_ptr<read_frame>, safe_ptr<read_frame>> fill_and_key;\r
        \r
+       const int                                               channel_index_;\r
        safe_ptr<diagnostics::graph>    graph_;\r
        boost::timer                                    consume_timer_;\r
 \r
@@ -62,8 +63,9 @@ struct output::implementation
        executor executor_;\r
                \r
 public:\r
-       implementation(const safe_ptr<diagnostics::graph>& graph, const video_format_desc& format_desc) \r
-               : graph_(graph)\r
+       implementation(const safe_ptr<diagnostics::graph>& graph, const video_format_desc& format_desc, int channel_index) \r
+               : channel_index_(channel_index)\r
+               , graph_(graph)\r
                , format_desc_(format_desc)\r
                , executor_(L"output")\r
        {\r
@@ -77,7 +79,7 @@ public:
                        consumers_.erase(index);\r
                });\r
 \r
-               consumer->initialize(format_desc_);\r
+               consumer->initialize(format_desc_, channel_index_, index);\r
 \r
                executor_.invoke([&]\r
                {\r
@@ -111,7 +113,7 @@ public:
                        {                                               \r
                                try\r
                                {\r
-                                       it->second->initialize(format_desc_);\r
+                                       it->second->initialize(format_desc_, channel_index_, it->first);\r
                                        ++it;\r
                                }\r
                                catch(...)\r
@@ -185,7 +187,7 @@ public:
                                                CASPAR_LOG_CURRENT_EXCEPTION();\r
                                                try\r
                                                {\r
-                                                       consumer->initialize(format_desc_);\r
+                                                       consumer->initialize(format_desc_, channel_index_, it->first);\r
                                                        if(consumer->send(frame))\r
                                                                ++it;\r
                                                        else\r
@@ -225,7 +227,7 @@ private:
        }\r
 };\r
 \r
-output::output(const safe_ptr<diagnostics::graph>& graph, const video_format_desc& format_desc) : impl_(new implementation(graph, format_desc)){}\r
+output::output(const safe_ptr<diagnostics::graph>& graph, const video_format_desc& format_desc, int channel_index) : impl_(new implementation(graph, format_desc, channel_index)){}\r
 void output::add(int index, safe_ptr<frame_consumer>&& consumer){impl_->add(index, std::move(consumer));}\r
 void output::remove(int index){impl_->remove(index);}\r
 void output::send(const std::pair<safe_ptr<read_frame>, ticket>& frame) {impl_->send(frame); }\r
index e5d14bf0f628ab38856a10551a90efb34a2bd806..25dd2212f9564c3ff55301428eb87389405a02c2 100644 (file)
@@ -33,7 +33,7 @@ namespace caspar { namespace core {
 class output : public target<std::pair<safe_ptr<read_frame>, ticket>>, boost::noncopyable\r
 {\r
 public:\r
-       explicit output(const safe_ptr<diagnostics::graph>& graph, const video_format_desc& format_desc);\r
+       explicit output(const safe_ptr<diagnostics::graph>& graph, const video_format_desc& format_desc, int channel_index);\r
 \r
        void add(int index, safe_ptr<frame_consumer>&& consumer);\r
        void remove(int index);\r
index 2cfe4048d5d0427afb1f90744b669dd1369b4449..d5d2ecd81d8343f6bba41f40832e7491d7ce45ad 100644 (file)
@@ -51,7 +51,7 @@ public:
                : index_(index)\r
                , format_desc_(format_desc)\r
                , ogl_(ogl)\r
-               , output_(new caspar::core::output(graph_, format_desc))\r
+               , output_(new caspar::core::output(graph_, format_desc, index))\r
                , mixer_(new caspar::core::mixer(graph_, output_, format_desc, ogl))\r
                , stage_(new caspar::core::stage(graph_, mixer_, format_desc))  \r
        {\r
@@ -80,7 +80,7 @@ public:
                \r
        std::wstring print() const\r
        {\r
-               return L"video_channel[" + boost::lexical_cast<std::wstring>(index_+1) + L"|" +  format_desc_.name + L"]";\r
+               return L"video_channel[" + boost::lexical_cast<std::wstring>(index_) + L"|" +  format_desc_.name + L"]";\r
        }\r
 };\r
 \r
index f1a5275b706a746d20811e2a56c289a6cadebaec..2d7cd200f4781b501398706f981514dc8967fb7d 100644 (file)
@@ -50,6 +50,8 @@ struct bluefish_consumer : boost::noncopyable
        safe_ptr<CBlueVelvet4>                          blue_;\r
        const unsigned int                                      device_index_;\r
        const core::video_format_desc           format_desc_;\r
+       const int                                                       channel_index_;\r
+       const int                                                       sub_index_;\r
 \r
        const std::wstring                                      model_name_;\r
 \r
@@ -68,10 +70,12 @@ struct bluefish_consumer : boost::noncopyable
        \r
        executor                                                        executor_;\r
 public:\r
-       bluefish_consumer(const core::video_format_desc& format_desc, unsigned int device_index, bool embedded_audio, bool key_only) \r
+       bluefish_consumer(const core::video_format_desc& format_desc, unsigned int device_index, bool embedded_audio, bool key_only, int channel_index, int sub_index\r
                : blue_(create_blue(device_index))\r
                , device_index_(device_index)\r
                , format_desc_(format_desc) \r
+               , channel_index_(channel_index)\r
+               , sub_index_(sub_index)\r
                , model_name_(get_card_desc(*blue_))\r
                , vid_fmt_(get_video_mode(*blue_, format_desc))\r
                , embedded_audio_(embedded_audio)\r
@@ -283,7 +287,8 @@ public:
        \r
        std::wstring print() const\r
        {\r
-               return model_name_ + L" [" + boost::lexical_cast<std::wstring>(device_index_) + L"|" +  format_desc_.name + L"]";\r
+               return model_name_ + L" [" + boost::lexical_cast<std::wstring>(channel_index_) + L"-" + boost::lexical_cast<std::wstring>(sub_index_) + L"|device " + \r
+                       boost::lexical_cast<std::wstring>(device_index_) + L"|" +  format_desc_.name + L"]";\r
        }\r
 };\r
 \r
@@ -302,9 +307,9 @@ public:
        {\r
        }\r
        \r
-       virtual void initialize(const core::video_format_desc& format_desc)\r
+       virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index)\r
        {\r
-               consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_, key_only_));\r
+               consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_, key_only_, channel_index, sub_index));\r
        }\r
        \r
        virtual bool send(const safe_ptr<core::read_frame>& frame)\r
@@ -315,7 +320,7 @@ public:
                \r
        virtual std::wstring print() const\r
        {\r
-               return consumer_ ? consumer_->print() : L"bluefish_consumer";\r
+               return consumer_->print();\r
        }\r
 \r
        size_t buffer_depth() const\r
index bed73e8a9111206b29edb5d9a9463cafd8e1bb47..ae6433e7b91d82ea7dd09bbce796e939cd05c204 100644 (file)
@@ -133,6 +133,8 @@ public:
 struct decklink_consumer : public IDeckLinkVideoOutputCallback, public IDeckLinkAudioOutputCallback, boost::noncopyable\r
 {              \r
        const configuration                                     config_;\r
+       const int                                                       channel_index_;\r
+       const int                                                       sub_index_;\r
 \r
        CComPtr<IDeckLink>                                      decklink_;\r
        CComQIPtr<IDeckLinkOutput>                      output_;\r
@@ -162,8 +164,10 @@ struct decklink_consumer : public IDeckLinkVideoOutputCallback, public IDeckLink
        boost::timer tick_timer_;\r
 \r
 public:\r
-       decklink_consumer(const configuration& config, const core::video_format_desc& format_desc) \r
+       decklink_consumer(const configuration& config, const core::video_format_desc& format_desc, int channel_index, int sub_index\r
                : config_(config)\r
+               , channel_index_(channel_index)\r
+               , sub_index_(sub_index)\r
                , decklink_(get_device(config.device_index))\r
                , output_(decklink_)\r
                , configuration_(decklink_)\r
@@ -411,7 +415,8 @@ public:
        \r
        std::wstring print() const\r
        {\r
-               return model_name_ + L" [" + boost::lexical_cast<std::wstring>(config_.device_index) + L"|" +  format_desc_.name + L"]";\r
+               return model_name_ + L" [" + boost::lexical_cast<std::wstring>(channel_index_) + L"-" + boost::lexical_cast<std::wstring>(sub_index_) + L"|device " +\r
+                       boost::lexical_cast<std::wstring>(config_.device_index) + L"|" +  format_desc_.name + L"]";\r
        }\r
 };\r
 \r
@@ -434,9 +439,9 @@ public:
                CASPAR_LOG(info) << str << L" Successfully Uninitialized.";     \r
        }\r
        \r
-       virtual void initialize(const core::video_format_desc& format_desc)\r
+       virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index)\r
        {\r
-               context_.reset([&]{return new decklink_consumer(config_, format_desc);});               \r
+               context_.reset([&]{return new decklink_consumer(config_, format_desc, channel_index, sub_index);});             \r
                                \r
                CASPAR_LOG(info) << print() << L" Successfully Initialized.";   \r
        }\r
@@ -449,7 +454,7 @@ public:
        \r
        virtual std::wstring print() const\r
        {\r
-               return context_ ? context_->print() : L"decklink_consumer";\r
+               return context_->print();\r
        }                       \r
 \r
        virtual size_t buffer_depth() const\r
index 8fa8fe700319314ca40eb01956b06aae64cf04d1..5b958c44b553a30fa7c26528d497e7ba757e1be8 100644 (file)
@@ -4,7 +4,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Wed Nov 23 21:43:40 2011\r
+/* at Fri Nov 25 19:30:08 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 ff2d77ac118e8a05acd4c148df2559e250df3e42..e808f486936c95b5b93fdca43b9d3001f8b212fe 100644 (file)
@@ -6,7 +6,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Wed Nov 23 21:43:40 2011\r
+/* at Fri Nov 25 19:30:08 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 710af8a72c370d04f6a45bac71ab9db5ef1f54ca..10333d3f171a55b941beaa91ad60784f1f10b2dd 100644 (file)
@@ -45,7 +45,7 @@ struct image_consumer : public core::frame_consumer
        core::video_format_desc                                 format_desc_;\r
 public:\r
 \r
-       virtual void initialize(const core::video_format_desc& format_desc)\r
+       virtual void initialize(const core::video_format_desc& format_desc, int, int)\r
        {\r
                format_desc_ = format_desc;\r
        }\r
index 3acd140f21e17f48a561c332b09127b5f273717b..8fb0706f8302490af5b37410b988e92687a95a39 100644 (file)
@@ -45,6 +45,8 @@ struct oal_consumer : public core::frame_consumer,  public sf::SoundStream
 {\r
        safe_ptr<diagnostics::graph>                                            graph_;\r
        boost::timer                                                                            perf_timer_;\r
+       int                                                                                                     channel_index_;\r
+       int                                                                                                     sub_index_;\r
 \r
        tbb::concurrent_bounded_queue<std::shared_ptr<std::vector<int16_t, tbb::cache_aligned_allocator<int16_t>>>>     input_;\r
        boost::circular_buffer<std::vector<int16_t, tbb::cache_aligned_allocator<int16_t>>>                     container_;\r
@@ -54,6 +56,8 @@ struct oal_consumer : public core::frame_consumer,  public sf::SoundStream
 public:\r
        oal_consumer() \r
                : container_(16)\r
+               , channel_index_(-1)\r
+               , sub_index_(-1)\r
        {\r
                graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
@@ -75,9 +79,11 @@ public:
                CASPAR_LOG(info) << print() << L" Shutting down.";      \r
        }\r
 \r
-       virtual void initialize(const core::video_format_desc& format_desc)\r
+       virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index)\r
        {\r
-               format_desc_ = format_desc;             \r
+               format_desc_    = format_desc;          \r
+               channel_index_  = channel_index;\r
+               sub_index_      = sub_index;\r
                if(Status() != Playing)\r
                {\r
                        sf::SoundStream::Initialize(2, 48000);\r
@@ -110,7 +116,7 @@ public:
 \r
        virtual std::wstring print() const\r
        {\r
-               return L"oal[" + format_desc_.name + L"]";\r
+               return L"oal[" + boost::lexical_cast<std::wstring>(channel_index_) + L"-" + boost::lexical_cast<std::wstring>(sub_index_) + L"|" + format_desc_.name + L"]";\r
        }\r
        \r
        virtual size_t buffer_depth() const\r
index 2a6542afbce3bc8e4552d17c7cac44fa9133c349..8100be09f89bb3cbea637c3a6fd4aeb91ac630c0 100644 (file)
@@ -78,14 +78,16 @@ enum stretch
 \r
 struct configuration\r
 {\r
-       size_t          screen_index;\r
-       stretch         stretch;\r
-       bool            windowed;\r
-       bool            auto_deinterlace;\r
-       bool            key_only;\r
+       std::wstring    name;\r
+       size_t                  screen_index;\r
+       stretch                 stretch;\r
+       bool                    windowed;\r
+       bool                    auto_deinterlace;\r
+       bool                    key_only;\r
 \r
        configuration()\r
-               : screen_index(0)\r
+               : name(L"ogl")\r
+               , screen_index(0)\r
                , stretch(fill)\r
                , windowed(true)\r
                , auto_deinterlace(true)\r
@@ -98,7 +100,9 @@ struct ogl_consumer : boost::noncopyable
 {              \r
        const configuration             config_;\r
        core::video_format_desc format_desc_;\r
-       \r
+       int                                             channel_index_;\r
+       int                                             sub_index_;\r
+\r
        GLuint                                  texture_;\r
        std::vector<GLuint>             pbos_;\r
        \r
@@ -125,9 +129,11 @@ struct ogl_consumer : boost::noncopyable
        \r
        ffmpeg::filter                  filter_;\r
 public:\r
-       ogl_consumer(const configuration& config, const core::video_format_desc& format_desc) \r
+       ogl_consumer(const configuration& config, const core::video_format_desc& format_desc, int channel_index, int sub_index\r
                : config_(config)\r
                , format_desc_(format_desc)\r
+               , channel_index_(channel_index)\r
+               , sub_index_(sub_index)\r
                , texture_(0)\r
                , pbos_(2, 0)   \r
                , screen_width_(format_desc.width)\r
@@ -360,7 +366,7 @@ public:
                \r
        std::wstring print() const\r
        {       \r
-               return  L"ogl[" + boost::lexical_cast<std::wstring>(config_.screen_index) + L"|" + format_desc_.name + L"]";\r
+               return config_.name + L"[" + boost::lexical_cast<std::wstring>(channel_index_) + L"-" + boost::lexical_cast<std::wstring>(sub_index_) + L"|" + format_desc_.name + L"]";\r
        }\r
        \r
        void calculate_aspect()\r
@@ -431,10 +437,10 @@ public:
        ogl_consumer_proxy(const configuration& config)\r
                : config_(config){}\r
        \r
-       virtual void initialize(const core::video_format_desc& format_desc)\r
+       virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index)\r
        {\r
                consumer_.reset();\r
-               consumer_.reset(new ogl_consumer(config_, format_desc));\r
+               consumer_.reset(new ogl_consumer(config_, format_desc, channel_index, sub_index));\r
        }\r
        \r
        virtual bool send(const safe_ptr<core::read_frame>& frame)\r
@@ -480,6 +486,7 @@ safe_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>&
 safe_ptr<core::frame_consumer> create_consumer(const boost::property_tree::ptree& ptree) \r
 {\r
        configuration config;\r
+       config.name                             = widen(ptree.get("name",               narrow(config.name)));\r
        config.screen_index             = ptree.get("device",   config.screen_index+1)-1;\r
        config.windowed                 = ptree.get("windowed", config.windowed);\r
        config.key_only                 = ptree.get("key-only", config.key_only);\r
index 0884567ab60c4c5ff93e02a87ca2745e9aee2bb5..1d389568a10abbb14e5dd6f447e603809d5d3bcf 100644 (file)
@@ -13,7 +13,9 @@
     <channel>\r
       <video-mode>PAL</video-mode>\r
       <consumers>\r
-        <screen></screen>\r
+        <screen>\r
+          <name>My Screen</name>\r
+        </screen>\r
       </consumers>\r
     </channel>\r
   </channels>\r
index c1e91ad9d257720386fbf751bb19b1b64f3a8d27..3b86e2cc97ea62b17ededfba30f4faabb0c9b511 100644 (file)
@@ -114,7 +114,7 @@ struct server::implementation : boost::noncopyable
                        if(format_desc.format == video_format::invalid)\r
                                BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Invalid video-mode."));\r
                        \r
-                       channels_.push_back(make_safe<video_channel>(channels_.size(), format_desc, ogl_));\r
+                       channels_.push_back(make_safe<video_channel>(channels_.size()+1, format_desc, ogl_));\r
                        \r
                        int index = 0;\r
                        BOOST_FOREACH(auto& xml_consumer, xml_channel.second.get_child("consumers"))\r