namespace es_conf {
void LoadIniProperty(const Json::Value& root) {
+ // clang-format off
+ std::vector<std::string> booleanKeys {
+ "generate_dot",
+ "force_sw_audio_codec",
+ "force_sw_video_codec",
+ "fallback_to_sw_audio_codec",
+ "fallback_to_sw_video_codec"
+ };
+ // clang-format on
gst_util::GstInit(root);
- std::string key = "generate_dot";
- es_conf::ini_property[key] = root.get(key, "").asBool();
- LOG_DEBUG("[%s] : [%d]", key.c_str(), es_conf::ini_property[key]);
- key = "force_sw_audio_codec";
- es_conf::ini_property[key] = root.get(key, "").asBool();
- LOG_DEBUG("[%s] : [%d]", key.c_str(), es_conf::ini_property[key]);
- key = "force_sw_video_codec";
- es_conf::ini_property[key] = root.get(key, "").asBool();
- LOG_DEBUG("[%s] : [%d]", key.c_str(), es_conf::ini_property[key]);
- key = "fallback_to_sw_audio_codec";
- es_conf::ini_property[key] = root.get(key, "").asBool();
- LOG_DEBUG("[%s] : [%d]", key.c_str(), es_conf::ini_property[key]);
- key = "fallback_to_sw_video_codec";
- es_conf::ini_property[key] = root.get(key, "").asBool();
- LOG_DEBUG("[%s] : [%d]", key.c_str(), es_conf::ini_property[key]);
+ std::for_each(booleanKeys.begin(), booleanKeys.end(), [&](const auto& key) {
+ es_conf::ini_property[key] = root.get(key, "").asBool();
+ LOG_DEBUG("[%s] : [%d]", key.c_str(), es_conf::ini_property[key]);
+ });
}
bool LoadIniFile() {