[vlc-devel] [PATCH 06/31] decoder: let the decoder device know it's force created
Rémi Denis-Courmont
remi at remlab.net
Sat Jul 6 17:01:23 CEST 2019
Hi,
That won't work properly if the "dec-dev" module list has more than one element. Using the force flag is rarely a good idea, if ever.
Le 5 juillet 2019 17:19:45 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>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/d3d9/d3d9_device.c | 3 ++-
> modules/hw/d3d9/d3d9_filters.h | 2 +-
> modules/hw/vaapi/decoder_device.c | 3 ++-
> modules/video_output/opengl/converter_vdpau.c | 3 ++-
> modules/video_output/win32/direct3d9.c | 5 +++--
> src/input/decoder_helpers.c | 3 +--
> 7 files changed, 13 insertions(+), 9 deletions(-)
>
>diff --git a/include/vlc_codec.h b/include/vlc_codec.h
>index 223550ce9c..a2f81756b5 100644
>--- a/include/vlc_codec.h
>+++ b/include/vlc_codec.h
>@@ -527,10 +527,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);
> /** "decoder device" module close entry point */
> typedef void (*vlc_decoder_device_Close)(vlc_decoder_device *device);
>
>diff --git a/modules/hw/d3d9/d3d9_device.c
>b/modules/hw/d3d9/d3d9_device.c
>index aefc813b7a..acf7c31475 100644
>--- a/modules/hw/d3d9/d3d9_device.c
>+++ b/modules/hw/d3d9/d3d9_device.c
>@@ -47,8 +47,9 @@ typedef struct {
> d3d9_decoder_device_t dec_device;
> } d3d9_decoder_device;
>
>-int D3D9OpenDecoderDevice(vlc_decoder_device *device, vout_window_t
>*wnd)
>+int D3D9OpenDecoderDevice(vlc_decoder_device *device, bool forced,
>vout_window_t *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 7819b12782..189c76f9f6 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 D3D9CloseDecoderDevice(vlc_decoder_device *);
>
>void D3D9_FilterHoldInstance(filter_t *, d3d9_device_t *,
>D3DSURFACE_DESC *);
>diff --git a/modules/hw/vaapi/decoder_device.c
>b/modules/hw/vaapi/decoder_device.c
>index 5efe9e635b..e9f1e514f8 100644
>--- a/modules/hw/vaapi/decoder_device.c
>+++ b/modules/hw/vaapi/decoder_device.c
>@@ -217,8 +217,9 @@ Close(vlc_decoder_device *device)
> }
>
> 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 d40d5d181f..b76878a05d 100644
>--- a/modules/video_output/opengl/converter_vdpau.c
>+++ b/modules/video_output/opengl/converter_vdpau.c
>@@ -185,8 +185,9 @@ DecoderContextClose(vlc_decoder_device *device)
> }
>
> 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/modules/video_output/win32/direct3d9.c
>b/modules/video_output/win32/direct3d9.c
>index e625c22d48..7fafcb7a07 100644
>--- a/modules/video_output/win32/direct3d9.c
>+++ b/modules/video_output/win32/direct3d9.c
>@@ -73,7 +73,7 @@ static int Open(vout_display_t *, const
>vout_display_cfg_t *,
> video_format_t *, vlc_video_context *);
> static void Close(vout_display_t *);
>
>-static int OpenD3D9DecoderDevice(vlc_decoder_device *, vout_window_t
>*);
>+static int OpenD3D9DecoderDevice(vlc_decoder_device *, bool,
>vout_window_t *);
> static void CloseD3D9DecoderDevice(vlc_decoder_device *);
>
> static int GLConvOpen(vlc_object_t *);
>@@ -1995,9 +1995,10 @@ struct local_render_device
> d3d9_decoder_device_t device;
> };
>
>-static int OpenD3D9DecoderDevice(vlc_decoder_device *device,
>vout_window_t *wnd)
>+static int OpenD3D9DecoderDevice(vlc_decoder_device *device, bool
>forced, vout_window_t *wnd)
> {
> VLC_UNUSED(wnd);
>+ VLC_UNUSED(forced);
>struct local_render_device *display =
>vlc_obj_calloc(VLC_OBJECT(device), 1, sizeof(*display));
> if (unlikely(display == NULL))
> return VLC_ENOMEM;
>diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
>index 7384e2bda0..f484180371 100644
>--- a/src/input/decoder_helpers.c
>+++ b/src/input/decoder_helpers.c
>@@ -105,7 +105,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)
> {
> device->sys = NULL;
>@@ -116,7 +116,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
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190706/1b679eaf/attachment.html>
More information about the vlc-devel
mailing list