From d48dd20a817155af9d539fc96b91c473c0e1323d Mon Sep 17 00:00:00 2001 From: ronag Date: Tue, 9 Aug 2011 13:22:08 +0000 Subject: [PATCH] git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1110 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- modules/image/consumer/image_consumer.cpp | 46 ++++++++++------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/modules/image/consumer/image_consumer.cpp b/modules/image/consumer/image_consumer.cpp index 75b2f3e5d..5d6cca34a 100644 --- a/modules/image/consumer/image_consumer.cpp +++ b/modules/image/consumer/image_consumer.cpp @@ -54,35 +54,29 @@ public: virtual bool send(const safe_ptr& frame) { - if(counter_ < core::consumer_buffer_depth()) - ++counter_; - else if(counter_ == core::consumer_buffer_depth()) + if(counter_++ < core::consumer_buffer_depth()) + return true; + + boost::thread async([=] { - boost::thread async([=] + try { - try - { - auto filename = narrow(env::data_folder()) + boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) + ".png"; - - auto bitmap = std::shared_ptr(FreeImage_Allocate(format_desc_.width, format_desc_.height, 32), FreeImage_Unload); - memcpy(FreeImage_GetBits(bitmap.get()), frame->image_data().begin(), frame->image_size()); - FreeImage_FlipVertical(bitmap.get()); - FreeImage_Save(FIF_PNG, bitmap.get(), filename.c_str(), 0); - } - catch(...) - { - CASPAR_LOG_CURRENT_EXCEPTION(); - } - }); - async.detach(); - - return false; - } - - return true; - } + auto filename = narrow(env::data_folder()) + boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) + ".png"; + + auto bitmap = std::shared_ptr(FreeImage_Allocate(format_desc_.width, format_desc_.height, 32), FreeImage_Unload); + memcpy(FreeImage_GetBits(bitmap.get()), frame->image_data().begin(), frame->image_size()); + FreeImage_FlipVertical(bitmap.get()); + FreeImage_Save(FIF_PNG, bitmap.get(), filename.c_str(), 0); + } + catch(...) + { + CASPAR_LOG_CURRENT_EXCEPTION(); + } + }); + async.detach(); - virtual size_t buffer_depth() const{return 3;} + return false; + } virtual std::wstring print() const { -- 2.39.5