You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-09-16 08:36:51 +02:00
avfilter/vf_fade: set correct alpha mode requirement
Fading to black in non-alpha mode works for either straight or premultiplied alpha, but fading to a color does not.
This commit is contained in:
@@ -151,19 +151,36 @@ static int query_formats(const AVFilterContext *ctx,
|
||||
AV_PIX_FMT_GBRAP,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
const static int straight_alpha[] = {
|
||||
AVALPHA_MODE_UNSPECIFIED,
|
||||
AVALPHA_MODE_STRAIGHT,
|
||||
-1,
|
||||
};
|
||||
const enum AVPixelFormat *pixel_fmts;
|
||||
int need_straight = 0;
|
||||
int ret;
|
||||
|
||||
if (s->alpha) {
|
||||
if (s->black_fade)
|
||||
pixel_fmts = pix_fmts_alpha;
|
||||
else
|
||||
pixel_fmts = pix_fmts_rgba;
|
||||
need_straight = 1;
|
||||
} else {
|
||||
if (s->black_fade)
|
||||
pixel_fmts = pix_fmts;
|
||||
else
|
||||
else {
|
||||
pixel_fmts = pix_fmts_rgb;
|
||||
need_straight = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (need_straight) {
|
||||
ret = ff_set_common_alpha_modes_from_list2(ctx, cfg_in, cfg_out, straight_alpha);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, pixel_fmts);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user