* [FFmpeg-devel] [PR] fftools/ffplay: use a checkerboard video background for transparent video (PR #21454)
@ 2026-01-13 22:44 Marton Balint via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Marton Balint via ffmpeg-devel @ 2026-01-13 22:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
PR #21454 opened by Marton Balint (cus)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21454
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21454.patch
Signed-off-by: Marton Balint <cus@passwd.hu>
>From b451ed58f7b601b17b53e9ea73cf9e36aeef121d Mon Sep 17 00:00:00 2001
From: Marton Balint <cus@passwd.hu>
Date: Sun, 11 Jan 2026 21:37:19 +0100
Subject: [PATCH] fftools/ffplay: use a checkerboard video background for
transparent video
Signed-off-by: Marton Balint <cus@passwd.hu>
---
fftools/ffplay.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index dcd20e70bc..911928db64 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -963,6 +963,27 @@ static void set_sdl_yuv_conversion_mode(AVFrame *frame)
#endif
}
+static void draw_checkerboard(VideoState *is, SDL_Rect *rect)
+{
+ const int checkboard_size = 64;
+ SDL_BlendMode blendMode;
+ if (!SDL_GetTextureBlendMode(is->vid_texture, &blendMode) && blendMode == SDL_BLENDMODE_BLEND) {
+ SDL_SetRenderDrawColor(renderer, 237, 237, 237, 255);
+ fill_rectangle(rect->x, rect->y, rect->w, rect->h);
+ SDL_SetRenderDrawColor(renderer, 222, 222, 222, 222);
+ for (int x = 0; x < rect->w; x += checkboard_size * 2)
+ fill_rectangle(rect->x + x, rect->y, FFMIN(checkboard_size, rect->w - x), rect->h);
+ for (int y = 0; y < rect->h; y += checkboard_size * 2)
+ fill_rectangle(rect->x, rect->y + y, rect->w, FFMIN(checkboard_size, rect->h - y));
+ SDL_SetRenderDrawColor(renderer, 237, 237, 237, 255);
+ for (int y = 0; y < rect->h; y += checkboard_size * 2) {
+ int h = FFMIN(checkboard_size, rect->h - y);
+ for (int x = 0; x < rect->w; x += checkboard_size * 2)
+ fill_rectangle(x + rect->x, y + rect->y, FFMIN(checkboard_size, rect->w - x), h);
+ }
+ }
+}
+
static void video_image_display(VideoState *is)
{
Frame *vp;
@@ -1032,6 +1053,7 @@ static void video_image_display(VideoState *is)
vp->flip_v = vp->frame->linesize[0] < 0;
}
+ draw_checkerboard(is, &rect);
SDL_RenderCopyEx(renderer, is->vid_texture, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0);
set_sdl_yuv_conversion_mode(NULL);
if (sp) {
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-13 22:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-13 22:44 [FFmpeg-devel] [PR] fftools/ffplay: use a checkerboard video background for transparent video (PR #21454) Marton Balint via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git