]> 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>
Tue, 9 Aug 2011 13:22:08 +0000 (13:22 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Tue, 9 Aug 2011 13:22:08 +0000 (13:22 +0000)
modules/image/consumer/image_consumer.cpp

index 75b2f3e5d253638feac8263935db058eacafcfbd..5d6cca34a072bab7e4c049a4e9e61de66375a95b 100644 (file)
@@ -54,35 +54,29 @@ public:
        \r
        virtual bool send(const safe_ptr<core::read_frame>& frame)\r
        {                               \r
-               if(counter_ < core::consumer_buffer_depth())\r
-                       ++counter_;\r
-               else if(counter_ == core::consumer_buffer_depth())\r
+               if(counter_++ < core::consumer_buffer_depth())\r
+                       return true;\r
+\r
+               boost::thread async([=]\r
                {\r
-                       boost::thread async([=]\r
+                       try\r
                        {\r
-                               try\r
-                               {\r
-                                       auto filename = narrow(env::data_folder()) +  boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) + ".png";\r
-\r
-                                       auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_Allocate(format_desc_.width, format_desc_.height, 32), FreeImage_Unload);\r
-                                       memcpy(FreeImage_GetBits(bitmap.get()), frame->image_data().begin(), frame->image_size());\r
-                                       FreeImage_FlipVertical(bitmap.get());\r
-                                       FreeImage_Save(FIF_PNG, bitmap.get(), filename.c_str(), 0);\r
-                               }\r
-                               catch(...)\r
-                               {\r
-                                       CASPAR_LOG_CURRENT_EXCEPTION();\r
-                               }\r
-                       });\r
-                       async.detach();\r
-\r
-                       return false;\r
-               }\r
-\r
-               return true;\r
-       }\r
+                               auto filename = narrow(env::data_folder()) +  boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time()) + ".png";\r
+\r
+                               auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_Allocate(format_desc_.width, format_desc_.height, 32), FreeImage_Unload);\r
+                               memcpy(FreeImage_GetBits(bitmap.get()), frame->image_data().begin(), frame->image_size());\r
+                               FreeImage_FlipVertical(bitmap.get());\r
+                               FreeImage_Save(FIF_PNG, bitmap.get(), filename.c_str(), 0);\r
+                       }\r
+                       catch(...)\r
+                       {\r
+                               CASPAR_LOG_CURRENT_EXCEPTION();\r
+                       }\r
+               });\r
+               async.detach();\r
 \r
-       virtual size_t buffer_depth() const{return 3;}\r
+               return false;\r
+       }\r
 \r
        virtual std::wstring print() const\r
        {\r