]> git.sesse.net Git - casparcg/blobdiff - modules/decklink/consumer/decklink_consumer.cpp
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
[casparcg] / modules / decklink / consumer / decklink_consumer.cpp
index a68513157bafad1383988aabfd2cc6e08b664be8..e9c4227b1d765410eb93760e3cfdb7ee1cfbcbff 100644 (file)
@@ -43,7 +43,7 @@
 #include <boost/circular_buffer.hpp>\r
 #include <boost/timer.hpp>\r
 \r
-namespace caspar { \r
+namespace caspar { namespace decklink { \r
        \r
 struct configuration\r
 {\r
@@ -101,7 +101,7 @@ public:
         \r
     STDMETHOD(GetBytes(void** buffer))\r
        {\r
-               static std::vector<uint8_t> zeros(1920*1080*4, 0);\r
+               static std::vector<uint8_t, tbb::cache_aligned_allocator<uint8_t>> zeros(1920*1080*4, 0);\r
                if(static_cast<size_t>(frame_->image_data().size()) != format_desc_.size)\r
                {\r
                        *buffer = zeros.data();\r
@@ -151,12 +151,12 @@ struct decklink_consumer : public IDeckLinkVideoOutputCallback, public IDeckLink
 \r
        size_t                                                          preroll_count_;\r
                \r
-       boost::circular_buffer<std::vector<int16_t>>    audio_container_;\r
+       boost::circular_buffer<std::vector<int32_t>>    audio_container_;\r
 \r
        tbb::concurrent_bounded_queue<std::shared_ptr<core::read_frame>> video_frame_buffer_;\r
        tbb::concurrent_bounded_queue<std::shared_ptr<core::read_frame>> audio_frame_buffer_;\r
        \r
-       std::shared_ptr<diagnostics::graph> graph_;\r
+       safe_ptr<diagnostics::graph> graph_;\r
        boost::timer tick_timer_;\r
 \r
 public:\r
@@ -179,12 +179,13 @@ public:
                video_frame_buffer_.set_capacity(1);\r
                audio_frame_buffer_.set_capacity(1);\r
 \r
-               graph_ = diagnostics::create_graph(narrow(print()));\r
                graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.3f));\r
                graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f));\r
                graph_->set_color("flushed-frame", diagnostics::color(0.4f, 0.3f, 0.8f));\r
+               graph_->set_text(print());\r
+               diagnostics::register_graph(graph_);\r
                \r
                enable_video(get_display_mode(output_, format_desc_.format, bmdFormat8BitBGRA, bmdVideoOutputFlagDefault));\r
                                \r
@@ -262,7 +263,7 @@ public:
        \r
        void enable_audio()\r
        {\r
-               if(FAILED(output_->EnableAudioOutput(bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, 2, bmdAudioOutputStreamTimestamped)))\r
+               if(FAILED(output_->EnableAudioOutput(bmdAudioSampleRate48kHz, bmdAudioSampleType32bitInteger, 2, bmdAudioOutputStreamTimestamped)))\r
                                BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Could not enable audio output."));\r
                                \r
                if(FAILED(output_->SetAudioCallback(this)))\r
@@ -319,7 +320,7 @@ public:
 \r
                        std::shared_ptr<core::read_frame> frame;        \r
                        video_frame_buffer_.pop(frame);                                 \r
-                       schedule_next_video(make_safe(frame));  \r
+                       schedule_next_video(make_safe_ptr(frame));      \r
                }\r
                catch(...)\r
                {\r
@@ -352,7 +353,7 @@ public:
                        {\r
                                std::shared_ptr<core::read_frame> frame;\r
                                audio_frame_buffer_.pop(frame);\r
-                               schedule_next_audio(make_safe(frame));  \r
+                               schedule_next_audio(make_safe_ptr(frame));      \r
                        }\r
                }\r
                catch(...)\r
@@ -369,7 +370,7 @@ public:
        {\r
                const int sample_frame_count = frame->audio_data().size()/format_desc_.audio_channels;\r
 \r
-               audio_container_.push_back(std::vector<int16_t>(frame->audio_data().begin(), frame->audio_data().end()));\r
+               audio_container_.push_back(std::vector<int32_t>(frame->audio_data().begin(), frame->audio_data().end()));\r
 \r
                if(FAILED(output_->ScheduleAudioSamples(audio_container_.back().data(), sample_frame_count, (audio_scheduled_++) * sample_frame_count, format_desc_.audio_sample_rate, nullptr)))\r
                        CASPAR_LOG(error) << print() << L" Failed to schedule audio.";\r
@@ -452,7 +453,7 @@ public:
        }\r
 };     \r
 \r
-safe_ptr<core::frame_consumer> create_decklink_consumer(const std::vector<std::wstring>& params) \r
+safe_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>& params) \r
 {\r
        if(params.size() < 1 || params[0] != L"DECKLINK")\r
                return core::frame_consumer::empty();\r
@@ -470,7 +471,7 @@ safe_ptr<core::frame_consumer> create_decklink_consumer(const std::vector<std::w
        return make_safe<decklink_consumer_proxy>(config);\r
 }\r
 \r
-safe_ptr<core::frame_consumer> create_decklink_consumer(const boost::property_tree::ptree& ptree) \r
+safe_ptr<core::frame_consumer> create_consumer(const boost::property_tree::ptree& ptree) \r
 {\r
        configuration config;\r
 \r
@@ -483,7 +484,7 @@ safe_ptr<core::frame_consumer> create_decklink_consumer(const boost::property_tr
        return make_safe<decklink_consumer_proxy>(config);\r
 }\r
 \r
-}\r
+}}\r
 \r
 /*\r
 ##############################################################################\r