[vlc-commits] d3d11_fmt: share the code to release the picture_sys_t data
Steve Lhomme
git at videolan.org
Fri May 12 16:42:12 CEST 2017
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu May 11 09:36:03 2017 +0200| [af9f93f97e94e53d28646922e98d2d085eb4f6c6] | committer: Jean-Baptiste Kempf
d3d11_fmt: share the code to release the picture_sys_t data
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af9f93f97e94e53d28646922e98d2d085eb4f6c6
---
modules/video_chroma/d3d11_fmt.h | 26 ++++++++++++++++++++++++++
modules/video_output/win32/direct3d11.c | 32 +++-----------------------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 3bf004a119..aa43c46d08 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -48,4 +48,30 @@ struct picture_sys_t
* (ie not DXGI_FORMAT_UNKNWON) */
#define KNOWN_DXGI_INDEX 0
+static inline void ReleasePictureSys(picture_sys_t *p_sys)
+{
+ for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++) {
+ if (p_sys->resourceView[i]) {
+ ID3D11ShaderResourceView_Release(p_sys->resourceView[i]);
+ p_sys->resourceView[i] = NULL;
+ }
+ if (p_sys->texture[i]) {
+ ID3D11Texture2D_Release(p_sys->texture[i]);
+ p_sys->texture[i] = NULL;
+ }
+ }
+ if (p_sys->context) {
+ ID3D11DeviceContext_Release(p_sys->context);
+ p_sys->context = NULL;
+ }
+ if (p_sys->decoder) {
+ ID3D11VideoDecoderOutputView_Release(p_sys->decoder);
+ p_sys->decoder = NULL;
+ }
+ if (p_sys->processorInput) {
+ ID3D11VideoProcessorInputView_Release(p_sys->processorInput);
+ p_sys->processorInput = NULL;
+ }
+}
+
#endif /* include-guard */
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 8b24ad4870..e9fcb83dca 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -855,36 +855,10 @@ error:
return sys->sys.pool;
}
-static void ReleasePictureResources(picture_sys_t *p_sys)
-{
- for (int i=0; i<D3D11_MAX_SHADER_VIEW; i++) {
- if (p_sys->resourceView[i]) {
- ID3D11ShaderResourceView_Release(p_sys->resourceView[i]);
- p_sys->resourceView[i] = NULL;
- }
- if (p_sys->texture[i]) {
- ID3D11Texture2D_Release(p_sys->texture[i]);
- p_sys->texture[i] = NULL;
- }
- }
- if (p_sys->context) {
- ID3D11DeviceContext_Release(p_sys->context);
- p_sys->context = NULL;
- }
- if (p_sys->decoder) {
- ID3D11VideoDecoderOutputView_Release(p_sys->decoder);
- p_sys->decoder = NULL;
- }
- if (p_sys->processorInput) {
- ID3D11VideoProcessorInputView_Release(p_sys->processorInput);
- p_sys->processorInput = NULL;
- }
-}
-
static void DestroyDisplayPoolPicture(picture_t *picture)
{
picture_sys_t *p_sys = picture->p_sys;
- ReleasePictureResources( p_sys );
+ ReleasePictureSys( p_sys );
free(p_sys);
free(picture);
}
@@ -2640,7 +2614,7 @@ static void ReleaseQuad(d3d_quad_t *quad)
ID3D11Buffer_Release(quad->pVertexShaderConstants);
quad->pVertexShaderConstants = NULL;
}
- ReleasePictureResources(&quad->picSys);
+ ReleasePictureSys(&quad->picSys);
}
static void Direct3D11DestroyResources(vout_display_t *vd)
@@ -2653,7 +2627,7 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
Direct3D11DeleteRegions(sys->d3dregion_count, sys->d3dregions);
sys->d3dregion_count = 0;
- ReleasePictureResources(&sys->stagingSys);
+ ReleasePictureSys(&sys->stagingSys);
if (sys->flatVSShader)
{
More information about the vlc-commits
mailing list