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

Rémi Denis-Courmont remi at remlab.net
Thu Jul 18 08:16:10 CEST 2019


I'll change it to test for NULL then. The argument is the same as for GL anyway.

Le 18 juillet 2019 08:43:05 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>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

-- 
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/20190718/74d9ae9b/attachment.html>


More information about the vlc-devel mailing list