Skip to content

Commit

Permalink
Fix wrong search flags supplied to av_opt_set().
Browse files Browse the repository at this point in the history
Not only were the wrong AV_OPT flags supplied as search options but also
lack of AV_OPT_SEARCH_CHILDREN was the cause of warnings such as:

[libx264 @ 0x7ff55c001c60] [Eval @ 0x7ff561544c60] Undefined constant or
missing '(' in 'main'
[libx264 @ 0x7ff55c001c60] Unable to parse option value "main"
  • Loading branch information
ddennedy committed Mar 12, 2018
1 parent 7455472 commit 50e90dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/modules/avformat/consumer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,16 +444,17 @@ static void apply_properties( void *obj, mlt_properties properties, int flags )
for ( i = 0; i < count; i++ )
{
const char *opt_name = mlt_properties_get_name( properties, i );
const AVOption *opt = av_opt_find( obj, opt_name, NULL, flags, flags );
int search_flags = AV_OPT_SEARCH_CHILDREN;
const AVOption *opt = av_opt_find( obj, opt_name, NULL, flags, search_flags );

// If option not found, see if it was prefixed with a or v (-vb)
if ( !opt && (
( opt_name[0] == 'v' && ( flags & AV_OPT_FLAG_VIDEO_PARAM ) ) ||
( opt_name[0] == 'a' && ( flags & AV_OPT_FLAG_AUDIO_PARAM ) ) ) )
opt = av_opt_find( obj, ++opt_name, NULL, flags, flags );
opt = av_opt_find( obj, ++opt_name, NULL, flags, search_flags );
// Apply option if found
if ( opt && strcmp( opt_name, "channel_layout" ) )
av_opt_set( obj, opt_name, mlt_properties_get_value( properties, i), 0 );
av_opt_set( obj, opt_name, mlt_properties_get_value( properties, i), search_flags );
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/modules/avformat/producer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2040,11 +2040,12 @@ static void apply_properties( void *obj, mlt_properties properties, int flags )
for ( i = 0; i < count; i++ )
{
const char *opt_name = mlt_properties_get_name( properties, i );
const AVOption *opt = av_opt_find( obj, opt_name, NULL, flags, flags );
int search_flags = AV_OPT_SEARCH_CHILDREN;
const AVOption *opt = av_opt_find( obj, opt_name, NULL, flags, search_flags );
if ( opt_name && mlt_properties_get( properties, opt_name ) )
{
if ( opt )
av_opt_set( obj, opt_name, mlt_properties_get( properties, opt_name), 0 );
av_opt_set( obj, opt_name, mlt_properties_get( properties, opt_name), search_flags );
}
}
}
Expand Down

0 comments on commit 50e90dd

Please sign in to comment.