Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marton Balint via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Marton Balint <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] fftools/ffplay: use a checkerboard video background for transparent video (PR #21454)
Date: Tue, 13 Jan 2026 22:44:45 -0000
Message-ID: <176834428605.25.15797470367229740403@4457048688e7> (raw)

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

                 reply	other threads:[~2026-01-13 22:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176834428605.25.15797470367229740403@4457048688e7 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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