1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec: use the getters for xGA font data arrays

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-07-21 21:39:09 -03:00
parent c6c8063186
commit cb9742af76
3 changed files with 10 additions and 9 deletions

View File

@ -82,7 +82,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_PAL8; avctx->pix_fmt = AV_PIX_FMT_PAL8;
/* defaults */ /* defaults */
s->font = avpriv_vga16_font; s->font = avpriv_vga16_font_get();
s->font_height = 16; s->font_height = 16;
s->fg = DEFAULT_FG_COLOR; s->fg = DEFAULT_FG_COLOR;
s->bg = DEFAULT_BG_COLOR; s->bg = DEFAULT_BG_COLOR;
@ -217,19 +217,19 @@ static int execute_code(AVCodecContext * avctx, int c)
s->args[0] = DEFAULT_SCREEN_MODE; s->args[0] = DEFAULT_SCREEN_MODE;
switch(s->args[0]) { switch(s->args[0]) {
case 0: case 1: case 4: case 5: case 13: case 19: //320x200 (25 rows) 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; s->font_height = 8;
width = 40<<3; width = 40<<3;
height = 25<<3; height = 25<<3;
break; break;
case 2: case 3: //640x400 (25 rows) case 2: case 3: //640x400 (25 rows)
s->font = avpriv_vga16_font; s->font = avpriv_vga16_font_get();
s->font_height = 16; s->font_height = 16;
width = 80<<3; width = 80<<3;
height = 25<<4; height = 25<<4;
break; break;
case 6: case 14: //640x200 (25 rows) case 6: case 14: //640x200 (25 rows)
s->font = avpriv_cga_font; s->font = avpriv_cga_font_get();
s->font_height = 8; s->font_height = 8;
width = 80<<3; width = 80<<3;
height = 25<<3; height = 25<<3;
@ -237,13 +237,13 @@ static int execute_code(AVCodecContext * avctx, int c)
case 7: //set line wrapping case 7: //set line wrapping
break; break;
case 15: case 16: //640x350 (43 rows) case 15: case 16: //640x350 (43 rows)
s->font = avpriv_cga_font; s->font = avpriv_cga_font_get();
s->font_height = 8; s->font_height = 8;
width = 80<<3; width = 80<<3;
height = 43<<3; height = 43<<3;
break; break;
case 17: case 18: //640x480 (60 rows) case 17: case 18: //640x480 (60 rows)
s->font = avpriv_cga_font; s->font = avpriv_cga_font_get();
s->font_height = 8; s->font_height = 8;
width = 80<<3; width = 80<<3;
height = 60<<4; height = 60<<4;

View File

@ -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); av_log(avctx, AV_LOG_WARNING, "font height %i not supported\n", s->font_height);
s->font_height = 8; s->font_height = 8;
case 8: case 8:
s->font = avpriv_cga_font; s->font = avpriv_cga_font_get();
break; break;
case 16: case 16:
s->font = avpriv_vga16_font; s->font = avpriv_vga16_font_get();
break; break;
} }
} }

View File

@ -40,6 +40,7 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int *got_frame, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
const uint8_t *src = avpkt->data; const uint8_t *src = avpkt->data;
const uint8_t *cga_font = avpriv_cga_font_get();
uint8_t *dst; uint8_t *dst;
unsigned char_cols = avctx->width >> 3; unsigned char_cols = avctx->width >> 3;
unsigned char_rows = avctx->height >> 3; unsigned char_rows = avctx->height >> 3;
@ -67,7 +68,7 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
bg = *src >> 4; bg = *src >> 4;
fg = *src++ & 0xF; fg = *src++ & 0xF;
ff_draw_pc_font(dst + x * 8, frame->linesize[0], 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; dst += frame->linesize[0] * 8;
} }