\r
#include <tbb/parallel_invoke.h>\r
\r
-namespace caspar {\r
+namespace caspar { namespace ffmpeg {\r
\r
struct ffmpeg_producer : public core::frame_producer\r
{\r
public:\r
explicit ffmpeg_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, const std::wstring& filter, bool loop, int start, size_t length) \r
: filename_(filename)\r
- , graph_(diagnostics::create_graph([this]{return print();}))\r
+ , graph_(diagnostics::create_graph(""))\r
, frame_factory_(frame_factory) \r
, format_desc_(frame_factory->get_video_format_desc())\r
, input_(graph_, filename_, loop, start, length)\r
graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
graph_->set_color("underflow", diagnostics::color(0.6f, 0.3f, 0.9f)); \r
\r
- for(int n = 0; n < 32 && muxer_.empty(); ++n)\r
- decode_frame(0);\r
+ for(int n = 0; n < 3; ++n)\r
+ frame_factory->create_frame(this, std::max<size_t>(2, video_decoder_.width()), std::max<size_t>(2, video_decoder_.height()));\r
}\r
\r
virtual safe_ptr<core::basic_frame> receive(int hints)\r
else \r
graph_->add_tag("underflow"); \r
}\r
+\r
+ graph_->update_text(narrow(print()));\r
\r
return frame;\r
}\r
return disable_audio(last_frame_);\r
}\r
\r
- void decode_frame(int hints)\r
+ void push_packets()\r
{\r
for(int n = 0; n < 16 && ((!muxer_.video_ready() && !video_decoder_.ready()) || (!muxer_.audio_ready() && !audio_decoder_.ready())); ++n) \r
{\r
audio_decoder_.push(pkt);\r
}\r
}\r
+ }\r
+\r
+ void decode_frame(int hints)\r
+ {\r
+ push_packets();\r
\r
tbb::parallel_invoke(\r
[&]\r
}\r
};\r
\r
-safe_ptr<core::frame_producer> create_ffmpeg_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::vector<std::wstring>& params)\r
+safe_ptr<core::frame_producer> create_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::vector<std::wstring>& params)\r
{ \r
static const std::vector<std::wstring> extensions = boost::assign::list_of\r
(L"mpg")(L"mpeg")(L"m2v")(L"m4v")(L"mp3")(L"mp4")(L"mpga")\r
return make_safe<ffmpeg_producer>(frame_factory, path, filter_str, loop, start, length);\r
}\r
\r
-}
\ No newline at end of file
+}}
\ No newline at end of file