input input_; \r
video_decoder video_decoder_;\r
audio_decoder audio_decoder_; \r
+ double fps_;\r
frame_muxer muxer_;\r
\r
int late_frames_;\r
const bool loop_;\r
\r
safe_ptr<core::basic_frame> last_frame_;\r
+\r
+ const size_t width_;\r
+ const size_t height_;\r
+ bool progressive_;\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, int length) \r
: filename_(filename)\r
- , graph_(diagnostics::create_graph(narrow(print())))\r
+ , graph_(diagnostics::create_graph([this]{return print();}))\r
, frame_factory_(frame_factory) \r
, format_desc_(frame_factory->get_video_format_desc())\r
, input_(graph_, filename_, loop, start, length)\r
, video_decoder_(input_.context(), frame_factory, filter)\r
, audio_decoder_(input_.context(), frame_factory->get_video_format_desc())\r
- , muxer_(validate_fps(video_decoder_.fps(), video_decoder_.nb_frames(), audio_decoder_.duration()), frame_factory)\r
+ , fps_(validate_fps(video_decoder_.fps(), video_decoder_.nb_frames(), audio_decoder_.duration()))\r
+ , muxer_(fps_, frame_factory)\r
, late_frames_(0)\r
, start_(start)\r
, loop_(loop)\r
, last_frame_(core::basic_frame::empty())\r
+ , width_(video_decoder_.width())\r
+ , height_(video_decoder_.height())\r
+ , progressive_(true)\r
{\r
graph_->add_guide("frame-time", 0.5);\r
graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
return;\r
\r
auto video_frames = video_decoder_.poll();\r
- BOOST_FOREACH(auto& video, video_frames) \r
+ BOOST_FOREACH(auto& video, video_frames) \r
+ {\r
+ progressive_ &= video->interlaced_frame != 0;\r
muxer_.push(video, hints); \r
+ }\r
},\r
[&]\r
{\r
\r
virtual std::wstring print() const\r
{\r
- return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"]";\r
+ return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"|" \r
+ + boost::lexical_cast<std::wstring>(fps_) + (progressive_ ? L"p" : L"i") +L"|"\r
+ + boost::lexical_cast<std::wstring>(width_) + L"x" + boost::lexical_cast<std::wstring>(height_) + L"]";\r
}\r
};\r
\r
\r
double fps_;\r
int64_t nb_frames_;\r
+\r
+ size_t width_;\r
+ size_t height_;\r
+\r
public:\r
explicit implementation(const safe_ptr<AVFormatContext>& context, const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filter) \r
: frame_factory_(frame_factory)\r
, filter_(filter)\r
, fps_(frame_factory_->get_video_format_desc().fps)\r
, nb_frames_(0)\r
+ , width_(0)\r
+ , height_(0)\r
{\r
try\r
{\r
fps_ = static_cast<double>(codec_context_->time_base.den) / static_cast<double>(codec_context_->time_base.num);\r
if(double_rate(filter))\r
fps_ *= 2;\r
+\r
+ width_ = codec_context_->width;\r
+ height_ = codec_context_->height;\r
}\r
catch(...)\r
{\r
bool video_decoder::ready() const{return impl_->ready();}\r
double video_decoder::fps() const{return impl_->fps();}\r
int64_t video_decoder::nb_frames() const{return impl_->nb_frames_;}\r
+size_t video_decoder::width() const{return impl_->width_;}\r
+size_t video_decoder::height() const{return impl_->height_;}\r
}
\ No newline at end of file