]> 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>
Mon, 12 Mar 2012 15:26:11 +0000 (15:26 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 12 Mar 2012 15:26:11 +0000 (15:26 +0000)
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/muxer/frame_muxer.cpp
modules/ffmpeg/producer/muxer/frame_muxer.h

index 084c32bf43ae5336e2225378cf0330ac080f1214..3b19a1ab582120eaa6ac803394b6897bf74fdc8d 100644 (file)
@@ -319,7 +319,9 @@ public:
 \r
                        std::shared_ptr<AVPacket> pkt;\r
 \r
-                       for(int n = 0; n < 32 && ((video_decoder_ && !video_decoder_->ready()) || (audio_decoder_ && !audio_decoder_->ready())) && input_.try_pop(pkt); ++n)\r
+                       for(int n = 0; n < 32 && ((video_decoder_ && !video_decoder_->ready() && !muxer_->video_ready()) || \r
+                                                                         (audio_decoder_ && !audio_decoder_->ready() && !muxer_->audio_ready())) && \r
+                                                                        input_.try_pop(pkt); ++n)\r
                        {\r
                                if(video_decoder_)\r
                                        video_decoder_->push(pkt);\r
@@ -330,35 +332,35 @@ public:
                        std::shared_ptr<AVFrame>                        video;\r
                        std::shared_ptr<core::audio_buffer> audio;\r
 \r
-                       tbb::parallel_invoke(\r
-                       [&]\r
-                       {\r
-                               if(!muxer_->video_ready() && video_decoder_)    \r
-                                       video = video_decoder_->poll(); \r
-                       },\r
-                       [&]\r
-                       {               \r
-                               if(!muxer_->audio_ready() && audio_decoder_)            \r
-                                       audio = audio_decoder_->poll();         \r
-                       });\r
+                       tbb::parallel_invoke\r
+                       (\r
+                               [&]\r
+                               {\r
+                                       video = !muxer_->video_ready() && video_decoder_ ? video_decoder_->poll() : nullptr;    \r
+                               },\r
+                               [&]\r
+                               {               \r
+                                       audio = !muxer_->audio_ready() && audio_decoder_ ? audio_decoder_->poll() : nullptr;            \r
+                               }\r
+                       );\r
                \r
-                       muxer_->push_video(video);\r
-                       muxer_->push_audio(audio);\r
+                       muxer_->push(video);\r
+                       muxer_->push(audio);\r
 \r
                        if(!audio_decoder_)\r
                        {\r
                                if(video == flush_video())\r
-                                       muxer_->push_audio(flush_audio());\r
+                                       muxer_->push(flush_audio());\r
                                else if(!muxer_->audio_ready())\r
-                                       muxer_->push_audio(empty_audio());\r
+                                       muxer_->push(empty_audio());\r
                        }\r
 \r
                        if(!video_decoder_)\r
                        {\r
                                if(audio == flush_audio())\r
-                                       muxer_->push_video(flush_video());\r
+                                       muxer_->push(flush_video());\r
                                else if(!muxer_->video_ready())\r
-                                       muxer_->push_video(empty_video());\r
+                                       muxer_->push(empty_video());\r
                        }\r
                }\r
 \r
index 108b052f0137a2f92450ad51283f4c4f2680c6a3..438232dc6d95b5b3167b70cbc9e1eba3f632fdc0 100644 (file)
@@ -97,7 +97,7 @@ struct frame_muxer::impl : boost::noncopyable
                boost::range::rotate(audio_cadence_, std::end(audio_cadence_)-1);\r
        }\r
 \r
-       void push_video(const std::shared_ptr<AVFrame>& video_frame)\r
+       void push(const std::shared_ptr<AVFrame>& video_frame)\r
        {               \r
                if(!video_frame)\r
                        return;\r
@@ -124,7 +124,7 @@ struct frame_muxer::impl : boost::noncopyable
                        BOOST_THROW_EXCEPTION(invalid_operation() << source_info("frame_muxer") << msg_info("video-stream overflow. This can be caused by incorrect frame-rate. Check clip meta-data."));\r
        }\r
 \r
-       void push_audio(const std::shared_ptr<core::audio_buffer>& audio)\r
+       void push(const std::shared_ptr<core::audio_buffer>& audio)\r
        {\r
                if(!audio)      \r
                        return;\r
@@ -340,8 +340,8 @@ struct frame_muxer::impl : boost::noncopyable
 \r
 frame_muxer::frame_muxer(double in_fps, const spl::shared_ptr<core::frame_factory>& frame_factory, const core::video_format_desc& format_desc, const std::wstring& filter)\r
        : impl_(new impl(in_fps, frame_factory, format_desc, filter)){}\r
-void frame_muxer::push_video(const std::shared_ptr<AVFrame>& video_frame){impl_->push_video(video_frame);}\r
-void frame_muxer::push_audio(const std::shared_ptr<core::audio_buffer>& audio_samples){return impl_->push_audio(audio_samples);}\r
+void frame_muxer::push(const std::shared_ptr<AVFrame>& video_frame){impl_->push(video_frame);}\r
+void frame_muxer::push(const std::shared_ptr<core::audio_buffer>& audio_samples){return impl_->push(audio_samples);}\r
 bool frame_muxer::try_pop(core::draw_frame& result){return impl_->try_pop(result);}\r
 uint32_t frame_muxer::calc_nb_frames(uint32_t nb_frames) const {return impl_->calc_nb_frames(nb_frames);}\r
 bool frame_muxer::video_ready() const{return impl_->video_ready();}\r
index b55c7b10712c669bc808e1578b946ff5aaac0c99..4100f63fdccee010e08e6e67a1da1be8650827e6 100644 (file)
@@ -47,8 +47,8 @@ class frame_muxer : boost::noncopyable
 public:\r
        frame_muxer(double in_fps, const spl::shared_ptr<core::frame_factory>& frame_factory, const core::video_format_desc& format_desc, const std::wstring& filter = L"");\r
        \r
-       void push_video(const std::shared_ptr<AVFrame>& video_frame);\r
-       void push_audio(const std::shared_ptr<core::audio_buffer>& audio_samples);\r
+       void push(const std::shared_ptr<AVFrame>& video_frame);\r
+       void push(const std::shared_ptr<core::audio_buffer>& audio_samples);\r
        \r
        bool video_ready() const;\r
        bool audio_ready() const;\r