[vlc-devel] [PATCH 1/3] decoder: move device close callback

Thomas Guillem thomas at gllm.fr
Thu Jul 18 07:53:38 CEST 2019


OK for the set (after robux question is answered).

On Thu, Jul 18, 2019, at 07:43, Steve Lhomme wrote:
> Hi,
> 
> On 2019-07-17 22:17, RĂ©mi Denis-Courmont wrote:
> > This moves the decoder device close callback to a dedicated
> > type-specific structure, to avoid type-unsafe variable-arguments
> > vlc_module_unload().
> > ---
> >   include/vlc_codec.h                           |  9 +++++++--
> >   modules/hw/vaapi/decoder_device.c             |  7 ++++++-
> >   modules/video_output/opengl/converter_vdpau.c |  5 +++++
> >   src/input/decoder_helpers.c                   | 11 +++--------
> >   4 files changed, 21 insertions(+), 11 deletions(-)
> > 
> 
> > diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
> > index 7384e2bda0..f1ef1bfd20 100644
> > --- a/src/input/decoder_helpers.c
> > +++ b/src/input/decoder_helpers.c
> > @@ -120,13 +120,6 @@ static int decoder_device_Open(void *func, bool forced, va_list ap)
> >       return ret;
> >   }
> >   
> > -static void decoder_device_Close(void *func, va_list ap)
> > -{
> > -    vlc_decoder_device_Close close = func;
> > -    vlc_decoder_device *device = va_arg(ap, vlc_decoder_device *);
> > -    close(device);
> > -}
> > -
> >   vlc_decoder_device *
> >   vlc_decoder_device_Create(vout_window_t *window)
> >   {
> > @@ -145,6 +138,7 @@ vlc_decoder_device_Create(vout_window_t *window)
> >           vlc_object_delete(&priv->device);
> >           return NULL;
> >       }
> > +    assert(priv->device.ops != NULL);
> >       vlc_atomic_rc_init(&priv->rc);
> >       return &priv->device;
> >   }
> > @@ -165,7 +159,8 @@ vlc_decoder_device_Release(vlc_decoder_device *device)
> >               container_of(device, struct vlc_decoder_device_priv, device);
> >       if (vlc_atomic_rc_dec(&priv->rc))
> >       {
> > -        vlc_module_unload(priv->module, decoder_device_Close, device);
> > +        assert(device->ops->close != NULL);
> > +        device->ops->close(device);
> 
> I'm not sure the VLC_DECODER_DEVICE_NONE decoder device would need a 
> close callback.
> It is currently unimplemented and IMO it could be removed and replaced 
> by a NULL decoder device. But we have to agree on what we do.
> 
> >           vlc_objres_clear(VLC_OBJECT(device));
> >           vlc_object_delete(device);
> >       }
> > -- 
> > 2.22.0
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> > 
> _______________________________________________
> 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