]> 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, 8 May 2011 19:55:18 +0000 (19:55 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 8 May 2011 19:55:18 +0000 (19:55 +0000)
modules/bluefish/consumer/bluefish_consumer.cpp
modules/flash/flash.cpp
modules/flash/producer/flash_producer.cpp

index 676540e925242db5fc765d6e01338d309b4bc555..68418770229a73cc561c24c7b15c9ff5c5fe8c82 100644 (file)
@@ -90,7 +90,7 @@ struct bluefish_consumer : boost::noncopyable
        std::shared_ptr<diagnostics::graph> graph_;\r
        boost::timer perf_timer_;\r
 \r
-       tbb::concurrent_bounded_queue<std::shared_ptr<const core::read_frame>> frame_buffer_;\r
+       boost::unique_future<void> active_;\r
                        \r
        std::shared_ptr<CBlueVelvet4> blue_;\r
        \r
@@ -106,7 +106,6 @@ struct bluefish_consumer : boost::noncopyable
 \r
        const bool embedded_audio_;\r
 \r
-       tbb::atomic<bool> is_running_;\r
        executor executor_;\r
 public:\r
        bluefish_consumer(const core::video_format_desc& format_desc, unsigned int device_index, bool embedded_audio) \r
@@ -121,9 +120,6 @@ public:
                , embedded_audio_(embedded_audio)\r
                , executor_(print(), true)\r
        {\r
-               is_running_ = true;\r
-               frame_buffer_.set_capacity(1);\r
-\r
                if(!BlueVelvetFactory4 || (embedded_audio_ && (!encode_hanc_frame || !encode_hanc_frame)))\r
                        BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Bluefish drivers not found."));\r
                \r
@@ -224,14 +220,14 @@ public:
                                                \r
                for(size_t n = 0; n < reserved_frames_.size(); ++n)\r
                        reserved_frames_[n] = std::make_shared<blue_dma_buffer>(format_desc_.size, n);          \r
+\r
+               active_ = executor_.begin_invoke([]{});\r
                                \r
                CASPAR_LOG(info) << print() << TEXT(" Successfully initialized for ") << format_desc_ << TEXT(".");\r
        }\r
 \r
        ~bluefish_consumer()\r
        {\r
-               is_running_ = false;\r
-               frame_buffer_.clear();\r
                executor_.clear();\r
                executor_.invoke([&]\r
                {\r
@@ -256,24 +252,18 @@ public:
                        CASPAR_LOG(error)<< print() << TEXT(" Failed to disable video output.");                \r
        }\r
 \r
-       virtual void send(const safe_ptr<const core::read_frame>& frame)\r
+       void send(const safe_ptr<const core::read_frame>& frame)\r
        {                       \r
                static std::vector<short> silence(MAX_HANC_BUFFER_SIZE, 0);\r
                                \r
-               if(!is_running_)\r
-                       return;\r
-\r
-               frame_buffer_.push(frame);\r
-               executor_.begin_invoke([this]\r
+               active_.get();\r
+               active_ = executor_.begin_invoke([=]\r
                {\r
                        try\r
                        {\r
                                const size_t audio_samples = static_cast<size_t>(48000.0 / format_desc_.fps);\r
                                const size_t audio_nchannels = 2;\r
-\r
-                               std::shared_ptr<const core::read_frame> frame;\r
-                               frame_buffer_.pop(frame);\r
-\r
+                               \r
                                fast_memcpy(reserved_frames_.front()->image_data(), frame->image_data().begin(), frame->image_data().size());\r
                                \r
                                if(embedded_audio_)\r
@@ -320,8 +310,6 @@ public:
                });\r
        }\r
 \r
-       virtual size_t buffer_depth() const{return 1;}\r
-\r
        void encode_hanc(BLUE_UINT32* hanc_data, void* audio_data, size_t audio_samples, size_t audio_nchannels)\r
        {       \r
                auto card_type = blue_->has_video_cardtype();\r
@@ -362,17 +350,17 @@ public:
                : device_index_(device_index)\r
                , embedded_audio_(embedded_audio){}\r
        \r
-       void initialize(const core::video_format_desc& format_desc)\r
+       virtual void initialize(const core::video_format_desc& format_desc)\r
        {\r
                consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_));\r
        }\r
        \r
-       void send(const safe_ptr<const core::read_frame>& frame)\r
+       virtual void send(const safe_ptr<const core::read_frame>& frame)\r
        {\r
                consumer_->send(frame);\r
        }\r
        \r
-       std::wstring print() const\r
+       virtual std::wstring print() const\r
        {\r
                return consumer_->print();\r
        }\r
index bfd8d7e97cb92d9870a2a8b6a2b5910acfd6c27b..b103e4e61c0913fc0c6a8de8a2b35da60f4151df 100644 (file)
@@ -23,7 +23,6 @@
 \r
 #include "producer/cg_producer.h"\r
 #include "producer/flash_producer.h"\r
-#include "producer/flash_producer.h"\r
 \r
 #include <common/env.h>\r
 \r
index 3fe4ce3d558737888d4b58461d4ce2a58f2b0c8a..1992a559549364cfcb6276e4e9aa5f5204675cd4 100644 (file)
@@ -239,7 +239,7 @@ public:
        {       \r
                context_.begin_invoke([=]\r
                {\r
-                       if(!context_.get())\r
+                       if(!context_)\r
                                initialize();\r
 \r
                        try\r