[vlc-commits] vaapi: use the decoder device to get the VADisplay

Steve Lhomme git at videolan.org
Fri Oct 18 09:47:11 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Sep 20 14:24:44 2019 +0200| [71a196facfba7f433fe43898c2ed0913d489669b] | committer: Steve Lhomme

vaapi: use the decoder device to get the VADisplay

And remove the locally held decoder device that used to come from the
picture_sys_t.

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

 modules/codec/avcodec/vaapi.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 87c67b79aa..2b2783e559 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -50,7 +50,6 @@
 
 struct vlc_va_sys_t
 {
-    vlc_decoder_device *dec_device;
     struct vaapi_context hw_ctx;
 };
 
@@ -139,7 +138,6 @@ static void Delete(vlc_va_t *va)
 
     vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
     vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
-    vlc_decoder_device_Release(sys->dec_device);
     free(sys);
 }
 
@@ -147,10 +145,11 @@ static const struct vlc_va_operations ops = { Get, Delete, };
 
 static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc,
                   enum PixelFormat pix_fmt,
-                  const es_format_t *fmt, void *p_sys, vlc_decoder_device *device)
+                  const es_format_t *fmt, void *p_sys, vlc_decoder_device *dec_device)
 {
     VLC_UNUSED(desc);
-    if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || p_sys == NULL)
+    if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || dec_device == NULL ||
+        dec_device->type != VLC_DECODER_DEVICE_VAAPI)
         return VLC_EGENERIC;
 
     vlc_va_sys_t *sys = malloc(sizeof *sys);
@@ -162,10 +161,7 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
 
     int ret = VLC_EGENERIC;
 
-    /* The picture must be allocated by the vout */
-    VADisplay va_dpy;
-    vlc_decoder_device *dec_device =
-        vlc_vaapi_PicSysHoldInstance(p_sys, &va_dpy);
+    VADisplay va_dpy = dec_device->opaque;
 
     VASurfaceID *render_targets;
     unsigned num_render_targets;
@@ -183,7 +179,6 @@ static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *d
         goto error;
 
     /* */
-    sys->dec_device = dec_device;
     sys->hw_ctx.display = va_dpy;
     sys->hw_ctx.config_id = VA_INVALID_ID;
     sys->hw_ctx.context_id = VA_INVALID_ID;
@@ -215,7 +210,6 @@ error:
     if (sys->hw_ctx.config_id != VA_INVALID_ID)
         vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
     free(sys);
-    vlc_decoder_device_Release(dec_device);
     return ret;
 }
 



More information about the vlc-commits mailing list