Skip to content

OptionLoader: fix AVOption which correspond to a choice parameter #81

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2014
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/AvTranscoder/Option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ OptionType Option::getTypeFromAVOption( const char* unit, AVOptionType avType )
{
if( unit && avType == AV_OPT_TYPE_FLAGS )
return TypeGroup;
else if( unit && avType == AV_OPT_TYPE_INT )
else if( unit && ( avType == AV_OPT_TYPE_INT || avType == AV_OPT_TYPE_INT64 ) )
return TypeChoice;
else if( unit && avType == AV_OPT_TYPE_CONST )
return TypeChild;
Expand Down
9 changes: 9 additions & 0 deletions src/AvTranscoder/OptionLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
// iterate on child options
for( std::vector<Option>::iterator itOption = childOptions.begin(); itOption != childOptions.end(); ++itOption )
{
bool parentFound = false;
for( std::multimap<std::string, int>::iterator itUnit = optionUnitToIndex.begin(); itUnit != optionUnitToIndex.end(); ++itUnit )
{
if( itUnit->first == itOption->getUnit() )
Expand All @@ -277,8 +278,16 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
if( itOption->getDefaultValueInt() == parentOption.getDefaultValueInt() )
parentOption.setDefaultChildIndex( parentOption.getNbChilds() - 1 );
}

parentFound = true;
break;
}
}

if( ! parentFound )
{
std::cout << "Warning: Can't find a choice option for " << itOption->getName() << std::endl;
}
}
return options;
}
Expand Down