]> git.sesse.net Git - casparcg/commitdiff
2.1.0: -ffmpeg_producer: Fixed EOF without LOOP.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 26 Mar 2012 07:23:07 +0000 (07:23 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 26 Mar 2012 07:23:07 +0000 (07:23 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2750 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

modules/ffmpeg/producer/input/input.cpp

index 78bbed3c7247d829425dcaecc92a1148b6e589ac..1ac27b972a91722cbf70e04a899322fea66246ea 100644 (file)
@@ -112,6 +112,7 @@ struct input::impl : boost::noncopyable
        tbb::atomic<uint32_t>                                                                           start_;         \r
        tbb::atomic<uint32_t>                                                                           length_;\r
        tbb::atomic<bool>                                                                                       loop_;\r
+       tbb::atomic<bool>                                                                                       eof_;\r
        double                                                                                                          fps_;\r
        uint32_t                                                                                                        frame_number_;\r
        \r
@@ -138,6 +139,7 @@ struct input::impl : boost::noncopyable
                start_                  = start;\r
                length_                 = length;\r
                loop_                   = loop;\r
+               eof_                    = false;\r
                seek_target_    = start_;\r
                is_running_             = true;\r
                thread_                 = boost::thread([this]{run();});\r
@@ -181,6 +183,9 @@ struct input::impl : boost::noncopyable
                seek_target_ = target;\r
                video_stream_.clear();\r
                audio_stream_.clear();\r
+\r
+               eof_ = false;\r
+               cond_.notify_one();\r
        }\r
                \r
        std::wstring print() const\r
@@ -244,6 +249,8 @@ private:
                                internal_seek(start_);\r
                                graph_->set_tag("seek");                \r
                        }\r
+                       else\r
+                               eof_ = true;\r
                }\r
                else\r
                {               \r
@@ -292,7 +299,7 @@ private:
 \r
                                boost::this_thread::sleep(boost::posix_time::milliseconds(1));\r
                                \r
-                               while(full() && is_running_)\r
+                               while((full() || eof_) && is_running_)\r
                                        cond_.wait(lock);\r
                        }\r
                        catch(...)\r