Skip to content

Commit 5e2d6af

Browse files
Merge pull request #81 from cchampet/dev_option_fix_unit
OptionLoader: fix AVOption which correspond to a choice parameter
2 parents 2ad9fbd + 52f3e9f commit 5e2d6af

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/AvTranscoder/Option.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ OptionType Option::getTypeFromAVOption( const char* unit, AVOptionType avType )
1616
{
1717
if( unit && avType == AV_OPT_TYPE_FLAGS )
1818
return TypeGroup;
19-
else if( unit && avType == AV_OPT_TYPE_INT )
19+
else if( unit && ( avType == AV_OPT_TYPE_INT || avType == AV_OPT_TYPE_INT64 ) )
2020
return TypeChoice;
2121
else if( unit && avType == AV_OPT_TYPE_CONST )
2222
return TypeChild;

src/AvTranscoder/OptionLoader.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
262262
// iterate on child options
263263
for( std::vector<Option>::iterator itOption = childOptions.begin(); itOption != childOptions.end(); ++itOption )
264264
{
265+
bool parentFound = false;
265266
for( std::multimap<std::string, int>::iterator itUnit = optionUnitToIndex.begin(); itUnit != optionUnitToIndex.end(); ++itUnit )
266267
{
267268
if( itUnit->first == itOption->getUnit() )
@@ -277,8 +278,16 @@ OptionLoader::OptionArray OptionLoader::loadOptions( void* av_class, int req_fla
277278
if( itOption->getDefaultValueInt() == parentOption.getDefaultValueInt() )
278279
parentOption.setDefaultChildIndex( parentOption.getNbChilds() - 1 );
279280
}
281+
282+
parentFound = true;
283+
break;
280284
}
281285
}
286+
287+
if( ! parentFound )
288+
{
289+
std::cout << "Warning: Can't find a choice option for " << itOption->getName() << std::endl;
290+
}
282291
}
283292
return options;
284293
}

0 commit comments

Comments
 (0)