33 #define ATTR_BOLD 0x01
34 #define ATTR_FAINT 0x02
35 #define ATTR_UNDERLINE 0x08
36 #define ATTR_BLINK 0x10
37 #define ATTR_REVERSE 0x40
38 #define ATTR_CONCEALED 0x80
40 #define DEFAULT_FG_COLOR 7
41 #define DEFAULT_BG_COLOR 0
42 #define DEFAULT_SCREEN_MODE 3
47 static const uint8_t ansi_to_cga[16] = {
48 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15
107 for (; i < avctx->
height; i++)
125 for (i = 0; i < avctx->
height; i++)
150 if (s->
x >= avctx->
width) {
180 s->
x = s->
nb_args > 1 ? av_clip((s->
args[1] - 1)*FONT_WIDTH, 0, avctx->
width - FONT_WIDTH) : 0;
187 case 0:
case 1:
case 4:
case 5:
case 13:
case 19:
222 if (width != avctx->
width || height != avctx->
height) {
235 }
else if (c ==
'l') {
240 switch (s->
args[0]) {
279 }
else if (m == 1 || m == 2 || m == 4 || m == 5 || m == 7 || m == 8) {
281 }
else if (m >= 30 && m <= 38) {
283 }
else if (m == 39) {
285 }
else if (m >= 40 && m <= 47) {
287 }
else if (m == 49) {
303 s->
x = av_clip(s->
sx, 0, avctx->
width - FONT_WIDTH);
314 void *
data,
int *got_frame,
319 int buf_size = avpkt->
size;
320 const uint8_t *buf_end = buf+buf_size;
337 while(buf < buf_end) {
351 count = ((i + 8) & ~7) - i;
352 for (i = 0; i < count; i++)
364 s->
state = STATE_ESCAPE;
372 s->
state = STATE_CODE;
376 s->
state = STATE_NORMAL;
383 case '0':
case '1':
case '2':
case '3':
case '4':
384 case '5':
case '6':
case '7':
case '8':
case '9':
394 s->
state = STATE_MUSIC_PREAMBLE;
406 s->
state = STATE_NORMAL;
409 case STATE_MUSIC_PREAMBLE:
410 if (buf[0] == 0x0E || buf[0] == 0x1B)
411 s->
state = STATE_NORMAL;
static void draw_char(AVCodecContext *avctx, int c)
Draw character to screen.
#define FONT_WIDTH
Font width.
const uint8_t ff_cga_font[2048]
int x
x cursor position (pixels)
#define ATTR_REVERSE
Reverse (mode 7)
This structure describes decoded (raw) audio or video data.
#define ATTR_CONCEALED
Concealed (mode 8)
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
int nb_args
number of arguments (may exceed MAX_NB_ARGS)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#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)
enum AnsiContext::@10 state
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
#define FFSWAP(type, a, b)
8 bit with PIX_FMT_RGB32 palette
static av_cold int decode_close(AVCodecContext *avctx)
static int init(AVCodecParserContext *s)
int sy
saved y cursor position (pixels)
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
#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.
#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.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
static av_cold int decode_init(AVCodecContext *avctx)
#define ATTR_BOLD
Bold/Bright-foreground (mode 1)
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.
main external API structure.
static void close(AVCodecParserContext *s)
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.
common internal and external API header
int y
y cursor position (pixels)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int frame_number
Frame counter, set by libavcodec.
#define DEFAULT_FG_COLOR
CGA color index.
int attributes
attribute flags
This structure stores compressed data.