[vlc-devel] [PATCH 1/7] decoder: pass the chroma to decode to the decoder device
Thomas Guillem
thomas at gllm.fr
Wed Jun 26 16:06:08 CEST 2019
Question: The decoder device should not be constant to the window and not depends on the decoder ?
This patch could be more readable if you move the vlc_decoder_device_Create() call to its definite place (Just after the window creation).
On Wed, Jun 26, 2019, at 15:50, Steve Lhomme wrote:
> On Windows the default decoder device to use would be the D3D11 one, but if the
> source chroma to decode (in push or not) is a DXVA2 chroma we should be using
> a D3D9 decoder device. The D3D11 decoder device needs to have that information
> so it can refuse to be created by default.
> ---
> include/vlc_codec.h | 6 ++++--
> modules/hw/vaapi/decoder_device.c | 3 ++-
> modules/video_output/opengl/converter_vdpau.c | 3 ++-
> src/input/decoder_helpers.c | 7 ++++---
> src/video_output/display.c | 2 +-
> 5 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/include/vlc_codec.h b/include/vlc_codec.h
> index 86f092c029..a421c6d710 100644
> --- a/include/vlc_codec.h
> +++ b/include/vlc_codec.h
> @@ -528,9 +528,11 @@ typedef struct vlc_decoder_device
> *
> * @param device the "decoder device" structure to initialize
> * @param window pointer to a window to help device initialization
> (can be NULL)
> + * @param chroma hint on the chroma what will be decoded
> **/
> typedef int (*vlc_decoder_device_Open)(vlc_decoder_device *device,
> - vout_window_t *window);
> + vout_window_t *window,
> + vlc_fourcc_t chroma);
> /** "decoder device" module close entry point */
> typedef void (*vlc_decoder_device_Close)(vlc_decoder_device *device);
>
> @@ -541,7 +543,7 @@ typedef void
> (*vlc_decoder_device_Close)(vlc_decoder_device *device);
> * module as a transition.
> */
> VLC_USED vlc_decoder_device *
> -vlc_decoder_device_Create(vout_window_t *window);
> +vlc_decoder_device_Create(vout_window_t *window, const video_format_t
> *);
>
> /**
> * Hold a decoder device
> diff --git a/modules/hw/vaapi/decoder_device.c
> b/modules/hw/vaapi/decoder_device.c
> index 5efe9e635b..00d654d245 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, vout_window_t *window, vlc_fourcc_t
> chroma)
> {
> + VLC_UNUSED(chroma);
> 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..3363a38ca1 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, vout_window_t *window,
> vlc_fourcc_t chroma)
> {
> + VLC_UNUSED(chroma);
> 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 7384e2bda0..35a291921d 100644
> --- a/src/input/decoder_helpers.c
> +++ b/src/input/decoder_helpers.c
> @@ -105,7 +105,8 @@ 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);
> + vlc_fourcc_t chroma = va_arg(ap, vlc_fourcc_t);
> + int ret = open(device, window, chroma);
> if (ret != VLC_SUCCESS)
> {
> device->sys = NULL;
> @@ -128,7 +129,7 @@ static void decoder_device_Close(void *func,
> va_list ap)
> }
>
> vlc_decoder_device *
> -vlc_decoder_device_Create(vout_window_t *window)
> +vlc_decoder_device_Create(vout_window_t *window, const video_format_t *fmt)
> {
> struct vlc_decoder_device_priv *priv =
> vlc_object_create(window, sizeof (*priv));
> @@ -137,7 +138,7 @@ vlc_decoder_device_Create(vout_window_t *window)
> char *name = var_InheritString(window, "dec-dev");
> priv->module = vlc_module_load(&priv->device, "decoder device", name,
> true, decoder_device_Open, &priv->device,
> - window);
> + window, fmt->i_chroma);
> free(name);
> if (!priv->module)
> {
> diff --git a/src/video_output/display.c b/src/video_output/display.c
> index 2173bb084e..b0c5ee8ad1 100644
> --- a/src/video_output/display.c
> +++ b/src/video_output/display.c
> @@ -777,7 +777,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
> vd->sys = NULL;
> vd->owner = *owner;
>
> - osys->video_context.device =
> vlc_decoder_device_Create(osys->cfg.window);
> + osys->video_context.device =
> vlc_decoder_device_Create(osys->cfg.window, source);
> vlc_video_context *video_context = osys->video_context.device ?
> &osys->video_context : NULL;
>
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list