Commit 34a2451d authored by gbeauchesne@splitted-desktop.com's avatar gbeauchesne@splitted-desktop.com Committed by Rémi Duraffort

use VA_INVALID_ID wherever appropriate (vaapi).

Signed-off-by: default avatarLaurent Aimar <fenrir@videolan.org>
(cherry picked from commit a4f30ff9f74a205f9ad39fd5c76fbda32d064771)
Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent 278fd016
...@@ -130,6 +130,7 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id ) ...@@ -130,6 +130,7 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id )
memset( p_va, 0, sizeof(*p_va) ); memset( p_va, 0, sizeof(*p_va) );
p_va->i_config_id = VA_INVALID_ID; p_va->i_config_id = VA_INVALID_ID;
p_va->i_context_id = VA_INVALID_ID; p_va->i_context_id = VA_INVALID_ID;
p_va->image.image_id = VA_INVALID_ID;
/* Create a VA display */ /* Create a VA display */
p_va->p_display_x11 = XOpenDisplay(NULL); p_va->p_display_x11 = XOpenDisplay(NULL);
...@@ -175,7 +176,7 @@ error: ...@@ -175,7 +176,7 @@ error:
static void DestroySurfaces( vlc_va_vaapi_t *p_va ) static void DestroySurfaces( vlc_va_vaapi_t *p_va )
{ {
if( p_va->image.image_id != VA_INVALID_SURFACE ) if( p_va->image.image_id != VA_INVALID_ID )
{ {
CopyCleanCache( &p_va->image_cache ); CopyCleanCache( &p_va->image_cache );
vaDestroyImage( p_va->p_display, p_va->image.image_id ); vaDestroyImage( p_va->p_display, p_va->image.image_id );
...@@ -194,7 +195,7 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va ) ...@@ -194,7 +195,7 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va )
free( p_va->p_surface ); free( p_va->p_surface );
/* */ /* */
p_va->image.image_id = VA_INVALID_SURFACE; p_va->image.image_id = VA_INVALID_ID;
p_va->i_context_id = VA_INVALID_ID; p_va->i_context_id = VA_INVALID_ID;
p_va->p_surface = NULL; p_va->p_surface = NULL;
p_va->i_surface_width = 0; p_va->i_surface_width = 0;
...@@ -209,7 +210,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t ...@@ -209,7 +210,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
p_va->p_surface = calloc( p_va->i_surface_count, sizeof(*p_va->p_surface) ); p_va->p_surface = calloc( p_va->i_surface_count, sizeof(*p_va->p_surface) );
if( !p_va->p_surface ) if( !p_va->p_surface )
return VLC_EGENERIC; return VLC_EGENERIC;
p_va->image.image_id = VA_INVALID_SURFACE; p_va->image.image_id = VA_INVALID_ID;
p_va->i_context_id = VA_INVALID_ID; p_va->i_context_id = VA_INVALID_ID;
/* Create surfaces */ /* Create surfaces */
...@@ -262,7 +263,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t ...@@ -262,7 +263,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
{ {
if( vaCreateImage( p_va->p_display, &p_fmt[i], i_width, i_height, &p_va->image ) ) if( vaCreateImage( p_va->p_display, &p_fmt[i], i_width, i_height, &p_va->image ) )
{ {
p_va->image.image_id = VA_INVALID_SURFACE; p_va->image.image_id = VA_INVALID_ID;
continue; continue;
} }
/* Validate that vaGetImage works with this format */ /* Validate that vaGetImage works with this format */
...@@ -271,7 +272,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t ...@@ -271,7 +272,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
p_va->image.image_id) ) p_va->image.image_id) )
{ {
vaDestroyImage( p_va->p_display, p_va->image.image_id ); vaDestroyImage( p_va->p_display, p_va->image.image_id );
p_va->image.image_id = VA_INVALID_SURFACE; p_va->image.image_id = VA_INVALID_ID;
continue; continue;
} }
......
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