]> git.sesse.net Git - casparcg/commitdiff
2.1.0: -frame_producer: Made "wrap_producer" calls unnecessary and removed them.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 16 Feb 2012 15:08:51 +0000 (15:08 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 16 Feb 2012 15:08:51 +0000 (15:08 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2432 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

13 files changed:
core/producer/color/color_producer.cpp
core/producer/frame_producer.cpp
core/producer/frame_producer.h
core/producer/separated/separated_producer.cpp
core/producer/stage.cpp
core/producer/transition/transition_producer.cpp
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/flash/producer/cg_proxy.cpp
modules/flash/producer/flash_producer.cpp
modules/image/producer/image_producer.cpp
modules/image/producer/image_scroll_producer.cpp
shell/casparcg.config

index 4f3db08baaa480fc7905f2f047a0b62e26ac47d6..bb12fb44fb529e14a9f27d5537ec63a36f653427 100644 (file)
@@ -46,7 +46,9 @@ public:
        explicit color_producer(const spl::shared_ptr<core::frame_factory>& frame_factory, const std::wstring& color) \r
                : color_str_(color)\r
                , frame_(create_color_frame(this, frame_factory, color))\r
-       {}\r
+       {\r
+               CASPAR_LOG(info) << print() << L" Initialized";\r
+       }\r
 \r
        // frame_producer\r
                        \r
@@ -129,7 +131,7 @@ spl::shared_ptr<frame_producer> create_color_producer(const spl::shared_ptr<fram
        if(color2.length() != 9 || color2[0] != '#')\r
                return core::frame_producer::empty();\r
 \r
-       return core::wrap_producer(spl::make_shared<color_producer>(frame_factory, color2));\r
+       return spl::make_shared<color_producer>(frame_factory, color2);\r
 }\r
 \r
 draw_frame create_color_frame(void* tag, const spl::shared_ptr<frame_factory>& frame_factory, const std::wstring& color)\r
index dd6ec1ec5acf504ff11690889d2e6bc1709f68c5..fb85851a9bb92f742910d3bbffce9ca160942cfa 100644 (file)
@@ -76,20 +76,22 @@ const spl::shared_ptr<frame_producer>& frame_producer::empty()
        return producer;\r
 }      \r
 \r
-class producer_proxy : public frame_producer\r
+class destroy_producer_proxy : public frame_producer\r
 {      \r
        std::shared_ptr<frame_producer> producer_;\r
 public:\r
-       producer_proxy(spl::shared_ptr<frame_producer>&& producer) \r
+       destroy_producer_proxy(spl::shared_ptr<frame_producer>&& producer) \r
                : producer_(std::move(producer))\r
        {\r
-               CASPAR_LOG(info) << producer_->print() << L" Initialized.";\r
        }\r
 \r
-       virtual ~producer_proxy()\r
+       virtual ~destroy_producer_proxy()\r
        {               \r
                static tbb::atomic<int> counter = tbb::atomic<int>();\r
                \r
+               if(producer_ == core::frame_producer::empty())\r
+                       return;\r
+\r
                ++counter;\r
                CASPAR_VERIFY(counter < 32);\r
                \r
@@ -107,9 +109,8 @@ public:
                        }\r
                        catch(...){}\r
                        \r
-                       CASPAR_LOG(trace) << str << L" Uninitializing.";\r
                        pointer_guard.reset();\r
-                       CASPAR_LOG(info) << str << L" Uninitialized.";\r
+                       CASPAR_LOG(info) << str << L" Destroyed.";\r
 \r
                        --counter;\r
                }); \r
@@ -127,9 +128,9 @@ public:
        virtual void unsubscribe(const monitor::observable::observer_ptr& o)                                                                                                                                            {return producer_->unsubscribe(o);}\r
 };\r
 \r
-spl::shared_ptr<core::frame_producer> wrap_producer(spl::shared_ptr<core::frame_producer> producer)\r
+spl::shared_ptr<core::frame_producer> create_destroy_proxy(spl::shared_ptr<core::frame_producer> producer)\r
 {\r
-       return spl::make_shared<producer_proxy>(std::move(producer));\r
+       return spl::make_shared<destroy_producer_proxy>(std::move(producer));\r
 }\r
 \r
 spl::shared_ptr<core::frame_producer> do_create_producer(const spl::shared_ptr<frame_factory>& my_frame_factory, const std::vector<std::wstring>& params)\r
index 2afdd578d81a9ceb0f3ddcc0ccb2e2ed3f49b7c5..adcafcb7f92a46e764c4d74949088b7d5d36d139 100644 (file)
@@ -94,6 +94,6 @@ void register_producer_factory(const producer_factory_t& factory); // Not thread
 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<frame_factory>&, const std::vector<std::wstring>& params);\r
 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<frame_factory>&, const std::wstring& params);\r
 \r
-spl::shared_ptr<core::frame_producer> wrap_producer(spl::shared_ptr<core::frame_producer> producer);\r
+spl::shared_ptr<core::frame_producer> create_destroy_proxy(spl::shared_ptr<core::frame_producer> producer);\r
                \r
 }}\r
index 0806998e5a5229f7bdad6498853a9329ff672e0f..913b47af8f5b2ff4f8b14677ef18872d802d5aba 100644 (file)
@@ -46,6 +46,7 @@ public:
                , key_(core::draw_frame::late())\r
                , last_frame_(core::draw_frame::empty())\r
        {\r
+               CASPAR_LOG(info) << print() << L" Initialized";\r
        }\r
 \r
        // frame_producer\r
@@ -119,7 +120,7 @@ public:
 \r
 spl::shared_ptr<frame_producer> create_separated_producer(const spl::shared_ptr<frame_producer>& fill, const spl::shared_ptr<frame_producer>& key)\r
 {\r
-       return core::wrap_producer(spl::make_shared<separated_producer>(fill, key));\r
+       return spl::make_shared<separated_producer>(fill, key);\r
 }\r
 \r
 }}\r
index 03618ad40cea6213f6d16be23ca17a389c880c81..044fab27da845b6db58cfd4bf9a7f81a4e171d42 100644 (file)
@@ -181,7 +181,7 @@ public:
        {\r
                executor_.begin_invoke([=]\r
                {\r
-                       get_layer(index).load(producer, auto_play_delta);\r
+                       get_layer(index).load(create_destroy_proxy(producer), auto_play_delta);                 \r
                }, task_priority::high_priority);\r
        }\r
 \r
index e35d0502c5a96f1abb23f2505ad346b490d5134e..f83dbc17c1c6208508d1cebb95109755a2a11a36 100644 (file)
@@ -56,13 +56,15 @@ public:
                , source_producer_(frame_producer::empty())\r
        {\r
                dest->subscribe(event_subject_);\r
+\r
+               CASPAR_LOG(info) << print() << L" Initialized";\r
        }\r
        \r
        // frame_producer\r
                \r
        virtual void leading_producer(const spl::shared_ptr<frame_producer>& producer) override\r
        {\r
-               source_producer_ = producer;\r
+               source_producer_ = create_destroy_proxy(producer);\r
        }\r
 \r
        virtual draw_frame receive(int flags) override\r
@@ -70,8 +72,6 @@ public:
                if(current_frame_ >= info_.duration)\r
                        return dest_producer_->receive(flags);\r
                \r
-               ++current_frame_;\r
-\r
                event_subject_  << monitor::event("transition/frame") % current_frame_ % info_.duration\r
                                                << monitor::event("transition/type") % [&]() -> std::string\r
                                                                                                                                {\r
@@ -102,6 +102,11 @@ public:
                        if(source == core::draw_frame::late())\r
                                source = source_producer_->last_frame();\r
                });             \r
+               \r
+               ++current_frame_;\r
+\r
+               if(current_frame_ >= info_.duration)\r
+                       source_producer_ = core::frame_producer::empty();\r
 \r
                return compose(dest, source);\r
        }\r
@@ -203,7 +208,7 @@ public:
 \r
 spl::shared_ptr<frame_producer> create_transition_producer(const field_mode& mode, const spl::shared_ptr<frame_producer>& destination, const transition_info& info)\r
 {\r
-       return core::wrap_producer(spl::make_shared<transition_producer>(mode, destination, info));\r
+       return spl::make_shared<transition_producer>(mode, destination, info);\r
 }\r
 \r
 }}\r
index 51f85209e3d1c3d89bb0cdc2134ee74e4e07b3d7..ee21fa670cc35c0288cede9b158cdbbb9a0e7d4a 100644 (file)
@@ -150,6 +150,8 @@ public:
                        BOOST_THROW_EXCEPTION(caspar_exception() \r
                                                                        << msg_info(print() + L" Failed to start input stream.")\r
                                                                        << boost::errinfo_api_function("StartStreams"));\r
+\r
+               CASPAR_LOG(info) << print() << L" Initialized";\r
        }\r
 \r
        ~decklink_producer()\r
@@ -355,7 +357,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        if(format_desc.format == core::video_format::invalid)\r
                format_desc = frame_factory->video_format_desc();\r
                        \r
-       return core::wrap_producer(spl::make_shared<decklink_producer_proxy>(frame_factory, format_desc, device_index, filter_str, length));\r
+       return spl::make_shared<decklink_producer_proxy>(frame_factory, format_desc, device_index, filter_str, length);\r
 }\r
 \r
 }}
\ No newline at end of file
index 21a7ddf391518b61fef29266773b78f9b8de280b..3e77b04741d7d1913d1f3fbe0834000053d845f6 100644 (file)
@@ -138,6 +138,8 @@ public:
                        BOOST_THROW_EXCEPTION(averror_stream_not_found() << msg_info("No streams found"));\r
 \r
                muxer_.reset(new frame_muxer(fps_, frame_factory, filter));\r
+\r
+               CASPAR_LOG(info) << print() << L" Initialized";\r
        }\r
 \r
        // frame_producer\r
@@ -352,7 +354,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        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
-       return core::wrap_producer(spl::make_shared<ffmpeg_producer>(frame_factory, filename, filter_str, loop, start, length));\r
+       return spl::make_shared<ffmpeg_producer>(frame_factory, filename, filter_str, loop, start, length);\r
 }\r
 \r
 }}
\ No newline at end of file
index d306ee55088846226f2c010eb8602dfa67b5f284..ebee8324fed049c97f61433268ce7b32cb4688a3 100644 (file)
@@ -174,7 +174,7 @@ spl::shared_ptr<core::frame_producer> create_ct_producer(const spl::shared_ptr<c
        auto producer = flash_producer;\r
        cg_proxy(producer).add(0, filename, 1);\r
 \r
-       return core::wrap_producer(producer);\r
+       return producer;\r
 }\r
 \r
 cg_proxy::cg_proxy(const spl::shared_ptr<core::frame_producer>& frame_producer) : impl_(new impl(frame_producer)){}\r
index 4ae4322dd3c7cf8c6158eb68bae51bdf923974ab..4fc153317a233c4d255600458f3d486ea737a4a9 100644 (file)
@@ -355,6 +355,8 @@ public:
                graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.9f));\r
                graph_->set_text(print());\r
                diagnostics::register_graph(graph_);\r
+\r
+               CASPAR_LOG(info) << print() << L" Initialized";\r
        }\r
 \r
        ~flash_producer()\r
@@ -490,7 +492,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        if(!boost::filesystem::exists(filename))\r
                BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(u8(filename)));      \r
 \r
-       return core::wrap_producer(spl::make_shared<flash_producer>(frame_factory, filename, template_host.width, template_host.height));\r
+       return spl::make_shared<flash_producer>(frame_factory, filename, template_host.width, template_host.height);\r
 }\r
 \r
 std::wstring find_template(const std::wstring& template_name)\r
index 8303c795ed95ce65dd09ea2f41ec03d4b1a54800..29ed59fb45503a2407ee5b9126bb17967c6a9745 100644 (file)
@@ -61,6 +61,8 @@ struct image_producer : public core::frame_producer
 \r
                std::copy_n(FreeImage_GetBits(bitmap.get()), frame->image_data(0).size(), frame->image_data(0).begin());\r
                frame_ = core::draw_frame(std::move(frame));\r
+\r
+               CASPAR_LOG(info) << print() << L" Initialized";\r
        }\r
        \r
        // frame_producer\r
@@ -107,7 +109,7 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        if(ext == extensions.end())\r
                return core::frame_producer::empty();\r
 \r
-       return core::wrap_producer(spl::make_shared<image_producer>(frame_factory, filename + *ext));\r
+       return spl::make_shared<image_producer>(frame_factory, filename + *ext);\r
 }\r
 \r
 \r
index 8801e3f7dfaa8c4838c4c6d0b9dde598f523c7f7..29a7858d84f12616270182567c35c90cfbc07809 100644 (file)
@@ -254,7 +254,7 @@ spl::shared_ptr<core::frame_producer> create_scroll_producer(const spl::shared_p
        if(speed == 0)\r
                return core::frame_producer::empty();\r
 \r
-       return core::wrap_producer(spl::make_shared<image_scroll_producer>(frame_factory, filename + L"." + *ext, speed));\r
+       return spl::make_shared<image_scroll_producer>(frame_factory, filename + L"." + *ext, speed);\r
 }\r
 \r
 }}
\ No newline at end of file
index 8ec581a460e56f35e94804cdefe5058ab05f7b99..2431a0753e0e008b44ff98b3fb135f1f90b0d333 100644 (file)
@@ -8,7 +8,7 @@
     <template-path>D:\casparcg\_templates\</template-path>\r
   </paths>\r
   <log-level>trace</log-level>\r
-  <accelerator>cpu</accelerator>\r
+  <accelerator>gpu</accelerator>\r
   <flash>\r
     <buffer-depth>4</buffer-depth>\r
   </flash>\r