[FFmpeg-devel] [PATCH] added expr evaluation to drawtext - fontsize

Moritz Barsnick barsnick at gmx.net
Sat Aug 27 16:21:19 EEST 2016


On Fri, Aug 26, 2016 at 14:37:42 -0700, Brett Harrison wrote:

> +    if (diff != 0) {
> +      return diff > 0 ? 1 : diff < 0 ? -1 : 0;
> +    }

If diff != 0, it can only be >0 or <0, nothing else:
       if (diff != 0)
         return diff > 0 ? 1 : -1;
(And you can drop the curly brackets.)

> +    else {
> +      int64_t diff = (int64_t)a->fontsize - (int64_t)bb->fontsize;
> +      return diff > 0 ? 1 : diff < 0 ? -1 : 0;
> +    }

There's a macro for this:
       else
           return FFDIFFSIGN((int64_t)a->fontsize, (int64_t)bb->fontsize);

Moritz


More information about the ffmpeg-devel mailing list