58 s->font_height = p[0];
66 if (!
s->font_height) {
76 for (
i = 0;
i < 16;
i++) {
77 s->palette[
i] = 0xFF000000 | (
AV_RB24(p) << 2) | ((
AV_RB24(p) >> 4) & 0x30303);
81 for (
i = 0;
i < 16;
i++)
88 switch(
s->font_height) {
108 #define DEFAULT_BG_COLOR 0
112 if (
s->y < avctx->
height -
s->font_height) {
113 s->y +=
s->font_height;
115 memmove(
s->frame->data[0],
s->frame->data[0] +
s->font_height*
s->frame->linesize[0],
116 (avctx->
height -
s->font_height)*
s->frame->linesize[0]);
117 memset(
s->frame->data[0] + (avctx->
height -
s->font_height)*
s->frame->linesize[0],
128 if (
s->y > avctx->
height -
s->font_height)
131 s->frame->linesize[0],
s->font,
s->font_height,
c,
136 s->y +=
s->font_height;
141 void *
data,
int *got_frame,
146 int buf_size = avpkt->
size;
147 const uint8_t *buf_end = buf+buf_size;
158 s->frame->palette_has_changed = 1;
159 memcpy(
s->frame->data[1],
s->palette, 16 * 4);
162 while (buf + 2 < buf_end) {
164 int type = *buf >> 6;
165 int count = (*buf & 0x3F) + 1;
169 for (
i = 0;
i < count && buf + 1 < buf_end;
i++) {
176 for (
i = 0;
i < count && buf < buf_end;
i++)
181 for (
i = 0;
i < count && buf < buf_end;
i++)
187 for (
i = 0;
i < count && buf < buf_end;
i++)
193 while (buf + 2 < buf_end) {
196 if (buf + 6 > buf_end)
198 for (
i = 0;
i < buf[2];
i++)
207 while (buf + 1 < buf_end) {
217 #if CONFIG_BINTEXT_DECODER
229 #if CONFIG_XBIN_DECODER
241 #if CONFIG_IDF_DECODER
AVCodec ff_bintext_decoder
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
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.
const uint32_t ff_cga_palette[16]
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PICTURE_TYPE_I
Intra.
static av_unused void hscroll(AVCodecContext *avctx)
static av_cold int decode_init(AVCodecContext *avctx)
static void draw_char(AVCodecContext *avctx, int c, int a)
Draw character to screen.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
const uint8_t avpriv_vga16_font[4096]
const uint8_t avpriv_cga_font[2048]
CGA/EGA/VGA ROM font data.