Commit e25fc963 authored by Tristan Matthews's avatar Tristan Matthews

* #28351: libav_utils: use range-based for loops

parent 7ed09b90
...@@ -58,11 +58,11 @@ void findInstalledVideoCodecs() ...@@ -58,11 +58,11 @@ void findInstalledVideoCodecs()
if (p->type == AVMEDIA_TYPE_VIDEO) if (p->type == AVMEDIA_TYPE_VIDEO)
libav_codecs.push_back(p->name); libav_codecs.push_back(p->name);
for (map<string, string>::const_iterator it = encoders_.begin(); it != encoders_.end(); ++it) { for (const auto &it : encoders_) {
if (std::find(libav_codecs.begin(), libav_codecs.end(), it->second) != libav_codecs.end()) if (std::find(libav_codecs.begin(), libav_codecs.end(), it.second) != libav_codecs.end())
installed_video_codecs_.push_back(it->first); installed_video_codecs_.push_back(it.first);
else else
ERROR("Didn't find \"%s\" encoder", it->second.c_str()); ERROR("Didn't find \"%s\" encoder", it.second.c_str());
} }
} }
...@@ -160,15 +160,14 @@ getDefaultCodecs() ...@@ -160,15 +160,14 @@ getDefaultCodecs()
const char * const DEFAULT_BITRATE = "400"; const char * const DEFAULT_BITRATE = "400";
sfl_avcodec_init(); sfl_avcodec_init();
std::vector<std::map<std::string, std::string> > result; std::vector<std::map<std::string, std::string> > result;
for (std::vector<std::string>::const_iterator iter = installed_video_codecs_.begin(); for (const auto &iter : installed_video_codecs_) {
iter != installed_video_codecs_.end(); ++iter) {
std::map<std::string, std::string> codec; std::map<std::string, std::string> codec;
// FIXME: get these keys from proper place // FIXME: get these keys from proper place
codec["name"] = *iter; codec["name"] = iter;
codec["bitrate"] = DEFAULT_BITRATE; codec["bitrate"] = DEFAULT_BITRATE;
codec["enabled"] = "true"; codec["enabled"] = "true";
// FIXME: make a nicer version of this // FIXME: make a nicer version of this
if (*iter == "H264") if (iter == "H264")
codec["parameters"] = DEFAULT_H264_PROFILE_LEVEL_ID; codec["parameters"] = DEFAULT_H264_PROFILE_LEVEL_ID;
result.push_back(codec); result.push_back(codec);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment