encoder: Actually fix parsing this time

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2019-11-16 23:46:20 +01:00
parent e4474c29c4
commit 815152d024
+4 -3
View File
@@ -1382,6 +1382,7 @@ void obsffmpeg::encoder::parse_ffmpeg_commandline(std::string text)
std::string ropt = opt_stream.str(); std::string ropt = opt_stream.str();
if (ropt.size() > 0) { if (ropt.size() > 0) {
opts.push_back(ropt); opts.push_back(ropt);
opt_stream.str(std::string());
opt_stream.clear(); opt_stream.clear();
} }
} else { } else {
@@ -1413,13 +1414,13 @@ void obsffmpeg::encoder::parse_ffmpeg_commandline(std::string text)
} }
try { try {
std::string key = opt.substr(1, eq_at - cstr); std::string key = opt.substr(1, eq_at - cstr - 1);
std::string value = opt.substr(eq_at - cstr + 1); std::string value = opt.substr(eq_at - cstr + 1);
int res = av_opt_set(_context, key.c_str(), value.c_str(), AV_OPT_SEARCH_CHILDREN); int res = av_opt_set(_context, key.c_str(), value.c_str(), AV_OPT_SEARCH_CHILDREN);
if (res < 0) { if (res < 0) {
PLOG_WARNING("Option '%s' encountered error: %s", opt.c_str(), PLOG_WARNING("Option '%s' (key: '%s', value: '%s') encountered error: %s", opt.c_str(),
ffmpeg::tools::get_error_description(res)); key.c_str(), value.c_str(), ffmpeg::tools::get_error_description(res));
} }
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
PLOG_ERROR("Option '%s' encountered exception: %s", opt.c_str(), ex.what()) PLOG_ERROR("Option '%s' encountered exception: %s", opt.c_str(), ex.what())