]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/consumer/ffmpeg_consumer.cpp
2.0.2: - Updated get_param.
[casparcg] / modules / ffmpeg / consumer / ffmpeg_consumer.cpp
index a58ffec41a6d9c2e5f3d44c909eceac33659001a..2a93beac856441b32c6a231e228d286750e58dd8 100644 (file)
@@ -1,21 +1,22 @@
 /*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
 *\r
-*  This ffmpeg is part of CasparCG.\r
+* This file is part of CasparCG (www.casparcg.com).\r
 *\r
-*    CasparCG is free software: you can redistribute it and/or modify\r
-*    it under the terms of the GNU General Public License as published by\r
-*    the Free Software Foundation, either version 3 of the License, or\r
-*    (at your option) any later version.\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
 *\r
-*    CasparCG is distributed in the hope that it will be useful,\r
-*    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-*    GNU General Public License for more details.\r
-\r
-*    You should have received a copy of the GNU General Public License\r
-*    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
 *\r
+* Author: Robert Nagy, ronag89@gmail.com\r
 */\r
  \r
 #include "../StdAfx.h"\r
@@ -31,8 +32,9 @@
 \r
 #include <common/concurrency/executor.h>\r
 #include <common/diagnostics/graph.h>\r
-#include <common/utility/string.h>\r
 #include <common/env.h>\r
+#include <common/utility/string.h>\r
+#include <common/utility/param.h>\r
 \r
 #include <boost/algorithm/string.hpp>\r
 #include <boost/timer.hpp>\r
@@ -446,27 +448,20 @@ safe_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>&
        if(params.size() < 1 || params[0] != L"FILE")\r
                return core::frame_consumer::empty();\r
        \r
-       auto filename = (params.size() > 1 ? params[1] : L"");\r
-\r
-       bool key_only = std::find(params.begin(), params.end(), L"KEY_ONLY") != params.end();\r
-\r
-       std::wstring codec = L"libx264";\r
-       auto codec_it = std::find(params.begin(), params.end(), L"CODEC");\r
-       if(codec_it != params.end() && codec_it++ != params.end())\r
-               codec = *codec_it;\r
-\r
+       auto filename   = (params.size() > 1 ? params[1] : L"");\r
+       bool key_only   = get_param(L"KEY_ONLY", params, false);\r
+       auto codec              = get_param(L"CODEC", params, L"libx264");\r
+       auto options    = get_param(L"OPTIONS", params);\r
+       \r
        if(codec == L"H264")\r
                codec = L"libx264";\r
 \r
        if(codec == L"DVCPRO")\r
                codec = L"dvvideo";\r
 \r
-       std::wstring options = L"";\r
-       auto options_it = std::find(params.begin(), params.end(), L"OPTIONS");\r
-       if(options_it != params.end() && options_it++ != params.end())\r
-               options = *options_it;\r
+       boost::to_lower(options);\r
 \r
-       return make_safe<ffmpeg_consumer_proxy>(env::media_folder() + filename, key_only, codec, boost::to_lower_copy(options));\r
+       return make_safe<ffmpeg_consumer_proxy>(env::media_folder() + filename, key_only, codec, options);\r
 }\r
 \r
 safe_ptr<core::frame_consumer> create_consumer(const boost::property_tree::ptree& ptree)\r