Commit 09622ff6 authored by Jean-Paul Saman's avatar Jean-Paul Saman

codec/avcodec/vaapi: fix vlc_va_Initialize()

Return a pointer to vlc_va_conn_t.
parent 8f8b6c79
......@@ -54,15 +54,15 @@ static vlc_va_conn_t *vlc_va_get_conn( void )
return (vlc_va_conn_t *) &vlc_va_conn;
}
int vlc_va_Initialize( vlc_va_conn_t *conn, const char *display_name )
vlc_va_conn_t *vlc_va_Initialize( const char *display_name )
{
static bool b_va_inited = false;
assert(conn == NULL);
/* connect global to caller */
conn = vlc_va_get_conn();
vlc_va_conn_t *conn = vlc_va_get_conn();
assert(conn);
if (b_va_inited)
return VLC_SUCCESS;
return conn;
/* Create a VA display */
conn->p_display_x11 = XOpenDisplay(display_name);
......@@ -78,10 +78,10 @@ int vlc_va_Initialize( vlc_va_conn_t *conn, const char *display_name )
conn->i_ref_count++;
b_va_inited = true;
return VLC_SUCCESS;
return conn;
error:
return VLC_EGENERIC;
return NULL;
}
void vlc_va_Terminate( vlc_va_conn_t *conn )
......
......@@ -77,7 +77,7 @@ struct vlc_va_conn_t
int i_ref_count; /* for internal use only */
};
int vlc_va_Initialize(vlc_va_conn_t *conn, const char *display_name);
vlc_va_conn_t *vlc_va_Initialize(const char *display_name);
void vlc_va_Terminate(vlc_va_conn_t *conn);
struct picture_sys_t
......
......@@ -128,7 +128,8 @@ static int Open( vlc_va_vaapi_t *p_va, int i_codec_id )
p_va->image.image_id = VA_INVALID_ID;
/* Create a VA display */
if( vlc_va_Initialize( p_va->conn, NULL ) != VLC_SUCCESS )
p_va->conn = vlc_va_Initialize(NULL);
if (!p_va->conn)
goto error;
/* Create a VA configuration */
......
......@@ -211,7 +211,8 @@ int OpenVaapiX11 (vlc_object_t *obj)
goto error;
/* Create a VA display */
if( vlc_va_Initialize( sys->conn, sys->embed->display.x11 ) != VLC_SUCCESS )
sys->conn = vlc_va_Initialize(sys->embed->display.x11);
if (!sys->conn)
goto error;
if (CreateWindow(vd) != VLC_SUCCESS)
......
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