[vlc-commits] commit: Used VA_INVALID_ID when appropriate. (Laurent Aimar )

git at videolan.org git at videolan.org
Sun Jul 11 19:57:19 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Jul 11 18:53:05 2010 +0200| [3683cc99da0a39bca72d14a17682ffeacee7652b] | committer: Laurent Aimar 

Used VA_INVALID_ID when appropriate.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3683cc99da0a39bca72d14a17682ffeacee7652b
---

 modules/codec/avcodec/vaapi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 4bcd898..f57439c 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -128,6 +128,8 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id )
 
     /* */
     memset( p_va, 0, sizeof(*p_va) );
+    p_va->i_config_id  = VA_INVALID_ID;
+    p_va->i_context_id = VA_INVALID_ID;
 
     /* Create a VA display */
     if( !XInitThreads() )
@@ -158,7 +160,7 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id )
     if( vaCreateConfig( p_va->p_display,
                         i_profile, VAEntrypointVLD, &attrib, 1, &p_va->i_config_id ) )
     {
-        p_va->i_config_id = 0;
+        p_va->i_config_id = VA_INVALID_ID;
         goto error;
     }
 
@@ -182,7 +184,7 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va )
         vaDestroyImage( p_va->p_display, p_va->image.image_id );
     }
 
-    if( p_va->i_context_id )
+    if( p_va->i_context_id != VA_INVALID_ID )
         vaDestroyContext( p_va->p_display, p_va->i_context_id );
 
     for( int i = 0; i < p_va->i_surface_count && p_va->p_surface; i++ )
@@ -196,7 +198,7 @@ static void DestroySurfaces( vlc_va_vaapi_t *p_va )
 
     /* */
     p_va->image.image_id = VA_INVALID_SURFACE;
-    p_va->i_context_id = 0;
+    p_va->i_context_id = VA_INVALID_ID;
     p_va->p_surface = NULL;
     p_va->i_surface_width = 0;
     p_va->i_surface_height = 0;
@@ -211,6 +213,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
     if( !p_va->p_surface )
         return VLC_EGENERIC;
     p_va->image.image_id = VA_INVALID_SURFACE;
+    p_va->i_context_id   = VA_INVALID_ID;
 
     /* Create surfaces */
     VASurfaceID pi_surface_id[p_va->i_surface_count];
@@ -236,7 +239,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
                          i_width, i_height, VA_PROGRESSIVE,
                          pi_surface_id, p_va->i_surface_count, &p_va->i_context_id ) )
     {
-        p_va->i_context_id = 0;
+        p_va->i_context_id = VA_INVALID_ID;
         goto error;
     }
 
@@ -456,7 +459,7 @@ static void Close( vlc_va_vaapi_t *p_va )
     if( p_va->i_surface_width || p_va->i_surface_height )
         DestroySurfaces( p_va );
 
-    if( p_va->i_config_id )
+    if( p_va->i_config_id != VA_INVALID_ID )
         vaDestroyConfig( p_va->p_display, p_va->i_config_id );
     if( p_va->p_display )
         vaTerminate( p_va->p_display );



More information about the vlc-commits mailing list