\r
#include "video_decoder.h"\r
\r
-#include "../format/flv.h"\r
#include "../util.h"\r
#include "../filter/filter.h"\r
\r
#include "../../ffmpeg_error.h"\r
#include "../../tbb_avcodec.h"\r
\r
-#include <core/producer/frame/image_transform.h>\r
+#include <core/producer/frame/frame_transform.h>\r
#include <core/producer/frame/frame_factory.h>\r
\r
#include <boost/range/algorithm_ext/push_back.hpp>\r
#pragma warning (pop)\r
#endif\r
\r
-namespace caspar {\r
- \r
+namespace caspar { namespace ffmpeg {\r
+ \r
struct video_decoder::implementation : boost::noncopyable\r
{\r
const safe_ptr<core::frame_factory> frame_factory_;\r
CASPAR_LOG(debug) << "[video_decoder] " << context->streams[index_]->codec->codec->long_name;\r
\r
// Some files give an invalid time_base numerator, try to fix it.\r
- if(codec_context_ && codec_context_->time_base.num == 1)\r
- codec_context_->time_base.num = static_cast<int>(std::pow(10.0, static_cast<int>(std::log10(static_cast<float>(codec_context_->time_base.den)))-1)); \r
- \r
- if(boost::filesystem2::path(context->filename).extension() == ".flv")\r
- {\r
- try\r
- {\r
- auto meta = read_flv_meta_info(context->filename);\r
- fps_ = boost::lexical_cast<double>(meta["framerate"]);\r
- nb_frames_ = static_cast<int64_t>(boost::lexical_cast<double>(meta["duration"])*fps_);\r
- }\r
- catch(...){}\r
- }\r
- else\r
- {\r
- fps_ = static_cast<double>(codec_context_->time_base.den) / static_cast<double>(codec_context_->time_base.num);\r
- nb_frames_ = context->streams[index_]->nb_frames;\r
- if(nb_frames_ == 0)\r
- nb_frames_ = context->streams[index_]->duration;// * context->streams[index_]->time_base.den;\r
- }\r
+\r
+ fix_meta_data(*context);\r
+ \r
+ fps_ = static_cast<double>(codec_context_->time_base.den) / static_cast<double>(codec_context_->time_base.num);\r
+ nb_frames_ = context->streams[index_]->nb_frames;\r
\r
if(double_rate(filter))\r
fps_ *= 2;\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
+\r
+}}
\ No newline at end of file