Commit e9f34b05 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

VAAPI: use vlc_xlib_init()

parent 595d1057
...@@ -58,7 +58,7 @@ static inline void vlc_va_Delete(vlc_va_t *va) ...@@ -58,7 +58,7 @@ static inline void vlc_va_Delete(vlc_va_t *va)
va->close(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); vlc_va_t *vlc_va_NewDxva2(vlc_object_t *log, int codec_id);
#endif #endif
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_fourcc.h> #include <vlc_fourcc.h>
#include <vlc_xlib.h>
#include <assert.h> #include <assert.h>
#ifdef HAVE_LIBAVCODEC_AVCODEC_H #ifdef HAVE_LIBAVCODEC_AVCODEC_H
...@@ -473,14 +474,9 @@ static void Delete( vlc_va_t *p_external ) ...@@ -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; if( !vlc_xlib_init( obj ) )
vlc_global_lock( VLC_XLIB_MUTEX );
fail = !XInitThreads();
vlc_global_unlock( VLC_XLIB_MUTEX );
if( unlikely(fail) )
return NULL; return NULL;
vlc_va_vaapi_t *p_va = calloc( 1, sizeof(*p_va) ); vlc_va_vaapi_t *p_va = calloc( 1, sizeof(*p_va) );
......
...@@ -1136,7 +1136,7 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_codec, ...@@ -1136,7 +1136,7 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_codec,
} }
#ifdef HAVE_AVCODEC_VAAPI #ifdef HAVE_AVCODEC_VAAPI
msg_Dbg( p_dec, "Trying VA API" ); 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 ) if( !p_sys->p_va )
msg_Warn( p_dec, "Failed to open VA API" ); msg_Warn( p_dec, "Failed to open VA API" );
#else #else
......
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