\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
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
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
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
\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
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