From: ronag Date: Fri, 25 Nov 2011 23:22:22 +0000 (+0000) Subject: 2.0.2: - Send index information to consumers. X-Git-Tag: 2.0.2~123 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=0eba5506e33ad7298f70cae43f57384ccc6a3787;p=casparcg 2.0.2: - Send index information to consumers. - 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 --- diff --git a/core/consumer/frame_consumer.h b/core/consumer/frame_consumer.h index e1880102f..2fde6f778 100644 --- a/core/consumer/frame_consumer.h +++ b/core/consumer/frame_consumer.h @@ -39,7 +39,7 @@ struct frame_consumer : boost::noncopyable virtual ~frame_consumer() {} virtual bool send(const safe_ptr& frame) = 0; - virtual void initialize(const video_format_desc& format_desc) = 0; + virtual void initialize(const video_format_desc& format_desc, int channel_index, int sub_index) = 0; virtual std::wstring print() const = 0; virtual bool has_synchronization_clock() const {return true;} virtual size_t buffer_depth() const = 0; @@ -50,7 +50,7 @@ struct frame_consumer : boost::noncopyable { core::video_format_desc format_desc; virtual bool send(const safe_ptr&){return false;} - virtual void initialize(const video_format_desc&){} + virtual void initialize(const video_format_desc&, int, int){} virtual std::wstring print() const {return L"empty";} virtual bool has_synchronization_clock() const {return false;} virtual size_t buffer_depth() const {return 0;}; diff --git a/core/consumer/output.cpp b/core/consumer/output.cpp index 96b4c80ee..2b488cf16 100644 --- a/core/consumer/output.cpp +++ b/core/consumer/output.cpp @@ -45,6 +45,7 @@ struct output::implementation { typedef std::pair, safe_ptr> fill_and_key; + const int channel_index_; safe_ptr graph_; boost::timer consume_timer_; @@ -62,8 +63,9 @@ struct output::implementation executor executor_; public: - implementation(const safe_ptr& graph, const video_format_desc& format_desc) - : graph_(graph) + implementation(const safe_ptr& graph, const video_format_desc& format_desc, int channel_index) + : channel_index_(channel_index) + , graph_(graph) , format_desc_(format_desc) , executor_(L"output") { @@ -77,7 +79,7 @@ public: consumers_.erase(index); }); - consumer->initialize(format_desc_); + consumer->initialize(format_desc_, channel_index_, index); executor_.invoke([&] { @@ -111,7 +113,7 @@ public: { try { - it->second->initialize(format_desc_); + it->second->initialize(format_desc_, channel_index_, it->first); ++it; } catch(...) @@ -185,7 +187,7 @@ public: CASPAR_LOG_CURRENT_EXCEPTION(); try { - consumer->initialize(format_desc_); + consumer->initialize(format_desc_, channel_index_, it->first); if(consumer->send(frame)) ++it; else @@ -225,7 +227,7 @@ private: } }; -output::output(const safe_ptr& graph, const video_format_desc& format_desc) : impl_(new implementation(graph, format_desc)){} +output::output(const safe_ptr& graph, const video_format_desc& format_desc, int channel_index) : impl_(new implementation(graph, format_desc, channel_index)){} void output::add(int index, safe_ptr&& consumer){impl_->add(index, std::move(consumer));} void output::remove(int index){impl_->remove(index);} void output::send(const std::pair, ticket>& frame) {impl_->send(frame); } diff --git a/core/consumer/output.h b/core/consumer/output.h index e5d14bf0f..25dd2212f 100644 --- a/core/consumer/output.h +++ b/core/consumer/output.h @@ -33,7 +33,7 @@ namespace caspar { namespace core { class output : public target, ticket>>, boost::noncopyable { public: - explicit output(const safe_ptr& graph, const video_format_desc& format_desc); + explicit output(const safe_ptr& graph, const video_format_desc& format_desc, int channel_index); void add(int index, safe_ptr&& consumer); void remove(int index); diff --git a/core/video_channel.cpp b/core/video_channel.cpp index 2cfe4048d..d5d2ecd81 100644 --- a/core/video_channel.cpp +++ b/core/video_channel.cpp @@ -51,7 +51,7 @@ public: : index_(index) , format_desc_(format_desc) , ogl_(ogl) - , output_(new caspar::core::output(graph_, format_desc)) + , output_(new caspar::core::output(graph_, format_desc, index)) , mixer_(new caspar::core::mixer(graph_, output_, format_desc, ogl)) , stage_(new caspar::core::stage(graph_, mixer_, format_desc)) { @@ -80,7 +80,7 @@ public: std::wstring print() const { - return L"video_channel[" + boost::lexical_cast(index_+1) + L"|" + format_desc_.name + L"]"; + return L"video_channel[" + boost::lexical_cast(index_) + L"|" + format_desc_.name + L"]"; } }; diff --git a/modules/bluefish/consumer/bluefish_consumer.cpp b/modules/bluefish/consumer/bluefish_consumer.cpp index f1a5275b7..2d7cd200f 100644 --- a/modules/bluefish/consumer/bluefish_consumer.cpp +++ b/modules/bluefish/consumer/bluefish_consumer.cpp @@ -50,6 +50,8 @@ struct bluefish_consumer : boost::noncopyable safe_ptr blue_; const unsigned int device_index_; const core::video_format_desc format_desc_; + const int channel_index_; + const int sub_index_; const std::wstring model_name_; @@ -68,10 +70,12 @@ struct bluefish_consumer : boost::noncopyable executor executor_; public: - bluefish_consumer(const core::video_format_desc& format_desc, unsigned int device_index, bool embedded_audio, bool key_only) + 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) : blue_(create_blue(device_index)) , device_index_(device_index) , format_desc_(format_desc) + , channel_index_(channel_index) + , sub_index_(sub_index) , model_name_(get_card_desc(*blue_)) , vid_fmt_(get_video_mode(*blue_, format_desc)) , embedded_audio_(embedded_audio) @@ -283,7 +287,8 @@ public: std::wstring print() const { - return model_name_ + L" [" + boost::lexical_cast(device_index_) + L"|" + format_desc_.name + L"]"; + return model_name_ + L" [" + boost::lexical_cast(channel_index_) + L"-" + boost::lexical_cast(sub_index_) + L"|device " + + boost::lexical_cast(device_index_) + L"|" + format_desc_.name + L"]"; } }; @@ -302,9 +307,9 @@ public: { } - virtual void initialize(const core::video_format_desc& format_desc) + virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index) { - consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_, key_only_)); + consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_, key_only_, channel_index, sub_index)); } virtual bool send(const safe_ptr& frame) @@ -315,7 +320,7 @@ public: virtual std::wstring print() const { - return consumer_ ? consumer_->print() : L"bluefish_consumer"; + return consumer_->print(); } size_t buffer_depth() const diff --git a/modules/decklink/consumer/decklink_consumer.cpp b/modules/decklink/consumer/decklink_consumer.cpp index bed73e8a9..ae6433e7b 100644 --- a/modules/decklink/consumer/decklink_consumer.cpp +++ b/modules/decklink/consumer/decklink_consumer.cpp @@ -133,6 +133,8 @@ public: struct decklink_consumer : public IDeckLinkVideoOutputCallback, public IDeckLinkAudioOutputCallback, boost::noncopyable { const configuration config_; + const int channel_index_; + const int sub_index_; CComPtr decklink_; CComQIPtr output_; @@ -162,8 +164,10 @@ struct decklink_consumer : public IDeckLinkVideoOutputCallback, public IDeckLink boost::timer tick_timer_; public: - decklink_consumer(const configuration& config, const core::video_format_desc& format_desc) + decklink_consumer(const configuration& config, const core::video_format_desc& format_desc, int channel_index, int sub_index) : config_(config) + , channel_index_(channel_index) + , sub_index_(sub_index) , decklink_(get_device(config.device_index)) , output_(decklink_) , configuration_(decklink_) @@ -411,7 +415,8 @@ public: std::wstring print() const { - return model_name_ + L" [" + boost::lexical_cast(config_.device_index) + L"|" + format_desc_.name + L"]"; + return model_name_ + L" [" + boost::lexical_cast(channel_index_) + L"-" + boost::lexical_cast(sub_index_) + L"|device " + + boost::lexical_cast(config_.device_index) + L"|" + format_desc_.name + L"]"; } }; @@ -434,9 +439,9 @@ public: CASPAR_LOG(info) << str << L" Successfully Uninitialized."; } - virtual void initialize(const core::video_format_desc& format_desc) + virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index) { - context_.reset([&]{return new decklink_consumer(config_, format_desc);}); + context_.reset([&]{return new decklink_consumer(config_, format_desc, channel_index, sub_index);}); CASPAR_LOG(info) << print() << L" Successfully Initialized."; } @@ -449,7 +454,7 @@ public: virtual std::wstring print() const { - return context_ ? context_->print() : L"decklink_consumer"; + return context_->print(); } virtual size_t buffer_depth() const diff --git a/modules/decklink/interop/DeckLinkAPI_h.h b/modules/decklink/interop/DeckLinkAPI_h.h index 8fa8fe700..5b958c44b 100644 --- a/modules/decklink/interop/DeckLinkAPI_h.h +++ b/modules/decklink/interop/DeckLinkAPI_h.h @@ -4,7 +4,7 @@ /* File created by MIDL compiler version 7.00.0555 */ -/* at Wed Nov 23 21:43:40 2011 +/* at Fri Nov 25 19:30:08 2011 */ /* Compiler settings for interop\DeckLinkAPI.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 diff --git a/modules/decklink/interop/DeckLinkAPI_i.c b/modules/decklink/interop/DeckLinkAPI_i.c index ff2d77ac1..e808f4869 100644 --- a/modules/decklink/interop/DeckLinkAPI_i.c +++ b/modules/decklink/interop/DeckLinkAPI_i.c @@ -6,7 +6,7 @@ /* File created by MIDL compiler version 7.00.0555 */ -/* at Wed Nov 23 21:43:40 2011 +/* at Fri Nov 25 19:30:08 2011 */ /* Compiler settings for interop\DeckLinkAPI.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 diff --git a/modules/image/consumer/image_consumer.cpp b/modules/image/consumer/image_consumer.cpp index 710af8a72..10333d3f1 100644 --- a/modules/image/consumer/image_consumer.cpp +++ b/modules/image/consumer/image_consumer.cpp @@ -45,7 +45,7 @@ struct image_consumer : public core::frame_consumer core::video_format_desc format_desc_; public: - virtual void initialize(const core::video_format_desc& format_desc) + virtual void initialize(const core::video_format_desc& format_desc, int, int) { format_desc_ = format_desc; } diff --git a/modules/oal/consumer/oal_consumer.cpp b/modules/oal/consumer/oal_consumer.cpp index 3acd140f2..8fb0706f8 100644 --- a/modules/oal/consumer/oal_consumer.cpp +++ b/modules/oal/consumer/oal_consumer.cpp @@ -45,6 +45,8 @@ struct oal_consumer : public core::frame_consumer, public sf::SoundStream { safe_ptr graph_; boost::timer perf_timer_; + int channel_index_; + int sub_index_; tbb::concurrent_bounded_queue>>> input_; boost::circular_buffer>> container_; @@ -54,6 +56,8 @@ struct oal_consumer : public core::frame_consumer, public sf::SoundStream public: oal_consumer() : container_(16) + , channel_index_(-1) + , sub_index_(-1) { graph_->add_guide("tick-time", 0.5); graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f)); @@ -75,9 +79,11 @@ public: CASPAR_LOG(info) << print() << L" Shutting down."; } - virtual void initialize(const core::video_format_desc& format_desc) + virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index) { - format_desc_ = format_desc; + format_desc_ = format_desc; + channel_index_ = channel_index; + sub_index_ = sub_index; if(Status() != Playing) { sf::SoundStream::Initialize(2, 48000); @@ -110,7 +116,7 @@ public: virtual std::wstring print() const { - return L"oal[" + format_desc_.name + L"]"; + return L"oal[" + boost::lexical_cast(channel_index_) + L"-" + boost::lexical_cast(sub_index_) + L"|" + format_desc_.name + L"]"; } virtual size_t buffer_depth() const diff --git a/modules/ogl/consumer/ogl_consumer.cpp b/modules/ogl/consumer/ogl_consumer.cpp index 2a6542afb..8100be09f 100644 --- a/modules/ogl/consumer/ogl_consumer.cpp +++ b/modules/ogl/consumer/ogl_consumer.cpp @@ -78,14 +78,16 @@ enum stretch struct configuration { - size_t screen_index; - stretch stretch; - bool windowed; - bool auto_deinterlace; - bool key_only; + std::wstring name; + size_t screen_index; + stretch stretch; + bool windowed; + bool auto_deinterlace; + bool key_only; configuration() - : screen_index(0) + : name(L"ogl") + , screen_index(0) , stretch(fill) , windowed(true) , auto_deinterlace(true) @@ -98,7 +100,9 @@ struct ogl_consumer : boost::noncopyable { const configuration config_; core::video_format_desc format_desc_; - + int channel_index_; + int sub_index_; + GLuint texture_; std::vector pbos_; @@ -125,9 +129,11 @@ struct ogl_consumer : boost::noncopyable ffmpeg::filter filter_; public: - ogl_consumer(const configuration& config, const core::video_format_desc& format_desc) + ogl_consumer(const configuration& config, const core::video_format_desc& format_desc, int channel_index, int sub_index) : config_(config) , format_desc_(format_desc) + , channel_index_(channel_index) + , sub_index_(sub_index) , texture_(0) , pbos_(2, 0) , screen_width_(format_desc.width) @@ -360,7 +366,7 @@ public: std::wstring print() const { - return L"ogl[" + boost::lexical_cast(config_.screen_index) + L"|" + format_desc_.name + L"]"; + return config_.name + L"[" + boost::lexical_cast(channel_index_) + L"-" + boost::lexical_cast(sub_index_) + L"|" + format_desc_.name + L"]"; } void calculate_aspect() @@ -431,10 +437,10 @@ public: ogl_consumer_proxy(const configuration& config) : config_(config){} - virtual void initialize(const core::video_format_desc& format_desc) + virtual void initialize(const core::video_format_desc& format_desc, int channel_index, int sub_index) { consumer_.reset(); - consumer_.reset(new ogl_consumer(config_, format_desc)); + consumer_.reset(new ogl_consumer(config_, format_desc, channel_index, sub_index)); } virtual bool send(const safe_ptr& frame) @@ -480,6 +486,7 @@ safe_ptr create_consumer(const std::vector& safe_ptr create_consumer(const boost::property_tree::ptree& ptree) { configuration config; + config.name = widen(ptree.get("name", narrow(config.name))); config.screen_index = ptree.get("device", config.screen_index+1)-1; config.windowed = ptree.get("windowed", config.windowed); config.key_only = ptree.get("key-only", config.key_only); diff --git a/shell/casparcg.config b/shell/casparcg.config index 0884567ab..1d389568a 100644 --- a/shell/casparcg.config +++ b/shell/casparcg.config @@ -13,7 +13,9 @@ PAL - + + My Screen + diff --git a/shell/server.cpp b/shell/server.cpp index c1e91ad9d..3b86e2cc9 100644 --- a/shell/server.cpp +++ b/shell/server.cpp @@ -114,7 +114,7 @@ struct server::implementation : boost::noncopyable if(format_desc.format == video_format::invalid) BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Invalid video-mode.")); - channels_.push_back(make_safe(channels_.size(), format_desc, ogl_)); + channels_.push_back(make_safe(channels_.size()+1, format_desc, ogl_)); int index = 0; BOOST_FOREACH(auto& xml_consumer, xml_channel.second.get_child("consumers"))