virtual int index() const override {return consumer_->index();}\r
};\r
\r
-// This class is used to guarantee that audio cadence is correct. This is important for NTSC audio.\r
-class cadence_guard : public frame_consumer\r
-{\r
- spl::shared_ptr<frame_consumer> consumer_;\r
- std::vector<int> audio_cadence_;\r
- boost::circular_buffer<int> sync_buffer_;\r
-public:\r
- cadence_guard(const spl::shared_ptr<frame_consumer>& consumer)\r
- : consumer_(consumer)\r
- {\r
- }\r
- \r
- virtual void initialize(const video_format_desc& format_desc, int channel_index) override\r
- {\r
- audio_cadence_ = format_desc.audio_cadence;\r
- sync_buffer_ = boost::circular_buffer<int>(format_desc.audio_cadence.size());\r
- consumer_->initialize(format_desc, channel_index);\r
- }\r
-\r
- virtual bool send(const spl::shared_ptr<const data_frame>& frame) override\r
- { \r
- if(audio_cadence_.size() == 1)\r
- return consumer_->send(frame);\r
-\r
- bool result = true;\r
- \r
- if(boost::range::equal(sync_buffer_, audio_cadence_) && audio_cadence_.front() == static_cast<int>(frame->audio_data().size())) \r
- { \r
- // Audio sent so far is in sync, now we can send the next chunk.\r
- result = consumer_->send(frame);\r
- boost::range::rotate(audio_cadence_, std::begin(audio_cadence_)+1);\r
- }\r
- else\r
- CASPAR_LOG(trace) << print() << L" Syncing audio.";\r
-\r
- sync_buffer_.push_back(static_cast<int>(frame->audio_data().size()));\r
- \r
- return result;\r
- }\r
- \r
- virtual std::wstring print() const override {return consumer_->print();}\r
- virtual boost::property_tree::wptree info() const override {return consumer_->info();}\r
- virtual bool has_synchronization_clock() const override {return consumer_->has_synchronization_clock();}\r
- virtual int buffer_depth() const override {return consumer_->buffer_depth();}\r
- virtual int index() const override {return consumer_->index();}\r
-};\r
-\r
class recover_consumer_proxy : public frame_consumer\r
{ \r
std::shared_ptr<frame_consumer> consumer_;\r
virtual int index() const override {return consumer_->index();}\r
};\r
\r
+// This class is used to guarantee that audio cadence is correct. This is important for NTSC audio.\r
+class cadence_guard : public frame_consumer\r
+{\r
+ spl::shared_ptr<frame_consumer> consumer_;\r
+ std::vector<int> audio_cadence_;\r
+ boost::circular_buffer<int> sync_buffer_;\r
+public:\r
+ cadence_guard(const spl::shared_ptr<frame_consumer>& consumer)\r
+ : consumer_(consumer)\r
+ {\r
+ }\r
+ \r
+ virtual void initialize(const video_format_desc& format_desc, int channel_index) override\r
+ {\r
+ audio_cadence_ = format_desc.audio_cadence;\r
+ sync_buffer_ = boost::circular_buffer<int>(format_desc.audio_cadence.size());\r
+ consumer_->initialize(format_desc, channel_index);\r
+ }\r
+\r
+ virtual bool send(const spl::shared_ptr<const data_frame>& frame) override\r
+ { \r
+ if(audio_cadence_.size() == 1)\r
+ return consumer_->send(frame);\r
+\r
+ bool result = true;\r
+ \r
+ if(boost::range::equal(sync_buffer_, audio_cadence_) && audio_cadence_.front() == static_cast<int>(frame->audio_data().size())) \r
+ { \r
+ // Audio sent so far is in sync, now we can send the next chunk.\r
+ result = consumer_->send(frame);\r
+ boost::range::rotate(audio_cadence_, std::begin(audio_cadence_)+1);\r
+ }\r
+ else\r
+ CASPAR_LOG(trace) << print() << L" Syncing audio.";\r
+\r
+ sync_buffer_.push_back(static_cast<int>(frame->audio_data().size()));\r
+ \r
+ return result;\r
+ }\r
+ \r
+ virtual std::wstring print() const override {return consumer_->print();}\r
+ virtual boost::property_tree::wptree info() const override {return consumer_->info();}\r
+ virtual bool has_synchronization_clock() const override {return consumer_->has_synchronization_clock();}\r
+ virtual int buffer_depth() const override {return consumer_->buffer_depth();}\r
+ virtual int index() const override {return consumer_->index();}\r
+};\r
+\r
spl::shared_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>& params)\r
{\r
if(params.empty())\r