bool b_supports_derive;
};
-/* */
static void DestroySurfaces( vlc_va_sys_t *sys )
{
if( sys->image.image_id != VA_INVALID_ID )
return VLC_EGENERIC;
}
-static void Close( vlc_va_sys_t *sys )
+static void Delete( vlc_va_t *va )
{
+ vlc_va_sys_t *sys = va->sys;
+
if( sys->i_surface_width || sys->i_surface_height )
DestroySurfaces( sys );
#ifdef VLC_VA_BACKEND_DRM
close( sys->drm_fd );
#endif
-}
-
-static void Delete( vlc_va_t *va )
-{
- vlc_va_sys_t *sys = va->sys;
- Close( sys );
free( sys );
}
-static int Open( vlc_va_t *va, int i_codec_id, int i_thread_count )
+static int Create( vlc_va_t *va, AVCodecContext *ctx, const es_format_t *fmt )
{
+ (void) fmt;
+#ifdef VLC_VA_BACKEND_XLIB
+ if( !vlc_xlib_init( VLC_OBJECT(va) ) )
+ {
+ msg_Warn( va, "Ignoring VA-X11 API" );
+ return VLC_EGENERIC;
+ }
+#endif
+
vlc_va_sys_t *sys = calloc( 1, sizeof(*sys) );
if ( unlikely(sys == NULL) )
return VLC_ENOMEM;
int i_surface_count;
/* */
- switch( i_codec_id )
+ switch( ctx->codec_id )
{
case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO:
break;
case AV_CODEC_ID_H264:
i_profile = VAProfileH264High;
- i_surface_count = 16 + i_thread_count + 2;
+ i_surface_count = 16 + ctx->thread_count + 2;
break;;
default:
free( sys );
va->sys = sys;
va->description = vaQueryVendorString( sys->p_display );
+ va->pix_fmt = PIX_FMT_VAAPI_VLD; /* Only VLD supported */
+ va->setup = Setup;
+ va->get = Get;
+ va->release = Release;
+ va->extract = Extract;
return VLC_SUCCESS;
error:
return VLC_EGENERIC;
}
-static int Create( vlc_va_t *p_va, AVCodecContext *ctx,
- const es_format_t *fmt )
-{
-#ifdef VLC_VA_BACKEND_XLIB
- if( !vlc_xlib_init( VLC_OBJECT(p_va) ) )
- {
- msg_Warn( p_va, "Ignoring VA API" );
- return VLC_EGENERIC;
- }
-#endif
-
- (void) fmt;
-
- int err = Open( p_va, ctx->codec_id, ctx->thread_count );
- if( err )
- return err;
-
- /* Only VLD supported */
- p_va->pix_fmt = PIX_FMT_VAAPI_VLD;
- p_va->setup = Setup;
- p_va->get = Get;
- p_va->release = Release;
- p_va->extract = Extract;
- return VLC_SUCCESS;
-}
-
vlc_module_begin ()
#if defined (VLC_VA_BACKEND_XLIB)
set_description( N_("VA-API video decoder via X11") )