On 21 Mar 2014, at 11:46, Rémi Denis-Courmont <[email protected]> wrote:

> On Fri, 21 Mar 2014 10:53:45 +0100, Tim Walker <[email protected]>
> wrote:
>> On 20 Mar 2014, at 18:03, Rémi Denis-Courmont <[email protected]> wrote:
>> 
>>> +int av_vdpau_get_level(AVCodecContext *avctx, unsigned *levelp)
>>> +{
>>> +    unsigned level = avctx->level;
>>> +
>>> +    if (level == FF_LEVEL_UNKNOWN)
>>> +        return AVERROR(EINVAL);
>> 
>> FWIW, AVCodecContext.level is signed, and FF_LEVEL_UNKNOWN is negative
>> (-99).
> 
> The code still works, since the compiler will convert both the variable
> and the constant to unsigned before the comparison. Do you want an explicit
> cast?
> VDPAU levels are unsigned, so the sign conversion has to be done
> *somewhere*.

I guess this is as good a place to do it as anywhere else. But since you're 
returning right away, maybe you could check avctx->level directly (and even 
make the check more generic, i.e. make sure it's >= 0).

This is mostly a nit though.

Tim
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to