[vlc-devel] [PATCH 1/2] decoder: let the decoder device know it's force created
Steve Lhomme
robux4 at ycbcr.xyz
Wed Sep 18 16:09:16 CEST 2019
When selecting between D3D11 and D3D9 on Windows we need to know if the decoder
device may be optional or not (with external rendering it's not).
---
include/vlc_codec.h | 3 ++-
modules/hw/d3d11/d3d11_device.c | 3 ++-
modules/hw/d3d11/d3d11_filters.h | 2 +-
modules/hw/d3d9/d3d9_device.c | 3 ++-
modules/hw/d3d9/d3d9_filters.h | 2 +-
modules/hw/nvdec/nvdec.c | 5 +++--
modules/hw/vaapi/decoder_device.c | 3 ++-
modules/video_output/opengl/converter_vdpau.c | 3 ++-
src/input/decoder_helpers.c | 3 +--
9 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 28a65846d9e..9e8c8958c49 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -536,10 +536,11 @@ typedef struct vlc_decoder_device
* "decoder device" module open entry point
*
* @param device the "decoder device" structure to initialize
+ * @param forced whether the module is forced loaded or not
* @param window pointer to a window to help device initialization (can be NULL)
**/
typedef int (*vlc_decoder_device_Open)(vlc_decoder_device *device,
- vout_window_t *window);
+ bool forced, vout_window_t *window);
#define set_callback_dec_device(activate, priority) \
{ \
diff --git a/modules/hw/d3d11/d3d11_device.c b/modules/hw/d3d11/d3d11_device.c
index 1d543e2087d..b259be7ba33 100644
--- a/modules/hw/d3d11/d3d11_device.c
+++ b/modules/hw/d3d11/d3d11_device.c
@@ -71,8 +71,9 @@ static const struct vlc_decoder_device_operations d3d11_dev_ops = {
.close = D3D11CloseDecoderDevice,
};
-int D3D11OpenDecoderDevice(vlc_decoder_device *device, vout_window_t *wnd)
+int D3D11OpenDecoderDevice(vlc_decoder_device *device, bool forced, vout_window_t *wnd)
{
+ VLC_UNUSED(forced);
VLC_UNUSED(wnd);
d3d11_decoder_device *sys = vlc_obj_malloc(VLC_OBJECT(device), sizeof(*sys));
if (unlikely(sys==NULL))
diff --git a/modules/hw/d3d11/d3d11_filters.h b/modules/hw/d3d11/d3d11_filters.h
index 0c03523dde3..bc8627613de 100644
--- a/modules/hw/d3d11/d3d11_filters.h
+++ b/modules/hw/d3d11/d3d11_filters.h
@@ -35,7 +35,7 @@ void D3D11CloseConverter(vlc_object_t *);
int D3D11OpenCPUConverter(vlc_object_t *);
void D3D11CloseCPUConverter(vlc_object_t *);
-int D3D11OpenDecoderDevice(vlc_decoder_device *, vout_window_t *);
+int D3D11OpenDecoderDevice(vlc_decoder_device *, bool, vout_window_t *);
void D3D11_FilterHoldInstance(filter_t *, d3d11_device_t *, D3D11_TEXTURE2D_DESC *);
void D3D11_FilterReleaseInstance(d3d11_device_t *);
diff --git a/modules/hw/d3d9/d3d9_device.c b/modules/hw/d3d9/d3d9_device.c
index cd5a2770fad..b30aa06d85e 100644
--- a/modules/hw/d3d9/d3d9_device.c
+++ b/modules/hw/d3d9/d3d9_device.c
@@ -61,9 +61,10 @@ static const struct vlc_decoder_device_operations d3d9_dev_ops = {
.close = D3D9CloseDecoderDevice,
};
-int D3D9OpenDecoderDevice(vlc_decoder_device *device, vout_window_t *wnd)
+int D3D9OpenDecoderDevice(vlc_decoder_device *device, bool forced, vout_window_t *wnd)
{
VLC_UNUSED(wnd);
+ VLC_UNUSED(forced);
d3d9_decoder_device *sys = vlc_obj_malloc(VLC_OBJECT(device), sizeof(*sys));
if (unlikely(sys==NULL))
return VLC_ENOMEM;
diff --git a/modules/hw/d3d9/d3d9_filters.h b/modules/hw/d3d9/d3d9_filters.h
index c313429b9dd..3ec617910a5 100644
--- a/modules/hw/d3d9/d3d9_filters.h
+++ b/modules/hw/d3d9/d3d9_filters.h
@@ -35,7 +35,7 @@ void D3D9CloseConverter(vlc_object_t *);
int D3D9OpenCPUConverter(vlc_object_t *);
void D3D9CloseCPUConverter(vlc_object_t *);
-int D3D9OpenDecoderDevice(vlc_decoder_device *, vout_window_t *);
+int D3D9OpenDecoderDevice(vlc_decoder_device *, bool, vout_window_t *);
void D3D9_FilterHoldInstance(filter_t *, d3d9_device_t *, D3DSURFACE_DESC *);
void D3D9_FilterReleaseInstance(d3d9_device_t *);
diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 00cab2ed46b..9ad790265f6 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -39,7 +39,7 @@
static int OpenDecoder(vlc_object_t *);
static void CloseDecoder(vlc_object_t *);
-static int DecoderContextOpen(vlc_decoder_device *, vout_window_t *);
+static int DecoderContextOpen(vlc_decoder_device *, bool, vout_window_t *);
#define DEINTERLACE_MODULE_TEXT N_("Integrated deinterlacing")
#define DEINTERLACE_MODULE_LONGTEXT N_( "Specify the deinterlace mode to use." )
@@ -941,8 +941,9 @@ static const struct vlc_decoder_device_operations dev_ops = {
};
static int
-DecoderContextOpen(vlc_decoder_device *device, vout_window_t *window)
+DecoderContextOpen(vlc_decoder_device *device, bool forced, vout_window_t *window)
{
+ VLC_UNUSED(forced);
VLC_UNUSED(window);
decoder_device_nvdec_t *p_sys = vlc_obj_malloc(VLC_OBJECT(device), sizeof(*p_sys));
diff --git a/modules/hw/vaapi/decoder_device.c b/modules/hw/vaapi/decoder_device.c
index bde1e621152..eb7cf0ce307 100644
--- a/modules/hw/vaapi/decoder_device.c
+++ b/modules/hw/vaapi/decoder_device.c
@@ -221,8 +221,9 @@ static const struct vlc_decoder_device_operations ops = {
};
static int
-Open(vlc_decoder_device *device, vout_window_t *window)
+Open(vlc_decoder_device *device, bool forced, vout_window_t *window)
{
+ VLC_UNUSED(forced);
VADisplay vadpy = NULL;
struct vaapi_instance *vainst = NULL;
#if defined (HAVE_VA_X11)
diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index ce43b5621d8..8848eb046a2 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -189,8 +189,9 @@ static const struct vlc_decoder_device_operations dev_ops = {
};
static int
-DecoderContextOpen(vlc_decoder_device *device, vout_window_t *window)
+DecoderContextOpen(vlc_decoder_device *device, bool forced, vout_window_t *window)
{
+ VLC_UNUSED(forced);
if (!window || !vlc_xlib_init(VLC_OBJECT(window)))
return VLC_EGENERIC;
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 6d5b0050ed7..115f82f7d74 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -104,7 +104,7 @@ static int decoder_device_Open(void *func, bool forced, va_list ap)
vlc_decoder_device_Open open = func;
vlc_decoder_device *device = va_arg(ap, vlc_decoder_device *);
vout_window_t *window = va_arg(ap, vout_window_t *);
- int ret = open(device, window);
+ int ret = open(device, forced, window);
if (ret != VLC_SUCCESS)
{
struct vlc_decoder_device_priv *priv =
@@ -119,7 +119,6 @@ static int decoder_device_Open(void *func, bool forced, va_list ap)
{
assert(device->type != VLC_DECODER_DEVICE_NONE);
}
- (void) forced;
return ret;
}
--
2.17.1
More information about the vlc-devel
mailing list