[vlc-commits] vout: direct3d: add a header to share common callbacks for rendering
Steve Lhomme
git at videolan.org
Thu May 9 15:31:05 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue May 7 15:20:06 2019 +0200| [3b948bc4c91e7d188f28d088cfe3a58111e57da4] | committer: Steve Lhomme
vout: direct3d: add a header to share common callbacks for rendering
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b948bc4c91e7d188f28d088cfe3a58111e57da4
---
modules/video_output/win32/d3d_render.h | 50 +++++++++++++++++++++++++++++++++
modules/video_output/win32/direct3d11.c | 28 ++++--------------
modules/video_output/win32/direct3d9.c | 28 ++++--------------
3 files changed, 62 insertions(+), 44 deletions(-)
diff --git a/modules/video_output/win32/d3d_render.h b/modules/video_output/win32/d3d_render.h
new file mode 100644
index 0000000000..5c331df988
--- /dev/null
+++ b/modules/video_output/win32/d3d_render.h
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * d3d_render.h: Direct3D Render callbacks
+ *****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * Authors: Steve Lhomme <robux4 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_D3D_RENDER_H
+#define VLC_D3D_RENDER_H
+
+struct device_cfg_t {
+ bool hardware_decoding;
+};
+
+struct device_setup_t {
+ void *device_context;
+};
+
+struct direct3d_cfg_t {
+ unsigned width;
+ unsigned height;
+};
+
+struct output_cfg_t {
+ int surface_format;
+};
+
+typedef bool (*d3d_device_setup_cb)(void* opaque, const struct device_cfg_t*, struct device_setup_t* );
+typedef void (*d3d_device_cleanup_cb)(void* opaque);
+typedef bool (*d3d_update_output_cb)(void* opaque, const struct direct3d_cfg_t *cfg, struct output_cfg_t *out);
+typedef void (*d3d_swap_cb)(void* opaque);
+typedef bool (*d3d_start_end_rendering_cb)(void* opaque, bool enter);
+
+
+#endif /* VLC_D3D_RENDER_H */
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index ff40d17ffc..3ff727cabf 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -52,6 +52,7 @@
#include "../../video_chroma/d3d11_fmt.h"
#include "d3d11_quad.h"
#include "d3d11_shaders.h"
+#include "d3d_render.h"
#include "common.h"
#include "../video_chroma/copy.h"
@@ -99,23 +100,6 @@ struct d3d11_local_swapchain
ID3D11RenderTargetView *swapchainTargetView[D3D11_MAX_RENDER_TARGET];
};
-struct device_cfg_t {
- bool hardware_decoding;
-};
-
-struct device_setup_t {
- ID3D11DeviceContext *device_context;
-};
-
-struct direct3d_cfg_t {
- unsigned width;
- unsigned height;
-};
-
-struct output_cfg_t {
- DXGI_FORMAT surface_format;
-};
-
struct vout_display_sys_t
{
vout_display_sys_win32_t sys; /* only use if sys.event is not NULL */
@@ -152,11 +136,11 @@ struct vout_display_sys_t
/* outside rendering */
void *outside_opaque;
- bool (*setupDeviceCb)(void* opaque, const struct device_cfg_t*, struct device_setup_t* );
- void (*cleanupDeviceCb)(void* opaque);
- bool (*updateOutputCb)(void* opaque, const struct direct3d_cfg_t *cfg, struct output_cfg_t *out);
- void (*swapCb)(void* opaque);
- bool (*startEndRenderingCb)(void* opaque, bool enter);
+ d3d_device_setup_cb setupDeviceCb;
+ d3d_device_cleanup_cb cleanupDeviceCb;
+ d3d_update_output_cb updateOutputCb;
+ d3d_swap_cb swapCb;
+ d3d_start_end_rendering_cb startEndRenderingCb;
};
static picture_pool_t *Pool(vout_display_t *, unsigned);
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 9c93129d72..6e46d01168 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -53,6 +53,7 @@
#include "common.h"
#include "builtin_shaders.h"
#include "../video_chroma/copy.h"
+#include "d3d_render.h"
#include <assert.h>
@@ -134,23 +135,6 @@ typedef struct
uint32_t bmask;
} d3d9_format_t;
-struct device_cfg_t {
- bool hardware_decoding;
-};
-
-struct device_setup_t {
- IDirect3DDevice9 *device_context;
-};
-
-struct direct3d_cfg_t {
- unsigned width;
- unsigned height;
-};
-
-struct output_cfg_t {
- int surface_format;
-};
-
struct vout_display_sys_t
{
vout_display_sys_win32_t sys; /* only use if sys.event is not NULL */
@@ -182,11 +166,11 @@ struct vout_display_sys_t
/* outside rendering */
void *outside_opaque;
- bool (*setupDeviceCb)(void *opaque, const struct device_cfg_t*, struct device_setup_t* );
- void (*cleanupDeviceCb)(void* opaque);
- bool (*updateOutputCb)(void* opaque, const struct direct3d_cfg_t *, struct output_cfg_t *out);
- void (*swapCb)(void* opaque);
- bool (*startEndRenderingCb)(void* opaque, bool enter);
+ d3d_device_setup_cb setupDeviceCb;
+ d3d_device_cleanup_cb cleanupDeviceCb;
+ d3d_update_output_cb updateOutputCb;
+ d3d_swap_cb swapCb;
+ d3d_start_end_rendering_cb startEndRenderingCb;
};
/* */
More information about the vlc-commits
mailing list