[vlc-commits] commit: VAAPI: use vlc_xlib_init() ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sat Oct 30 18:27:26 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 30 19:26:43 2010 +0300| [e9f34b05c1bb5eeb9912c41bdbeda340e0ee9558] | committer: Rémi Denis-Courmont 

VAAPI: use vlc_xlib_init()

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

 modules/codec/avcodec/va.h    |    2 +-
 modules/codec/avcodec/vaapi.c |   10 +++-------
 modules/codec/avcodec/video.c |    2 +-
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 6cb5bf4..1cc7844 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -58,7 +58,7 @@ static inline void vlc_va_Delete(vlc_va_t *va)
     va->close(va);
 }
 
-vlc_va_t *vlc_va_NewVaapi(int codec_id);
+vlc_va_t *vlc_va_NewVaapi(vlc_object_t *obj, int codec_id);
 vlc_va_t *vlc_va_NewDxva2(vlc_object_t *log, int codec_id);
 
 #endif
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 4414823..7936953 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -27,6 +27,7 @@
 
 #include <vlc_common.h>
 #include <vlc_fourcc.h>
+#include <vlc_xlib.h>
 #include <assert.h>
 
 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
@@ -473,14 +474,9 @@ static void Delete( vlc_va_t *p_external )
 }
 
 /* */
-vlc_va_t *vlc_va_NewVaapi( int i_codec_id )
+vlc_va_t *vlc_va_NewVaapi( vlc_object_t *obj, int i_codec_id )
 {
-    bool fail;
-
-    vlc_global_lock( VLC_XLIB_MUTEX );
-    fail = !XInitThreads();
-    vlc_global_unlock( VLC_XLIB_MUTEX );
-    if( unlikely(fail) )
+    if( !vlc_xlib_init( obj ) )
         return NULL;
 
     vlc_va_vaapi_t *p_va = calloc( 1, sizeof(*p_va) );
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 4e3904b..6d5fd5d 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1136,7 +1136,7 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_codec,
             }
 #ifdef HAVE_AVCODEC_VAAPI
             msg_Dbg( p_dec, "Trying VA API" );
-            p_sys->p_va = vlc_va_NewVaapi( p_sys->i_codec_id );
+            p_sys->p_va = vlc_va_NewVaapi( VLC_OBJECT(p_dec), p_sys->i_codec_id );
             if( !p_sys->p_va )
                 msg_Warn( p_dec, "Failed to open VA API" );
 #else



More information about the vlc-commits mailing list