[vlc-devel] [PATCH 3/4] vdpau: add a helper function to get the vdp_t from the decoder device
Steve Lhomme
robux4 at ycbcr.xyz
Mon Oct 21 12:25:37 CEST 2019
On 2019-10-21 9:43, Alexandre Janniaux wrote:
> Hi,
>
> Both are fine with me, but maybe it would be clearer to
> execute the device check and module exit with error
> explicitly at the beginning of the module Open and then use
> this function as a safe wrapper around the decoder device
> opaque ?
>
> If the decoder device doesn't match what the filter/decoder
> wants to have, my intuition would be that either it exits
> or it initializes itself so as to never use the decoder
> device. Thus, the function should never be called in the
> wrong use case and assertion will reduce runtime footprint
> and help making fallback tests with different decoder
> devices.
Most of the time, you only use this helper (I have the same for
D3D11/D3D9/NVDEC) when you also need this check if it exists and it's
the right type. So it's convenient to do both at once.
I agree there could be a sub function or macro that just to the pointer
conversion (and an assert on the type). But that's for later refinement.
> Regards,
> --
> Alexandre Janniaux
> Videolabs
>
> On Mon, Oct 21, 2019 at 09:07:20AM +0200, Steve Lhomme wrote:
>> On 2019-10-21 8:58, Alexandre Janniaux wrote:
>>> Hi,
>>>
>>> Shouldn't we use the vdpau decoder device only when it is
>>> a VLC_DECODER_DEVICE_VDPAU ? Meaning it should be an assert
>>> instead of a check.
>>
>> We should *use* it only when it's VLC_DECODER_DEVICE_VDPAU, yes. But that
>> doesn't mean the vdpau converter (and later filters) cannot be open with a
>> VAAPI/NVDEC decoder device, in which case it should reject is silently.
>>
>>> Regards,
>>> --
>>> Alexandre Janniaux
>>> Videolabs
>>>
>>> On Mon, Oct 21, 2019 at 08:45:38AM +0200, Steve Lhomme wrote:
>>>> ---
>>>> modules/hw/vdpau/vlc_vdpau.h | 8 ++++++++
>>>> 1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
>>>> index d0e8bde787e..ba5d1443bf0 100644
>>>> --- a/modules/hw/vdpau/vlc_vdpau.h
>>>> +++ b/modules/hw/vdpau/vlc_vdpau.h
>>>> @@ -21,6 +21,7 @@
>>>> #ifndef VLC_VDPAU_H
>>>> # include <stdint.h>
>>>> # include <vdpau/vdpau.h>
>>>> +#include <vlc_codec.h>
>>>>
>>>> typedef struct vdp_s vdp_t;
>>>>
>>>> @@ -274,6 +275,13 @@ typedef struct vlc_vdp_video_field
>>>> float sharpen;
>>>> } vlc_vdp_video_field_t;
>>>>
>>>> +static inline vdp_t *GetVDPAUOpaqueDevice(vlc_decoder_device *device)
>>>> +{
>>>> + if (device == NULL || device->type != VLC_DECODER_DEVICE_VDPAU)
>>>> + return NULL;
>>>> + return device->opaque;
>>>> +}
>>>> +
>>>> /**
>>>> * Attaches a VDPAU video surface as context of a VLC picture.
>>>> */
>>>> --
>>>> 2.17.1
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>> _______________________________________________
>> 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