]> 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>
Fri, 28 Oct 2011 10:17:05 +0000 (10:17 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 28 Oct 2011 10:17:05 +0000 (10:17 +0000)
modules/decklink/decklink.cpp
modules/decklink/decklink.vcxproj
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp

index dd76a653d057b17702f6dbff36070aabdf31b519..94a8ba5561efc4509e51bae01f05296d535b1a01 100644 (file)
@@ -23,7 +23,7 @@
 #include "util/util.h"\r
 \r
 #include "consumer/decklink_consumer.h"\r
-//#include "producer/decklink_producer.h"\r
+#include "producer/decklink_producer.h"\r
 \r
 #include <core/consumer/frame_consumer.h>\r
 #include <core/producer/frame_producer.h>\r
@@ -45,7 +45,7 @@ namespace caspar { namespace decklink {
 void init()\r
 {\r
        core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_consumer(params);});\r
-       //core::register_producer_factory(create_producer);\r
+       core::register_producer_factory(create_producer);\r
 }\r
 \r
 std::wstring get_version() \r
index 67e24980788d5d694b122738d5d9b495ac3a7e13..754dd4ab9ca0556e2e15cc2092b0e57264efdd66 100644 (file)
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">true</ExcludedFromBuild>\r
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
     </ClCompile>\r
     <ClCompile Include="StdAfx.cpp">\r
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">Create</PrecompiledHeader>\r
index 77ccd596f33458dec496245261964dec86be7ae2..c1159201a25f45d957e71eee89dd7273f6224b88 100644 (file)
@@ -26,8 +26,8 @@
 #include "../util/util.h"\r
 \r
 #include "../../ffmpeg/producer/filter/filter.h"\r
-#include "../../ffmpeg/producer/util.h"\r
-#include "../../ffmpeg/producer/frame_muxer.h"\r
+#include "../../ffmpeg/producer/util/util.h"\r
+#include "../../ffmpeg/producer/muxer/frame_muxer.h"\r
 \r
 #include <common/log/log.h>\r
 #include <common/diagnostics/graph.h>\r
@@ -68,6 +68,7 @@ extern "C"
 \r
 #pragma warning(push)\r
 \r
+#include <algorithm>\r
 #include <functional>\r
 \r
 namespace caspar { namespace decklink {\r
@@ -167,6 +168,8 @@ public:
        \r
 class decklink_producer_proxy : public Concurrency::agent, public core::frame_producer\r
 {              \r
+       safe_ptr<diagnostics::graph>                                                                                            graph_;\r
+\r
        Concurrency::unbounded_buffer<ffmpeg::frame_muxer2::video_source_element_t>     video_frames_;\r
        Concurrency::unbounded_buffer<ffmpeg::frame_muxer2::audio_source_element_t>     audio_buffers_;\r
        Concurrency::overwrite_buffer<ffmpeg::frame_muxer2::target_element_t>           muxed_frames_;\r
@@ -181,7 +184,7 @@ class decklink_producer_proxy : public Concurrency::agent, public core::frame_pr
 \r
        mutable Concurrency::single_assignment<std::wstring> print_;\r
        \r
-       volatile bool is_running_;\r
+       tbb::atomic<bool> is_running_;\r
 public:\r
 \r
        explicit decklink_producer_proxy(const safe_ptr<core::frame_factory>& frame_factory, const core::video_format_desc& format_desc, size_t device_index, const std::wstring& filter_str, int64_t length)\r
@@ -191,8 +194,9 @@ public:
                , last_frame_(core::basic_frame::empty())\r
                , length_(length)\r
                , muxer_(&video_frames_, &audio_buffers_, muxed_frames_, format_desc.fps, frame_factory)\r
-               , is_running_(true)\r
        {\r
+               diagnostics::register_graph(graph_);\r
+               is_running_ = true;\r
                agent::start();\r
        }\r
 \r
@@ -208,11 +212,11 @@ public:
 \r
                try\r
                {\r
-                       last_frame_ = frame = Concurrency::receive(muxed_frames_, 10);\r
+                       last_frame_ = frame = Concurrency::receive(muxed_frames_, 10).first;\r
                }\r
                catch(Concurrency::operation_timed_out&)\r
                {               \r
-                       //graph_->add_tag("underflow"); \r
+                       graph_->add_tag("underflow");   \r
                }\r
 \r
                return frame;\r
@@ -309,15 +313,18 @@ safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factor
 {\r
        if(params.empty() || !boost::iequals(params[0], "decklink"))\r
                return core::frame_producer::empty();\r
+       \r
+       std::vector<std::wstring> params2 = params;\r
+       std::for_each(std::begin(params2), std::end(params2), std::bind(&boost::to_upper<std::wstring>, std::placeholders::_1, std::locale()));\r
 \r
-       auto device_index       = core::get_param(L"DEVICE", params, 1);\r
-       auto filter_str         = core::get_param<std::wstring>(L"FILTER", params, L"");        \r
-       auto length                     = core::get_param(L"LENGTH", params, std::numeric_limits<int64_t>::max());      \r
+       auto device_index       = core::get_param(L"DEVICE", params2, 1);\r
+       auto filter_str         = core::get_param<std::wstring>(L"FILTER", params2, L"");       \r
+       auto length                     = core::get_param(L"LENGTH", params2, std::numeric_limits<int64_t>::max());     \r
        \r
        boost::replace_all(filter_str, L"DEINTERLACE", L"YADIF=0:-1");\r
        boost::replace_all(filter_str, L"DEINTERLACE_BOB", L"YADIF=1:-1");\r
 \r
-       auto format_desc        = core::video_format_desc::get(core::get_param<std::wstring>(L"FORMAT", params, L"INVALID"));\r
+       auto format_desc        = core::video_format_desc::get(core::get_param<std::wstring>(L"FORMAT", params2, L"INVALID"));\r
 \r
        if(format_desc.format == core::video_format::invalid)\r
                format_desc = frame_factory->get_video_format_desc();\r
index 2cf11bcff74956538cac85c7ac074f40a9780048..10c474b9b46542d0fca760621d8315de781bcb2e 100644 (file)
@@ -233,11 +233,14 @@ safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factor
        if(ext == extensions.end())\r
                return core::frame_producer::empty();\r
 \r
+       std::vector<std::wstring> params2 = params;\r
+       std::for_each(std::begin(params2), std::end(params2), std::bind(&boost::to_upper<std::wstring>, std::placeholders::_1, std::locale()));\r
+\r
        auto path               = filename + L"." + *ext;\r
-       auto loop               = boost::range::find(params, L"LOOP") != params.end();\r
-       auto start              = core::get_param(L"SEEK", params, 0);\r
-       auto length             = core::get_param(L"LENGTH", params, std::numeric_limits<size_t>::max());\r
-       auto filter_str = core::get_param<std::wstring>(L"FILTER", params, L"");        \r
+       auto loop               = boost::range::find(params2, L"LOOP") != params2.end();\r
+       auto start              = core::get_param(L"SEEK", params2, 0);\r
+       auto length             = core::get_param(L"LENGTH", params2, std::numeric_limits<size_t>::max());\r
+       auto filter_str = core::get_param<std::wstring>(L"FILTER", params2, L"");       \r
                \r
        boost::replace_all(filter_str, L"DEINTERLACE", L"YADIF=0:-1");\r
        boost::replace_all(filter_str, L"DEINTERLACE_BOB", L"YADIF=1:-1");\r