FFmpeg
Data Structures | Macros | Functions | Variables
xpmdec.c File Reference
#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  XPMContext
 
struct  ColorEntry
 

Macros

#define MIN_ELEMENT   ' '
 
#define MAX_ELEMENT   0xfe
 
#define NB_ELEMENTS   (MAX_ELEMENT - MIN_ELEMENT + 1)
 

Functions

static int color_table_compare (const void *lhs, const void *rhs)
 
static unsigned hex_char_to_number (uint8_t x)
 
static size_t mod_strcspn (const char *string, const char *reject)
 
static uint32_t color_string_to_rgba (const char *p, int len)
 
static int ascii2index (const uint8_t *cpixel, int cpp)
 
static int xpm_decode_frame (AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
 
static av_cold int xpm_decode_close (AVCodecContext *avctx)
 

Variables

static const ColorEntry color_table []
 
const FFCodec ff_xpm_decoder
 

Macro Definition Documentation

◆ MIN_ELEMENT

#define MIN_ELEMENT   ' '

Definition at line 30 of file xpmdec.c.

◆ MAX_ELEMENT

#define MAX_ELEMENT   0xfe

Definition at line 31 of file xpmdec.c.

◆ NB_ELEMENTS

#define NB_ELEMENTS   (MAX_ELEMENT - MIN_ELEMENT + 1)

Definition at line 32 of file xpmdec.c.

Function Documentation

◆ color_table_compare()

static int color_table_compare ( const void *  lhs,
const void *  rhs 
)
static

Definition at line 46 of file xpmdec.c.

Referenced by color_string_to_rgba().

◆ hex_char_to_number()

static unsigned hex_char_to_number ( uint8_t  x)
static

Definition at line 195 of file xpmdec.c.

Referenced by color_string_to_rgba().

◆ mod_strcspn()

static size_t mod_strcspn ( const char *  string,
const char *  reject 
)
static

Definition at line 211 of file xpmdec.c.

Referenced by xpm_decode_frame().

◆ color_string_to_rgba()

static uint32_t color_string_to_rgba ( const char *  p,
int  len 
)
static

Definition at line 237 of file xpmdec.c.

Referenced by xpm_decode_frame().

◆ ascii2index()

static int ascii2index ( const uint8_t *  cpixel,
int  cpp 
)
static

Definition at line 292 of file xpmdec.c.

Referenced by xpm_decode_frame().

◆ xpm_decode_frame()

static int xpm_decode_frame ( AVCodecContext avctx,
AVFrame p,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 306 of file xpmdec.c.

◆ xpm_decode_close()

static av_cold int xpm_decode_close ( AVCodecContext avctx)
static

Definition at line 428 of file xpmdec.c.

Variable Documentation

◆ color_table

const ColorEntry color_table[]
static

◆ ff_xpm_decoder

const FFCodec ff_xpm_decoder
Initial value:
= {
.p.name = "xpm",
.p.long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_XPM,
.p.capabilities = AV_CODEC_CAP_DR1,
.priv_data_size = sizeof(XPMDecContext),
.close = xpm_decode_close,
}

Definition at line 439 of file xpmdec.c.

xpm_decode_close
static av_cold int xpm_decode_close(AVCodecContext *avctx)
Definition: xpmdec.c:428
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:254
xpm_decode_frame
static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
Definition: xpmdec.c:306
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
AV_CODEC_ID_XPM
@ AV_CODEC_ID_XPM
Definition: codec_id.h:278
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201