[vlc-devel] [PATCH 23/36] vaapi: chroma: get the decoder device using filter_HoldDecoderDevice()
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 21 15:14:14 CET 2019
Rather than the legacy vlc_vaapi_FilterHoldInstance().
The VADisplay is stored in the decoder device opaque.
---
modules/hw/vaapi/chroma.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/modules/hw/vaapi/chroma.c b/modules/hw/vaapi/chroma.c
index 62a7b5ebf15..00d213e9588 100644
--- a/modules/hw/vaapi/chroma.c
+++ b/modules/hw/vaapi/chroma.c
@@ -345,14 +345,20 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
filter_sys->image_fallback_failed = false;
if (is_upload)
{
- filter_sys->dec_device = vlc_vaapi_FilterHoldInstance(filter,
- &filter_sys->dpy);
-
+ filter_sys->dec_device = filter_HoldDecoderDevice( filter );
if (filter_sys->dec_device == NULL)
{
free(filter_sys);
return VLC_EGENERIC;
}
+ if (filter_sys->dec_device->type != VLC_DECODER_DEVICE_VAAPI)
+ {
+ vlc_decoder_device_Release(filter_sys->dec_device);
+ free(filter_sys);
+ return VLC_EGENERIC;
+ }
+
+ filter_sys->dpy = filter_sys->dec_device->opaque;
filter->vctx_out = vlc_video_context_Create( filter_sys->dec_device, VLC_VIDEO_CONTEXT_VAAPI, 0, NULL );
@@ -362,7 +368,7 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
&filter->fmt_out.video);
if (!filter_sys->dest_pics)
{
- vlc_vaapi_FilterReleaseInstance(filter, filter_sys->dec_device);
+ vlc_decoder_device_Release(filter_sys->dec_device);
vlc_video_context_Release(filter->vctx_out);
filter->vctx_out = NULL;
free(filter_sys);
@@ -384,7 +390,7 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
if (is_upload)
{
picture_pool_Release(filter_sys->dest_pics);
- vlc_vaapi_FilterReleaseInstance(filter, filter_sys->dec_device);
+ vlc_decoder_device_Release(filter_sys->dec_device);
vlc_video_context_Release(filter->vctx_out);
filter->vctx_out = NULL;
}
@@ -411,7 +417,7 @@ vlc_vaapi_CloseChroma(vlc_object_t *obj)
if (filter_sys->dest_pics)
picture_pool_Release(filter_sys->dest_pics);
if (filter_sys->dec_device != NULL)
- vlc_vaapi_FilterReleaseInstance(filter, filter_sys->dec_device);
+ vlc_decoder_device_Release(filter_sys->dec_device);
CopyCleanCache(&filter_sys->cache);
if (filter->vctx_out)
vlc_video_context_Release(filter->vctx_out);
--
2.17.1
More information about the vlc-devel
mailing list