\r
#include <tbb/spin_mutex.h>\r
\r
+#include <numeric>\r
+\r
#if defined(_MSC_VER)\r
#pragma warning (push)\r
#pragma warning (disable : 4244)\r
, croptop(0)\r
, cropbot(0)\r
{\r
+ if(boost::iequals(boost::filesystem::path(filename).extension().string(), ".dv"))\r
+ set_opt("f", "dv");\r
+\r
boost::range::remove_erase_if(options, [&](const option& o)\r
{\r
return set_opt(o.name, o.value);\r
// if (name.find("-dv") != std::string::npos) \r
// {\r
// set_opt("f", "dv");\r
+ // if(norm == PAL)\r
+ // {\r
+ // set_opt("s", "720x576");\r
+ // }\r
+ // else\r
+ // {\r
+ // set_opt("s", "720x480");\r
+ // if(height == 486)\r
+ // {\r
+ // set_opt("croptop", "2");\r
+ // set_opt("cropbot", "4");\r
+ // }\r
+ // }\r
// set_opt("s", norm == PAL ? "720x576" : "720x480");\r
- // //set_opt("pix_fmt", name.find("-dv50") != std::string::npos ? "yuv422p" : norm == PAL ? "yuv420p" : "yuv411p");\r
- // //set_opt("ar", "48000");\r
- // //set_opt("ac", "2");\r
// } \r
+\r
+ // return true;\r
//}\r
+ //else \r
if(name == "f")\r
{\r
format = av_guess_format(value.c_str(), nullptr, nullptr);\r
\r
return true;\r
}\r
- else if(name == "vcodec")\r
+ else if(name == "vcodec" || name == "v:codec")\r
{\r
auto c = avcodec_find_encoder_by_name(value.c_str());\r
if(c == nullptr)\r
return true;\r
\r
}\r
- else if(name == "acodec")\r
+ else if(name == "acodec" || name == "a:codec")\r
{\r
auto c = avcodec_find_encoder_by_name(value.c_str());\r
if(c == nullptr)\r
\r
if(c->codec_id == CODEC_ID_PRORES)\r
{ \r
- c->bit_rate = c->width < 1280 ? 63*1000000 : 220*1000000;\r
+ c->bit_rate = output_format_.width < 1280 ? 63*1000000 : 220*1000000;\r
c->pix_fmt = PIX_FMT_YUV422P10;\r
}\r
else if(c->codec_id == CODEC_ID_DNXHD)\r
c->width = c->height == 1280 ? 960 : c->width;\r
\r
if(format_desc_.format == core::video_format::ntsc)\r
+ {\r
c->pix_fmt = PIX_FMT_YUV411P;\r
+ output_format_.croptop = 2;\r
+ output_format_.cropbot = 4;\r
+ c->height = output_format_.height - output_format_.croptop - output_format_.cropbot;\r
+ }\r
else if(format_desc_.format == core::video_format::pal)\r
c->pix_fmt = PIX_FMT_YUV420P;\r
else // dv50\r
}; \r
spl::shared_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>& params)\r
{\r
- if(params.size() < 1 || params[0] != L"FILE")\r
+ auto str = std::accumulate(params.begin(), params.end(), std::wstring(), [](const std::wstring& lhs, const std::wstring& rhs) {return lhs + L" " + rhs;});\r
+ \r
+ boost::wregex path_exp(L"(FILE)? (?<PATH>.+\\..+).*", boost::regex::icase);\r
+\r
+ boost::wsmatch path;\r
+ if(!boost::regex_match(str, path, path_exp))\r
return core::frame_consumer::empty();\r
\r
- auto filename = (params.size() > 1 ? params[1] : L"");\r
- \r
- std::vector<option> options;\r
+ boost::wregex opt_exp(L"-((?<NAME>[^\\s]+)\\s+(?<VALUE>[^\\s]+))"); \r
\r
- if(params.size() >= 3)\r
+ std::vector<option> options;\r
+ for(boost::wsregex_iterator it(str.begin(), str.end(), opt_exp); it != boost::wsregex_iterator(); ++it)\r
{\r
- for(auto opt_it = params.begin()+2; opt_it != params.end();)\r
- {\r
- auto name = u8(boost::trim_copy(boost::to_lower_copy(*opt_it++))).substr(1);\r
- auto value = u8(boost::trim_copy(boost::to_lower_copy(*opt_it++)));\r
- \r
- if(value == "h264")\r
- value = "libx264";\r
- else if(value == "dvcpro")\r
- value = "dvvideo";\r
+ auto name = u8(boost::trim_copy(boost::to_lower_copy((*it)["NAME"].str())));\r
+ auto value = u8(boost::trim_copy(boost::to_lower_copy((*it)["VALUE"].str())));\r
+ \r
+ if(value == "h264")\r
+ value = "libx264";\r
+ else if(value == "dvcpro")\r
+ value = "dvvideo";\r
\r
- options.push_back(option(name, value));\r
- }\r
+ options.push_back(option(name, value));\r
}\r
- \r
- return spl::make_shared<ffmpeg_consumer_proxy>(env::media_folder() + filename, options);\r
+ \r
+ return spl::make_shared<ffmpeg_consumer_proxy>(env::media_folder() + path["PATH"].str(), options);\r
}\r
\r
spl::shared_ptr<core::frame_consumer> create_consumer(const boost::property_tree::wptree& ptree)\r