Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/3] avcodec: use the getters for xGA font data arrays
Date: Mon, 21 Jul 2025 21:46:46 -0300
Message-ID: <20250722004647.15233-2-jamrial@gmail.com> (raw)
In-Reply-To: <20250722004647.15233-1-jamrial@gmail.com>

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/ansi.c    | 12 ++++++------
 libavcodec/bintext.c |  4 ++--
 libavcodec/tmv.c     |  3 ++-
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index b58b72ef49..bde9edbe60 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -82,7 +82,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     avctx->pix_fmt = AV_PIX_FMT_PAL8;
 
     /* defaults */
-    s->font        = avpriv_vga16_font;
+    s->font        = avpriv_vga16_font_get();
     s->font_height = 16;
     s->fg          = DEFAULT_FG_COLOR;
     s->bg          = DEFAULT_BG_COLOR;
@@ -217,19 +217,19 @@ static int execute_code(AVCodecContext * avctx, int c)
             s->args[0] = DEFAULT_SCREEN_MODE;
         switch(s->args[0]) {
         case 0: case 1: case 4: case 5: case 13: case 19: //320x200 (25 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_cga_font_get();
             s->font_height = 8;
             width  = 40<<3;
             height = 25<<3;
             break;
         case 2: case 3: //640x400 (25 rows)
-            s->font = avpriv_vga16_font;
+            s->font = avpriv_vga16_font_get();
             s->font_height = 16;
             width  = 80<<3;
             height = 25<<4;
             break;
         case 6: case 14: //640x200 (25 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_cga_font_get();
             s->font_height = 8;
             width  = 80<<3;
             height = 25<<3;
@@ -237,13 +237,13 @@ static int execute_code(AVCodecContext * avctx, int c)
         case 7: //set line wrapping
             break;
         case 15: case 16: //640x350 (43 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_cga_font_get();
             s->font_height = 8;
             width  = 80<<3;
             height = 43<<3;
             break;
         case 17: case 18: //640x480 (60 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_cga_font_get();
             s->font_height = 8;
             width  = 80<<3;
             height = 60<<4;
diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c
index b91a741875..356042c1f0 100644
--- a/libavcodec/bintext.c
+++ b/libavcodec/bintext.c
@@ -93,10 +93,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
             av_log(avctx, AV_LOG_WARNING, "font height %i not supported\n", s->font_height);
             s->font_height = 8;
         case 8:
-            s->font = avpriv_cga_font;
+            s->font = avpriv_cga_font_get();
             break;
         case 16:
-            s->font = avpriv_vga16_font;
+            s->font = avpriv_vga16_font_get();
             break;
         }
     }
diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c
index ebd0e0b0bc..0eedc258c3 100644
--- a/libavcodec/tmv.c
+++ b/libavcodec/tmv.c
@@ -40,6 +40,7 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
                             int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *src = avpkt->data;
+    const uint8_t *cga_font = avpriv_cga_font_get();
     uint8_t *dst;
     unsigned char_cols = avctx->width >> 3;
     unsigned char_rows = avctx->height >> 3;
@@ -67,7 +68,7 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
             bg = *src  >> 4;
             fg = *src++ & 0xF;
             ff_draw_pc_font(dst + x * 8, frame->linesize[0],
-                            avpriv_cga_font, 8, c, fg, bg);
+                            cga_font, 8, c, fg, bg);
         }
         dst += frame->linesize[0] * 8;
     }
-- 
2.50.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-07-22  0:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22  0:46 [FFmpeg-devel] [PATCH 1/3] avutil/xga_font_data: add getters to access the shared arrays James Almer
2025-07-22  0:46 ` James Almer [this message]
2025-07-22  0:46 ` [FFmpeg-devel] [PATCH 3/3] avfilter: use the getters for xGA font data arrays James Almer
2025-07-22  2:45 ` [FFmpeg-devel] [PATCH 1/3] avutil/xga_font_data: add getters to access the shared arrays Kacper Michajlow
2025-07-22  2:48   ` Kacper Michajlow

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=20250722004647.15233-2-jamrial@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@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