]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 5 Feb 2012 17:48:24 +0000 (17:48 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 5 Feb 2012 17:48:24 +0000 (17:48 +0000)
core/consumer/frame_consumer.cpp

index 77dddaefd0cb6c0fc5bd0503b7ee785ba75b960e..be21724a9877ce1c35168aa7bb675630bc181538 100644 (file)
@@ -112,53 +112,6 @@ public:
        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
@@ -207,6 +160,53 @@ public:
        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