libavcodec/ansi.c File Reference

ASCII/ANSI art decoder. More...

#include "libavutil/lfg.h"
#include "avcodec.h"
#include "cga_data.h"

Go to the source code of this file.

Data Structures

struct  AnsiContext

Defines

#define ATTR_BOLD   0x01
 Bold/Bright-foreground (mode 1).
#define ATTR_FAINT   0x02
 Faint (mode 2).
#define ATTR_UNDERLINE   0x08
 Underline (mode 4).
#define ATTR_BLINK   0x10
 Blink/Bright-background (mode 5).
#define ATTR_REVERSE   0x40
 Reverse (mode 7).
#define ATTR_CONCEALED   0x80
 Concealed (mode 8).
#define DEFAULT_FG_COLOR   7
 CGA color index.
#define DEFAULT_BG_COLOR   0
#define DEFAULT_SCREEN_MODE   3
 80x25
#define FONT_WIDTH   8
 Font width.
#define MAX_NB_ARGS   4

Functions

static av_cold int decode_init (AVCodecContext *avctx)
static void hscroll (AVCodecContext *avctx)
static void erase_line (AVCodecContext *avctx, int xoffset, int xlength)
static void erase_screen (AVCodecContext *avctx)
static void draw_char (AVCodecContext *avctx, int c)
 Draw character to screen.
static int execute_code (AVCodecContext *avctx, int c)
 Execute ANSI escape code.
static int decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static av_cold int decode_close (AVCodecContext *avctx)

Variables

static const uint8_t ansi_to_cga [16]
 map ansi color index to cga palette index
AVCodec ff_ansi_decoder


Detailed Description

ASCII/ANSI art decoder.

Definition in file ansi.c.


Define Documentation

#define ATTR_BLINK   0x10

Blink/Bright-background (mode 5).

Definition at line 34 of file ansi.c.

Referenced by draw_char().

#define ATTR_BOLD   0x01

Bold/Bright-foreground (mode 1).

Definition at line 31 of file ansi.c.

Referenced by draw_char().

#define ATTR_CONCEALED   0x80

Concealed (mode 8).

Definition at line 36 of file ansi.c.

Referenced by draw_char().

#define ATTR_FAINT   0x02

Faint (mode 2).

Definition at line 32 of file ansi.c.

#define ATTR_REVERSE   0x40

Reverse (mode 7).

Definition at line 35 of file ansi.c.

Referenced by draw_char().

#define ATTR_UNDERLINE   0x08

Underline (mode 4).

Definition at line 33 of file ansi.c.

#define DEFAULT_BG_COLOR   0

Definition at line 39 of file ansi.c.

Referenced by decode_init(), erase_line(), erase_screen(), execute_code(), and hscroll().

#define DEFAULT_FG_COLOR   7

CGA color index.

Definition at line 38 of file ansi.c.

Referenced by decode_init(), and execute_code().

#define DEFAULT_SCREEN_MODE   3

80x25

Definition at line 40 of file ansi.c.

Referenced by execute_code().

#define FONT_WIDTH   8

Font width.

Definition at line 42 of file ansi.c.

Referenced by decode_frame(), draw_char(), and execute_code().

#define MAX_NB_ARGS   4

Definition at line 68 of file ansi.c.

Referenced by decode_frame(), and execute_code().


Function Documentation

static av_cold int decode_close ( AVCodecContext avctx  )  [static]

Definition at line 420 of file ansi.c.

Referenced by decode_init().

static int decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
AVPacket avpkt 
) [static]

Definition at line 314 of file ansi.c.

static av_cold int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 73 of file ansi.c.

static void draw_char ( AVCodecContext avctx,
int  c 
) [static]

Draw character to screen.

Definition at line 132 of file ansi.c.

Referenced by decode_frame().

static void erase_line ( AVCodecContext avctx,
int  xoffset,
int  xlength 
) [static]

Definition at line 111 of file ansi.c.

Referenced by execute_code().

static void erase_screen ( AVCodecContext avctx  )  [static]

Definition at line 120 of file ansi.c.

Referenced by decode_frame(), and execute_code().

static int execute_code ( AVCodecContext avctx,
int  c 
) [static]

Execute ANSI escape code.

Returns:
0 on success, negative on error

Definition at line 159 of file ansi.c.

Referenced by decode_frame().

static void hscroll ( AVCodecContext avctx  )  [static]

Definition at line 91 of file ansi.c.

Referenced by decode_frame(), and draw_char().


Variable Documentation

const uint8_t ansi_to_cga[16] [static]

Initial value:

 {
    0,  4,  2,  6,  1,  5,  3, 7, 8, 12, 10, 14,  9, 13, 11, 15
}
map ansi color index to cga palette index

Definition at line 45 of file ansi.c.

Referenced by execute_code().

Initial value:

 {
    .name           = "ansi",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_ANSI,
    .priv_data_size = sizeof(AnsiContext),
    .init           = decode_init,
    .close          = decode_close,
    .decode         = decode_frame,
    .capabilities   = CODEC_CAP_DR1,
    .long_name      = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"),
}

Definition at line 428 of file ansi.c.


Generated on Fri Oct 26 02:47:55 2012 for FFmpeg by  doxygen 1.5.8