[vlc-devel] [PATCH 06/36] vdpau: chroma: get the decoder device using filter_HoldDecoderDevice()

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 25 10:31:53 CET 2019


On 2019-11-23 14:37, Rémi Denis-Courmont wrote:
> Le torstaina 21. marraskuuta 2019, 16.13.57 EET Steve Lhomme a écrit :
>> Use vdp_get_x11() to get the VdpDevice since we already have the vdp from
>> the decoder device.
>> ---
>>   modules/hw/vdpau/chroma.c | 23 ++++++++++++++++++++---
>>   1 file changed, 20 insertions(+), 3 deletions(-)
>>
>> diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
>> index e2791eced4d..51a958ccc2d 100644
>> --- a/modules/hw/vdpau/chroma.c
>> +++ b/modules/hw/vdpau/chroma.c
>> @@ -768,9 +768,21 @@ static int OutputOpen(vlc_object_t *obj)
>>       assert(filter->fmt_out.video.orientation == ORIENT_TOP_LEFT
>>
>>           || filter->fmt_in.video.orientation ==
>>           || filter->fmt_out.video.orientation);
>>
>> +    vlc_decoder_device *dec_device = filter_HoldDecoderDevice(filter);
>> +    if (dec_device == NULL)
>> +        return VLC_EGENERIC;
>> +    if (dec_device->type != VLC_DECODER_DEVICE_VDPAU)
>> +    {
>> +        vlc_decoder_device_Release(dec_device);
>> +        return VLC_EGENERIC;
>> +    }
> 
> Would be simpler to ask for the correct type up-front, and handle the checks
> in common code. Few if any filters will support more than one device type.

I'd rather keep the simple getter, it can be used to check if there's 
any decoder device (for example). I can add a helper with a type to make 
things easier for callers.


More information about the vlc-devel mailing list