vlc | branch: master | Steve Lhomme <[email protected]> | Fri Sep 20 11:10:51 2019 +0200| [f848d11bb8e84dbb53a4c270562d4a4bcece3823] | committer: Steve Lhomme
opengl: pass the video context rather than the decoder device > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f848d11bb8e84dbb53a4c270562d4a4bcece3823 --- modules/hw/nvdec/nvdec_gl.c | 2 +- modules/video_output/opengl/converter.h | 4 ++-- modules/video_output/opengl/converter_vaapi.c | 11 +++++++---- modules/video_output/opengl/converter_vdpau.c | 14 +++++++++----- modules/video_output/opengl/vout_helper.c | 2 +- modules/video_output/win32/direct3d9.c | 2 +- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/modules/hw/nvdec/nvdec_gl.c b/modules/hw/nvdec/nvdec_gl.c index 0259ea2bb0..e9def3e54a 100644 --- a/modules/hw/nvdec/nvdec_gl.c +++ b/modules/hw/nvdec/nvdec_gl.c @@ -157,7 +157,7 @@ static int Open(vlc_object_t *obj) if (!is_nvdec_opaque(tc->fmt.i_chroma)) return VLC_EGENERIC; - vlc_decoder_device *device = tc->dec_device; + vlc_decoder_device *device = tc->vctx->device; if (device == NULL || device->type != VLC_DECODER_DEVICE_NVDEC) return VLC_EGENERIC; device = vlc_decoder_device_Hold(device); diff --git a/modules/video_output/opengl/converter.h b/modules/video_output/opengl/converter.h index 73dfabeb71..30d7332a85 100644 --- a/modules/video_output/opengl/converter.h +++ b/modules/video_output/opengl/converter.h @@ -259,8 +259,8 @@ struct opengl_tex_converter_t /* Pointer to object gl, set by the caller */ vlc_gl_t *gl; - /* Pointer to decoder device, set by the caller (can be NULL) */ - vlc_decoder_device *dec_device; + /* Pointer to decoder video context, set by the caller (can be NULL) */ + vlc_video_context *vctx; /* libplacebo context, created by the caller (optional) */ struct pl_context *pl_ctx; diff --git a/modules/video_output/opengl/converter_vaapi.c b/modules/video_output/opengl/converter_vaapi.c index 144c3d940c..d529d8e8e0 100644 --- a/modules/video_output/opengl/converter_vaapi.c +++ b/modules/video_output/opengl/converter_vaapi.c @@ -224,8 +224,9 @@ tc_vaegl_get_pool(const opengl_tex_converter_t *tc, unsigned requested_count) vlc_object_t *o = VLC_OBJECT(tc->gl); struct priv *priv = tc->priv; + vlc_decoder_device *dec_device = tc->vctx->device; picture_pool_t *pool = - vlc_vaapi_PoolNew(VLC_OBJECT(tc->gl), tc->dec_device, priv->vadpy, + vlc_vaapi_PoolNew(VLC_OBJECT(tc->gl), dec_device, priv->vadpy, requested_count, &priv->va_surface_ids, &tc->fmt, true); if (!pool) @@ -330,8 +331,10 @@ Open(vlc_object_t *obj) { opengl_tex_converter_t *tc = (void *) obj; - if (tc->dec_device == NULL - || tc->dec_device->type != VLC_DECODER_DEVICE_VAAPI + if (tc->vctx == NULL) + return VLC_EGENERIC; + vlc_decoder_device *dec_device = tc->vctx->device; + if (dec_device->type != VLC_DECODER_DEVICE_VAAPI || !vlc_vaapi_IsChromaOpaque(tc->fmt.i_chroma) || tc->gl->ext != VLC_GL_EXT_EGL || tc->gl->egl.createImageKHR == NULL @@ -374,7 +377,7 @@ Open(vlc_object_t *obj) if (priv->glEGLImageTargetTexture2DOES == NULL) goto error; - priv->vadpy = tc->dec_device->opaque; + priv->vadpy = dec_device->opaque; assert(priv->vadpy != NULL); if (tc_va_check_interop_blacklist(tc, priv->vadpy)) diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c index ce43b5621d..296c47adaf 100644 --- a/modules/video_output/opengl/converter_vdpau.c +++ b/modules/video_output/opengl/converter_vdpau.c @@ -62,7 +62,8 @@ static picture_pool_t * tc_vdpau_gl_get_pool(opengl_tex_converter_t const *tc, unsigned int requested_count) { - return vlc_vdp_output_pool_create(tc->dec_device->opaque, + vlc_decoder_device *dec_device = tc->vctx->device; + return vlc_vdp_output_pool_create(dec_device->opaque, VDP_RGBA_FORMAT_B8G8R8A8, &tc->fmt, requested_count); } @@ -112,15 +113,18 @@ Close(vlc_object_t *obj) { opengl_tex_converter_t *tc = (void *)obj; _glVDPAUFiniNV(); assert(tc->vt->GetError() == GL_NO_ERROR); - vdp_release_x11(tc->dec_device->opaque); + vlc_decoder_device *dec_device = tc->vctx->device; + vdp_release_x11(dec_device->opaque); } static int Open(vlc_object_t *obj) { opengl_tex_converter_t *tc = (void *) obj; - if (tc->dec_device == NULL - || tc->dec_device->type != VLC_DECODER_DEVICE_VDPAU + if (tc->vctx == NULL) + return VLC_EGENERIC; + vlc_decoder_device *dec_device = tc->vctx->device; + if (dec_device->type != VLC_DECODER_DEVICE_VDPAU || (tc->fmt.i_chroma != VLC_CODEC_VDPAU_VIDEO_420 && tc->fmt.i_chroma != VLC_CODEC_VDPAU_VIDEO_422 && tc->fmt.i_chroma != VLC_CODEC_VDPAU_VIDEO_444) @@ -131,7 +135,7 @@ Open(vlc_object_t *obj) tc->fmt.i_chroma = VLC_CODEC_VDPAU_OUTPUT; VdpDevice device; - vdp_t *vdp = tc->dec_device->opaque; + vdp_t *vdp = dec_device->opaque; vdp_hold_x11(vdp, &device); void *vdp_gpa; diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c index b37b653257..8e692eae5a 100644 --- a/modules/video_output/opengl/vout_helper.c +++ b/modules/video_output/opengl/vout_helper.c @@ -588,7 +588,7 @@ opengl_init_program(vout_display_opengl_t *vgl, vlc_video_context *context, if (desc->plane_count == 0) { /* Opaque chroma: load a module to handle it */ - tc->dec_device = context ? context->device : NULL; + tc->vctx = context; tc->p_module = module_need_var(tc, "glconv", "glconv"); } diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c index 76be7ba2a1..1de80dac74 100644 --- a/modules/video_output/win32/direct3d9.c +++ b/modules/video_output/win32/direct3d9.c @@ -1916,7 +1916,7 @@ GLConvOpen(vlc_object_t *obj) HRESULT hr; int adapter = -1; - d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueDevice( tc->dec_device ); + d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext( tc->vctx ); if ( d3d9_decoder != NULL ) { D3D9_CloneExternal(&priv->hd3d, d3d9_decoder->device); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
