Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Option: fixed missing childs of options with the same unit#278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
cchampet merged 3 commits intoavTranscoder:developfromcchampet:fix_optionsGetChilds
Aug 29, 2016
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 28 additions & 17 deletionssrc/AvTranscoder/Option.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,6 +229,7 @@ void loadOptions(OptionMap& outOptions, void* av_class, int req_flags)
if(!av_class)
return;

// Use multimap because it is possible to have several parent options with the same unit
std::multimap<std::string, std::string> optionUnitToParentName;
std::vector<Option> childOptions;

Expand All@@ -255,39 +256,49 @@ void loadOptions(OptionMap& outOptions, void* av_class, int req_flags)
else
{
outOptions.insert(std::make_pair(option.getName(), option));
optionUnitToParentName.insert(std::make_pair(option.getUnit(), option.getName()));
if(! option.getUnit().empty())
{
optionUnitToParentName.insert(std::make_pair(option.getUnit(), option.getName()));
}
}
}

// iterate on child options
for(std::vector<Option>::iteratoritOption = childOptions.begin();itOption != childOptions.end(); ++itOption)
for(std::vector<Option>::iteratoritChild = childOptions.begin();itChild != childOptions.end(); ++itChild)
{
bool parentFound = false;
for(std::multimap<std::string, std::string>::iteratoritUnit = optionUnitToParentName.begin();
itUnit != optionUnitToParentName.end(); ++itUnit)
for(std::multimap<std::string, std::string>::iteratoritUnitToParents = optionUnitToParentName.begin();
itUnitToParents != optionUnitToParentName.end(); ++itUnitToParents)
{
if(itUnit->first == itOption->getUnit())
const std::string parentUnit = itUnitToParents->first;
if(parentUnit == itChild->getUnit())
{
std::string nameParentOption = itUnit->second;
Option& parentOption = outOptions.at(nameParentOption);

parentOption.appendChild(*itOption);

// child of a Choice
if(parentOption.getType() == eOptionBaseTypeChoice)
// Get all the parent options with the same unit
std::pair<std::multimap<std::string, std::string>::iterator, std::multimap<std::string, std::string>::iterator> parentOptions = optionUnitToParentName.equal_range(parentUnit);
for(std::multimap<std::string, std::string>::iterator itParent = parentOptions.first; itParent != parentOptions.second; ++itParent)
{
if(itOption->getDefaultInt() == parentOption.getDefaultInt())
parentOption.setDefaultChildIndex(parentOption.getChilds().size() - 1);
const std::string parentName = itParent->second;
Option& parentOption = outOptions.at(parentName);
parentOption.appendChild(*itChild);

// child of a Choice
if(parentOption.getType() == eOptionBaseTypeChoice)
{
if(itChild->getDefaultInt() == parentOption.getDefaultInt())
parentOption.setDefaultChildIndex(parentOption.getChilds().size() - 1);
}

parentFound = true;
}

parentFound = true;
break;
if(parentFound)
break;
}
}

if(!parentFound)
{
LOG_WARN("Can't find a choice option for " <<itOption->getName())
LOG_WARN("Can't find a choice option for " <<itChild->getName())
}
}
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp