32 #define ATTR_BOLD 0x01
33 #define ATTR_FAINT 0x02
34 #define ATTR_UNDERLINE 0x08
35 #define ATTR_BLINK 0x10
36 #define ATTR_REVERSE 0x40
37 #define ATTR_CONCEALED 0x80
39 #define DEFAULT_FG_COLOR 7
40 #define DEFAULT_BG_COLOR 0
41 #define DEFAULT_SCREEN_MODE 3
46 static const uint8_t ansi_to_cga[16] = {
47 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15
106 for (; i < avctx->
height; i++)
124 for (i = 0; i < avctx->
height; i++)
149 if (s->
x >= avctx->
width) {
179 s->
x = s->
nb_args > 1 ? av_clip((s->
args[1] - 1)*FONT_WIDTH, 0, avctx->
width - FONT_WIDTH) : 0;
186 case 0:
case 1:
case 4:
case 5:
case 13:
case 19:
221 if (width != avctx->
width || height != avctx->
height) {
234 }
else if (c ==
'l') {
239 switch (s->
args[0]) {
278 }
else if (m == 1 || m == 2 || m == 4 || m == 5 || m == 7 || m == 8) {
280 }
else if (m >= 30 && m <= 38) {
282 }
else if (m == 39) {
284 }
else if (m >= 40 && m <= 47) {
286 }
else if (m == 49) {
302 s->
x = av_clip(s->
sx, 0, avctx->
width - FONT_WIDTH);
313 void *
data,
int *data_size,
317 uint8_t *buf = avpkt->
data;
318 int buf_size = avpkt->
size;
319 const uint8_t *buf_end = buf+buf_size;
331 while(buf < buf_end) {
345 count = ((i + 8) & ~7) - i;
346 for (i = 0; i < count; i++)
358 s->
state = STATE_ESCAPE;
366 s->
state = STATE_CODE;
370 s->
state = STATE_NORMAL;
378 case '0':
case '1':
case '2':
case '3':
case '4':
379 case '5':
case '6':
case '7':
case '8':
case '9':
389 s->
state = STATE_MUSIC_PREAMBLE;
401 s->
state = STATE_NORMAL;
404 case STATE_MUSIC_PREAMBLE:
405 if (buf[0] == 0x0E || buf[0] == 0x1B)
406 s->
state = STATE_NORMAL;
static void draw_char(AVCodecContext *avctx, int c)
Draw character to screen.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define FONT_WIDTH
Font width.
const uint8_t ff_cga_font[2048]
int x
x cursor position (pixels)
#define ATTR_REVERSE
Reverse (mode 7)
#define ATTR_CONCEALED
Concealed (mode 8)
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
#define AV_LOG_WARNING
Something somehow does not look correct.
int nb_args
number of arguments (may exceed MAX_NB_ARGS)
#define DEFAULT_SCREEN_MODE
80x25
const uint8_t ff_vga16_font[4096]
static void erase_screen(AVCodecContext *avctx)
static int execute_code(AVCodecContext *avctx, int c)
Execute ANSI escape code.
int(* reget_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of a frame to get cr buffer for it.
static void hscroll(AVCodecContext *avctx)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static av_cold int decode_close(AVCodecContext *avctx)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int sy
saved y cursor position (pixels)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void erase_line(AVCodecContext *avctx, int xoffset, int xlength)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
enum AnsiContext::@9 state
#define ATTR_BLINK
Blink/Bright-background (mode 5)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
struct AVFrame AVFrame
Audio Video Frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
static av_cold int decode_init(AVCodecContext *avctx)
#define ATTR_BOLD
Bold/Bright-foreground (mode 1)
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
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.
int font_height
font height
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int palette_has_changed
Tell user application that palette has changed from previous frame.
static const uint8_t ansi_to_cga[16]
map ansi color index to cga palette index
const uint32_t ff_cga_palette[16]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int sx
saved x cursor position (pixels)
common internal api header.
8 bit with PIX_FMT_RGB32 palette
int y
y cursor position (pixels)
#define DEFAULT_FG_COLOR
CGA color index.
#define FFSWAP(type, a, b)
int attributes
attribute flags