FFmpeg
Loading...
Searching...
No Matches
ansi.c
Go to the documentation of this file.
1/*
2 * ASCII/ANSI art decoder
3 * Copyright (c) 2010 Peter Ross <pross@xvid.org>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * ASCII/ANSI art decoder
25 */
26
28#include "libavutil/common.h"
29#include "libavutil/frame.h"
31#include "avcodec.h"
32#include "cga_data.h"
33#include "codec_internal.h"
34#include "decode.h"
35
36#define ATTR_BOLD 0x01 /**< Bold/Bright-foreground (mode 1) */
37#define ATTR_FAINT 0x02 /**< Faint (mode 2) */
38#define ATTR_ITALICS 0x04 /**< Italics (mode 3) */
39#define ATTR_UNDERLINE 0x08 /**< Underline (mode 4) */
40#define ATTR_BLINK 0x10 /**< Blink/Bright-background (mode 5) */
41#define ATTR_REVERSE 0x40 /**< Reverse (mode 7) */
42#define ATTR_CONCEALED 0x80 /**< Concealed (mode 8) */
43
44#define DEFAULT_FG_COLOR 7 /**< CGA color index */
45#define DEFAULT_BG_COLOR 0
46#define DEFAULT_SCREEN_MODE 3 /**< 80x25 */
47
48#define FONT_WIDTH 8 /**< Font width */
49
50/** map ansi color index to cga palette index */
51static const uint8_t ansi_to_cga[16] = {
52 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15
53};
54
55typedef struct AnsiContext {
57 int x; /**< x cursor position (pixels) */
58 int y; /**< y cursor position (pixels) */
59 int sx; /**< saved x cursor position (pixels) */
60 int sy; /**< saved y cursor position (pixels) */
61 const uint8_t* font; /**< font */
62 int font_height; /**< font height */
63 int attributes; /**< attribute flags */
64 int fg; /**< foreground color */
65 int bg; /**< background color */
67
68 /* ansi parser state machine */
69 enum {
75#define MAX_NB_ARGS 4
77 int nb_args; /**< number of arguments (may exceed MAX_NB_ARGS) */
79
81{
82 AnsiContext *s = avctx->priv_data;
83 avctx->pix_fmt = AV_PIX_FMT_PAL8;
84
85 /* defaults */
86 s->font = avpriv_vga16_font_get();
87 s->font_height = 16;
88 s->fg = DEFAULT_FG_COLOR;
89 s->bg = DEFAULT_BG_COLOR;
90
91 if (!avctx->width || !avctx->height) {
92 int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4);
93 if (ret < 0)
94 return ret;
95 } else if (avctx->width % FONT_WIDTH || avctx->height % s->font_height) {
96 av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
97 return AVERROR(EINVAL);
98 }
99
100 s->frame = av_frame_alloc();
101 if (!s->frame)
102 return AVERROR(ENOMEM);
103
104 return 0;
105}
106
107static void set_palette(uint32_t *pal)
108{
109 int r, g, b;
110 memcpy(pal, ff_cga_palette, 16 * 4);
111 pal += 16;
112#define COLOR(x) ((x) * 40 + 55)
113 for (r = 0; r < 6; r++)
114 for (g = 0; g < 6; g++)
115 for (b = 0; b < 6; b++)
116 *pal++ = 0xFF000000 | (COLOR(r) << 16) | (COLOR(g) << 8) | COLOR(b);
117#define GRAY(x) ((x) * 10 + 8)
118 for (g = 0; g < 24; g++)
119 *pal++ = 0xFF000000 | (GRAY(g) << 16) | (GRAY(g) << 8) | GRAY(g);
120}
121
122static void hscroll(AVCodecContext *avctx)
123{
124 AnsiContext *s = avctx->priv_data;
125 int i;
126
127 if (s->y <= avctx->height - 2*s->font_height) {
128 s->y += s->font_height;
129 return;
130 }
131
132 i = 0;
133 for (; i < avctx->height - s->font_height; i++)
134 memcpy(s->frame->data[0] + i * s->frame->linesize[0],
135 s->frame->data[0] + (i + s->font_height) * s->frame->linesize[0],
136 avctx->width);
137 for (; i < avctx->height; i++)
138 memset(s->frame->data[0] + i * s->frame->linesize[0],
139 DEFAULT_BG_COLOR, avctx->width);
140}
141
142static void erase_line(AVCodecContext * avctx, int xoffset, int xlength)
143{
144 AnsiContext *s = avctx->priv_data;
145 int i;
146 for (i = 0; i < s->font_height; i++)
147 memset(s->frame->data[0] + (s->y + i)*s->frame->linesize[0] + xoffset,
148 DEFAULT_BG_COLOR, xlength);
149}
150
151static void erase_screen(AVCodecContext *avctx)
152{
153 AnsiContext *s = avctx->priv_data;
154 int i;
155 for (i = 0; i < avctx->height; i++)
156 memset(s->frame->data[0] + i * s->frame->linesize[0], DEFAULT_BG_COLOR, avctx->width);
157 s->x = s->y = 0;
158}
159
160/**
161 * Draw character to screen
162 */
163static void draw_char(AVCodecContext *avctx, int c)
164{
165 AnsiContext *s = avctx->priv_data;
166 int fg = s->fg;
167 int bg = s->bg;
168
169 if ((s->attributes & ATTR_BOLD))
170 fg += 8;
171 if ((s->attributes & ATTR_BLINK))
172 bg += 8;
173 if ((s->attributes & ATTR_REVERSE))
174 FFSWAP(int, fg, bg);
175 if ((s->attributes & ATTR_CONCEALED))
176 fg = bg;
177 ff_draw_pc_font(s->frame->data[0] + s->y * s->frame->linesize[0] + s->x,
178 s->frame->linesize[0], s->font, s->font_height, c, fg, bg);
179 s->x += FONT_WIDTH;
180 if (s->x > avctx->width - FONT_WIDTH) {
181 s->x = 0;
182 hscroll(avctx);
183 }
184}
185
186/**
187 * Execute ANSI escape code
188 * @return 0 on success, negative on error
189 */
190static int execute_code(AVCodecContext * avctx, int c)
191{
192 AnsiContext *s = avctx->priv_data;
193 int ret, i;
194 int width = avctx->width;
195 int height = avctx->height;
196
197 switch(c) {
198 case 'A': //Cursor Up
199 s->y = FFMAX(s->y - (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), 0);
200 break;
201 case 'B': //Cursor Down
202 s->y = FFMIN(s->y + (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), avctx->height - s->font_height);
203 break;
204 case 'C': //Cursor Right
205 s->x = FFMIN(s->x + (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), avctx->width - FONT_WIDTH);
206 break;
207 case 'D': //Cursor Left
208 s->x = FFMAX(s->x - (s->nb_args > 0 ? s->args[0]*FONT_WIDTH : FONT_WIDTH), 0);
209 break;
210 case 'H': //Cursor Position
211 case 'f': //Horizontal and Vertical Position
212 s->y = s->nb_args > 0 ? av_clip((s->args[0] - 1)*s->font_height, 0, avctx->height - s->font_height) : 0;
213 s->x = s->nb_args > 1 ? av_clip((s->args[1] - 1)*FONT_WIDTH, 0, avctx->width - FONT_WIDTH) : 0;
214 break;
215 case 'h': //set screen mode
216 case 'l': //reset screen mode
217 if (s->nb_args < 2)
218 s->args[0] = DEFAULT_SCREEN_MODE;
219 switch(s->args[0]) {
220 case 0: case 1: case 4: case 5: case 13: case 19: //320x200 (25 rows)
221 s->font = avpriv_cga_font_get();
222 s->font_height = 8;
223 width = 40<<3;
224 height = 25<<3;
225 break;
226 case 2: case 3: //640x400 (25 rows)
227 s->font = avpriv_vga16_font_get();
228 s->font_height = 16;
229 width = 80<<3;
230 height = 25<<4;
231 break;
232 case 6: case 14: //640x200 (25 rows)
233 s->font = avpriv_cga_font_get();
234 s->font_height = 8;
235 width = 80<<3;
236 height = 25<<3;
237 break;
238 case 7: //set line wrapping
239 break;
240 case 15: case 16: //640x350 (43 rows)
241 s->font = avpriv_cga_font_get();
242 s->font_height = 8;
243 width = 80<<3;
244 height = 43<<3;
245 break;
246 case 17: case 18: //640x480 (60 rows)
247 s->font = avpriv_cga_font_get();
248 s->font_height = 8;
249 width = 80<<3;
250 height = 60<<4;
251 break;
252 default:
253 avpriv_request_sample(avctx, "Unsupported screen mode");
254 }
255 s->x = av_clip(s->x, 0, width - FONT_WIDTH);
256 s->y = av_clip(s->y, 0, height - s->font_height);
257 if (width != avctx->width || height != avctx->height) {
258 av_frame_unref(s->frame);
259 ret = ff_set_dimensions(avctx, width, height);
260 if (ret < 0)
261 return ret;
262 if ((ret = ff_get_buffer(avctx, s->frame,
264 return ret;
265 s->frame->pict_type = AV_PICTURE_TYPE_I;
266 set_palette((uint32_t *)s->frame->data[1]);
267 erase_screen(avctx);
268 } else if (c == 'l') {
269 erase_screen(avctx);
270 }
271 break;
272 case 'J': //Erase in Page
273 switch (s->args[0]) {
274 case 0:
275 erase_line(avctx, s->x, avctx->width - s->x);
276 if (s->y < avctx->height - s->font_height)
277 memset(s->frame->data[0] + (s->y + s->font_height)*s->frame->linesize[0],
278 DEFAULT_BG_COLOR, (avctx->height - s->y - s->font_height)*s->frame->linesize[0]);
279 break;
280 case 1:
281 erase_line(avctx, 0, s->x);
282 if (s->y > 0)
283 memset(s->frame->data[0], DEFAULT_BG_COLOR, s->y * s->frame->linesize[0]);
284 break;
285 case 2:
286 erase_screen(avctx);
287 }
288 break;
289 case 'K': //Erase in Line
290 switch(s->args[0]) {
291 case 0:
292 erase_line(avctx, s->x, avctx->width - s->x);
293 break;
294 case 1:
295 erase_line(avctx, 0, s->x);
296 break;
297 case 2:
298 erase_line(avctx, 0, avctx->width);
299 }
300 break;
301 case 'm': //Select Graphics Rendition
302 if (s->nb_args == 0) {
303 s->nb_args = 1;
304 s->args[0] = 0;
305 }
306 for (i = 0; i < FFMIN(s->nb_args, MAX_NB_ARGS); i++) {
307 int m = s->args[i];
308 if (m == 0) {
309 s->attributes = 0;
310 s->fg = DEFAULT_FG_COLOR;
311 s->bg = DEFAULT_BG_COLOR;
312 } else if (m == 1 || m == 2 || m == 3 || m == 4 || m == 5 || m == 7 || m == 8) {
313 s->attributes |= 1 << (m - 1);
314 } else if (m >= 30 && m <= 37) {
315 s->fg = ansi_to_cga[m - 30];
316 } else if (m == 38 && i + 2 < FFMIN(s->nb_args, MAX_NB_ARGS) && s->args[i + 1] == 5 && s->args[i + 2] < 256) {
317 int index = s->args[i + 2];
318 s->fg = index < 16 ? ansi_to_cga[index] : index;
319 i += 2;
320 } else if (m == 39) {
322 } else if (m >= 40 && m <= 47) {
323 s->bg = ansi_to_cga[m - 40];
324 } else if (m == 48 && i + 2 < FFMIN(s->nb_args, MAX_NB_ARGS) && s->args[i + 1] == 5 && s->args[i + 2] < 256) {
325 int index = s->args[i + 2];
326 s->bg = index < 16 ? ansi_to_cga[index] : index;
327 i += 2;
328 } else if (m == 49) {
330 } else {
331 avpriv_request_sample(avctx, "Unsupported rendition parameter");
332 }
333 }
334 break;
335 case 'n': //Device Status Report
336 case 'R': //report current line and column
337 /* ignore */
338 break;
339 case 's': //Save Cursor Position
340 s->sx = s->x;
341 s->sy = s->y;
342 break;
343 case 'u': //Restore Cursor Position
344 s->x = av_clip(s->sx, 0, avctx->width - FONT_WIDTH);
345 s->y = av_clip(s->sy, 0, avctx->height - s->font_height);
346 break;
347 default:
348 avpriv_request_sample(avctx, "Unknown escape code");
349 break;
350 }
351 s->x = av_clip(s->x, 0, avctx->width - FONT_WIDTH);
352 s->y = av_clip(s->y, 0, avctx->height - s->font_height);
353 return 0;
354}
355
356static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
357 int *got_frame, AVPacket *avpkt)
358{
359 AnsiContext *s = avctx->priv_data;
360 const uint8_t *buf = avpkt->data;
361 int buf_size = avpkt->size;
362 const uint8_t *buf_end = buf+buf_size;
363 int ret, i, count;
364
365 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
366 return ret;
367 if (!avctx->frame_num) {
368 for (i=0; i<avctx->height; i++)
369 memset(s->frame->data[0]+ i*s->frame->linesize[0], 0, avctx->width);
370 memset(s->frame->data[1], 0, AVPALETTE_SIZE);
371 }
372
373 s->frame->pict_type = AV_PICTURE_TYPE_I;
374 set_palette((uint32_t *)s->frame->data[1]);
375 if (!s->first_frame) {
376 erase_screen(avctx);
377 s->first_frame = 1;
378 }
379
380 while(buf < buf_end) {
381 switch(s->state) {
382 case STATE_NORMAL:
383 switch (buf[0]) {
384 case 0x00: //NUL
385 case 0x07: //BEL
386 case 0x1A: //SUB
387 /* ignore */
388 break;
389 case 0x08: //BS
390 s->x = FFMAX(s->x - 1, 0);
391 break;
392 case 0x09: //HT
393 i = s->x / FONT_WIDTH;
394 count = ((i + 8) & ~7) - i;
395 for (i = 0; i < count; i++)
396 draw_char(avctx, ' ');
397 break;
398 case 0x0A: //LF
399 hscroll(avctx);
401 case 0x0D: //CR
402 s->x = 0;
403 break;
404 case 0x0C: //FF
405 erase_screen(avctx);
406 break;
407 case 0x1B: //ESC
408 s->state = STATE_ESCAPE;
409 break;
410 default:
411 draw_char(avctx, buf[0]);
412 }
413 break;
414 case STATE_ESCAPE:
415 if (buf[0] == '[') {
416 s->state = STATE_CODE;
417 s->nb_args = 0;
418 s->args[0] = -1;
419 } else {
420 s->state = STATE_NORMAL;
421 draw_char(avctx, 0x1B);
422 continue;
423 }
424 break;
425 case STATE_CODE:
426 switch(buf[0]) {
427 case '0': case '1': case '2': case '3': case '4':
428 case '5': case '6': case '7': case '8': case '9':
429 if (s->nb_args < MAX_NB_ARGS && s->args[s->nb_args] < 6553)
430 s->args[s->nb_args] = FFMAX(s->args[s->nb_args], 0) * 10 + buf[0] - '0';
431 break;
432 case ';':
433 if (s->nb_args < MAX_NB_ARGS)
434 s->nb_args++;
435 if (s->nb_args < MAX_NB_ARGS)
436 s->args[s->nb_args] = 0;
437 break;
438 case 'M':
439 s->state = STATE_MUSIC_PREAMBLE;
440 break;
441 case '=': case '?':
442 /* ignore */
443 break;
444 default:
445 if (s->nb_args > MAX_NB_ARGS)
446 av_log(avctx, AV_LOG_WARNING, "args overflow (%i)\n", s->nb_args);
447 if (s->nb_args < MAX_NB_ARGS && s->args[s->nb_args] >= 0)
448 s->nb_args++;
449 if ((ret = execute_code(avctx, buf[0])) < 0)
450 return ret;
451 s->state = STATE_NORMAL;
452 }
453 break;
454 case STATE_MUSIC_PREAMBLE:
455 if (buf[0] == 0x0E || buf[0] == 0x1B)
456 s->state = STATE_NORMAL;
457 /* ignore music data */
458 break;
459 }
460 buf++;
461 }
462
463 *got_frame = 1;
464 if ((ret = av_frame_ref(rframe, s->frame)) < 0)
465 return ret;
466 return buf_size;
467}
468
470{
471 AnsiContext *s = avctx->priv_data;
472
473 av_frame_free(&s->frame);
474 return 0;
475}
476
478 { "max_pixels", "640*480" },
479 { NULL },
480};
481
483 .p.name = "ansi",
484 CODEC_LONG_NAME("ASCII/ANSI art"),
485 .p.type = AVMEDIA_TYPE_VIDEO,
486 .p.id = AV_CODEC_ID_ANSI,
487 .priv_data_size = sizeof(AnsiContext),
488 .init = decode_init,
491 .p.capabilities = AV_CODEC_CAP_DR1,
492 .defaults = ansi_defaults,
493};
const FFCodec ff_ansi_decoder
Definition ansi.c:482
static int execute_code(AVCodecContext *avctx, int c)
Execute ANSI escape code.
Definition ansi.c:190
#define ATTR_CONCEALED
Concealed (mode 8)
Definition ansi.c:42
#define DEFAULT_FG_COLOR
CGA color index.
Definition ansi.c:44
#define DEFAULT_BG_COLOR
Definition ansi.c:45
static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
Definition ansi.c:356
#define ATTR_BLINK
Blink/Bright-background (mode 5)
Definition ansi.c:40
static av_cold int decode_close(AVCodecContext *avctx)
Definition ansi.c:469
#define ATTR_BOLD
Bold/Bright-foreground (mode 1)
Definition ansi.c:36
static av_cold int decode_init(AVCodecContext *avctx)
Definition ansi.c:80
static void hscroll(AVCodecContext *avctx)
Definition ansi.c:122
#define FONT_WIDTH
Font width.
Definition ansi.c:48
#define COLOR(x)
static void draw_char(AVCodecContext *avctx, int c)
Draw character to screen.
Definition ansi.c:163
static void erase_screen(AVCodecContext *avctx)
Definition ansi.c:151
#define MAX_NB_ARGS
Definition ansi.c:75
#define DEFAULT_SCREEN_MODE
80x25
Definition ansi.c:46
static const FFCodecDefault ansi_defaults[]
Definition ansi.c:477
static void erase_line(AVCodecContext *avctx, int xoffset, int xlength)
Definition ansi.c:142
#define ATTR_REVERSE
Reverse (mode 7)
Definition ansi.c:41
static const uint8_t ansi_to_cga[16]
map ansi color index to cga palette index
Definition ansi.c:51
#define GRAY(x)
static void set_palette(uint32_t *pal)
Definition ansi.c:107
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
Libavcodec external API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
void ff_draw_pc_font(uint8_t *dst, int linesize, const uint8_t *font, int font_height, int ch, int fg, int bg)
Draw CGA/EGA/VGA font to 8-bit pixel buffer.
Definition cga_data.c:46
const uint32_t ff_cga_palette[16]
Definition cga_data.c:30
CGA/EGA/VGA ROM data.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
common internal and external API header
#define av_clip
Definition common.h:100
#define NULL
Definition coverity.c:32
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition decode.c:1777
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
Definition decode.c:1906
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Definition utils.c:91
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static struct @346255127015250356166251341105367306144006377143 state
reference-counted frame API
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
Definition avcodec.h:415
@ AV_CODEC_ID_ANSI
Definition codec_id.h:192
#define AVERROR(e)
Definition error.h:45
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition frame.c:496
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition frame.c:278
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition frame.c:52
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
@ AV_PICTURE_TYPE_I
Intra.
Definition avutil.h:278
int index
Definition gxfenc.c:90
#define r
Definition input.c:42
#define b
Definition input.c:43
static av_cold int decode_init(AVCodecContext *avctx)
Definition 4xm.c:998
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition 4xm.c:837
static av_cold int decode_close(AVCodecContext *avctx)
Definition aacdec.c:1220
Macro definitions for various function/variable attributes.
#define av_fallthrough
Definition attributes.h:67
#define av_cold
Definition attributes.h:117
#define FFSWAP(type, a, b)
Definition macros.h:52
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
#define AVPALETTE_SIZE
Definition pixfmt.h:32
main external API structure.
Definition avcodec.h:443
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition avcodec.h:643
int width
picture width / height.
Definition avcodec.h:604
int64_t frame_num
Frame counter, set by libavcodec.
Definition avcodec.h:1883
void * priv_data
Definition avcodec.h:470
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
This structure stores compressed data.
Definition packet.h:580
int size
Definition packet.h:604
uint8_t * data
Definition packet.h:603
int args[MAX_NB_ARGS]
Definition ansi.c:76
@ STATE_MUSIC_PREAMBLE
Definition ansi.c:73
@ STATE_CODE
Definition ansi.c:72
@ STATE_ESCAPE
Definition ansi.c:71
@ STATE_NORMAL
Definition ansi.c:70
AVFrame * frame
Definition ansi.c:56
int sy
saved y cursor position (pixels)
Definition ansi.c:60
int y
y cursor position (pixels)
Definition ansi.c:58
int fg
foreground color
Definition ansi.c:64
int bg
background color
Definition ansi.c:65
int x
x cursor position (pixels)
Definition ansi.c:57
int first_frame
Definition ansi.c:66
int sx
saved x cursor position (pixels)
Definition ansi.c:59
const uint8_t * font
font
Definition ansi.c:61
int nb_args
number of arguments (may exceed MAX_NB_ARGS)
Definition ansi.c:77
int attributes
attribute flags
Definition ansi.c:63
int font_height
font height
Definition ansi.c:62
#define avpriv_request_sample(...)
#define av_log(a,...)
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
const char * g
Definition vf_curves.c:128
static double c[64]
const uint8_t * avpriv_vga16_font_get(void)
const uint8_t * avpriv_cga_font_get(void)
CGA/EGA/VGA ROM font data.