[vlc-devel] [PATCH 01/11] decoder: use an object to create the decoder device

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 8 15:12:42 CET 2019


On 2019-11-08 14:54, Rémi Denis-Courmont wrote:
> This works to create a device out of nothing, but presumably the goal is 
> to create a device out of an encoder, not nothing. So this does in fact 
> not work.

No, the goal is to create an encoder out of a hardware device when 
possible (unfortunately named "decoder device") and fall back to 
software if it doesn't work. The encoder will request a "hardware 
device" to use and if there's one it can use will use it. Software 
encoders will not request a hardware device, just like Software decoders 
don't request a decoder device.

> Le 4 novembre 2019 21:05:20 GMT+09:00, Steve Lhomme <robux4 at ycbcr.xyz> a 
> écrit :
> 
>     Allowing the window to be NULL, which is OK for D3D11/D3D9/NVDEC.
>     ------------------------------------------------------------------------
>       include/vlc_codec.h             | 6 ++++--
>       src/input/decoder_helpers.c     | 7 ++++---
>       src/video_output/video_output.c | 2 +-
>       3 files changed, 9 insertions(+), 6 deletions(-)
> 
>     diff --git a/include/vlc_codec.h b/include/vlc_codec.h
>     index 6649ef94cc2..c0394522aae 100644
>     --- a/include/vlc_codec.h
>     +++ b/include/vlc_codec.h
>     @@ -604,8 +604,10 @@ typedef int (*vlc_decoder_device_Open)(vlc_decoder_device *device,
>        * This function will be hidden in the future. It is now used by opengl vout
>        * module as a transition.
>        */
>     -VLC_USED vlc_decoder_device *
>     -vlc_decoder_device_Create(vout_window_t *window);
>     +vlc_decoder_device *
>     +vlc_decoder_device_Create(vlc_object_t *, vout_window_t *window) VLC_USED;
>     +#define vlc_decoder_device_Create(a, b) \
>     +        vlc_decoder_device_Create(VLC_OBJECT(a), (b))
>       
>       /**
>        * Hold a decoder device
>     diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
>     index 3d8a06985db..a34d32f8185 100644
>     --- a/src/input/decoder_helpers.c
>     +++ b/src/input/decoder_helpers.c
>     @@ -181,14 +181,15 @@ static int decoder_device_Open(void *func, bool forced, va_list ap)
>           return open(device, window);
>       }
>       
>     +#undef vlc_decoder_device_Create
>       vlc_decoder_device *
>     -vlc_decoder_device_Create(vout_window_t *window)
>     +vlc_decoder_device_Create(vlc_object_t *o, vout_window_t *window)
>       {
>           struct vlc_decoder_device_priv *priv =
>     -            vlc_object_create(window, sizeof (*priv));
>     +            vlc_object_create(o, sizeof (*priv));
>           if (!priv)
>               return NULL;
>     -    char *name = var_InheritString(window, "dec-dev");
>     +    char *name = var_InheritString(o, "dec-dev");
>           module_t *module = vlc_module_load(&priv->device, "decoder device", name,
>                                           true, decoder_device_Open, &priv->device,
>                                           window);
>     diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
>     index 8aa527120c0..66ab3e22b3e 100644
>     --- a/src/video_output/video_output.c
>     +++ b/src/video_output/video_output.c
>     @@ -1990,7 +1990,7 @@ static int vout_EnableWindow(vout_thread_t *vout, const video_format_t *original
>           if (pp_dec_device)
>           {
>               if (sys->dec_device == NULL)
>     -            sys->dec_device = vlc_decoder_device_Create(sys->display_cfg.window);
>     +            sys->dec_device = vlc_decoder_device_Create(vout, sys->display_cfg.window);
>               *pp_dec_device = sys->dec_device ? vlc_decoder_device_Hold( sys->dec_device ) : NULL;
>           }
>           vlc_mutex_unlock(&sys->window_lock);
> 
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser 
> ma brièveté.
> 
> _______________________________________________
> 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