[FFmpeg-devel] [PATCH] fate: add vf_overlay test for main source with alpha channel

Clément Bœsch u at pkh.me
Fri Jul 21 11:46:44 EEST 2017


On Thu, Jul 20, 2017 at 05:42:51PM +0200, Nicolas George wrote:
[...]
> diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
> index c4a5ae3742..f94c3ed9dd 100644
> --- a/libavfilter/vsrc_testsrc.c
> +++ b/libavfilter/vsrc_testsrc.c
> @@ -66,6 +66,9 @@ typedef struct TestSourceContext {
>      /* only used by testsrc */
>      int nb_decimals;
>  
> +    /* only used by testsrc2 */
> +    int alpha;
> +
>      /* only used by color */
>      FFDrawContext draw;
>      FFDrawColor color;
> @@ -685,6 +688,7 @@ AVFilter ff_vsrc_testsrc = {
>  
>  static const AVOption testsrc2_options[] = {
>      COMMON_OPTIONS
> +    { "alpha", "set global alpha (opacity)", OFFSET(alpha), AV_OPT_TYPE_INT, {.i64 = 255}, 0, 255, FLAGS },
>      { NULL }
>  };
>  
> @@ -735,6 +739,7 @@ static void test2_fill_picture(AVFilterContext *ctx, AVFrame *frame)
>  {
>      TestSourceContext *s = ctx->priv;
>      FFDrawColor color;
> +    unsigned alpha = s->alpha << 24;

small note here: i think x<<24 is undefined for x=0xff if x is signed

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170721/5ae91080/attachment.sig>


More information about the ffmpeg-devel mailing list