Commit a47b657e authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Paul Saman

vaapi: fix profile detection

The selected profile wasn't checked against card's ones.
(ex: resulting in sending MPEG2 to a VC1/h264 only card)
Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent e2854b9e
...@@ -86,7 +86,9 @@ static vlc_va_vaapi_t *vlc_va_vaapi_Get( void *p_va ) ...@@ -86,7 +86,9 @@ static vlc_va_vaapi_t *vlc_va_vaapi_Get( void *p_va )
/* */ /* */
static int Open( vlc_va_vaapi_t *p_va, int i_codec_id, int i_count ) static int Open( vlc_va_vaapi_t *p_va, int i_codec_id, int i_count )
{ {
VAProfile i_profile; VAProfile i_profile, *p_profiles_list;
bool b_supported_profile = false;
int i_profiles_nb = 0;
int i_surface_count; int i_surface_count;
/* NOTE: The number of surfaces requested is calculated /* NOTE: The number of surfaces requested is calculated
...@@ -144,6 +146,26 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id, int i_count ) ...@@ -144,6 +146,26 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id, int i_count )
p_va->conn->lock(); p_va->conn->lock();
/* Check if the selected profile is supported */
i_profiles_nb = vaMaxNumEntrypoints( p_va->display );
p_profiles_list = malloc( i_profiles_nb * sizeof( VAProfile ) );
if ( !p_profiles_list )
goto error;
if ( vaQueryConfigProfiles( p_va->display, p_profiles_list, &i_profiles_nb ) == VA_STATUS_SUCCESS )
{
while( --i_profiles_nb >= 0 )
{
if ( p_profiles_list[i_profiles_nb] == i_profile )
{
b_supported_profile = true;
break;
}
}
}
free( p_profiles_list );
if ( !b_supported_profile )
goto error;
/* Create a VA configuration */ /* Create a VA configuration */
VAConfigAttrib attrib; VAConfigAttrib attrib;
memset( &attrib, 0, sizeof(attrib) ); memset( &attrib, 0, sizeof(attrib) );
......
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