FFmpeg
Data Structures | Macros | Functions | Variables
gifdec.c File Reference
#include "libavutil/opt.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "lzw.h"
#include "gif.h"

Go to the source code of this file.

Data Structures

struct  GifState
 

Macros

#define GIF_TRANSPARENT_COLOR   0x00ffffff
 

Functions

static void gif_read_palette (GifState *s, uint32_t *pal, int nb)
 
static void gif_fill (AVFrame *picture, uint32_t color)
 
static void gif_fill_rect (AVFrame *picture, uint32_t color, int l, int t, int w, int h)
 
static void gif_copy_img_rect (const uint8_t *src, uint8_t *dst, ptrdiff_t src_linesize, ptrdiff_t dst_linesize, int l, int t, int w, int h)
 
static int gif_read_image (GifState *s, AVFrame *frame)
 
static int gif_read_extension (GifState *s)
 
static int gif_read_header1 (GifState *s)
 
static int gif_parse_next_image (GifState *s, AVFrame *frame)
 
static av_cold int gif_decode_init (AVCodecContext *avctx)
 
static int gif_decode_frame (AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
 
static av_cold int gif_decode_close (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass decoder_class
 
const FFCodec ff_gif_decoder
 

Macro Definition Documentation

◆ GIF_TRANSPARENT_COLOR

#define GIF_TRANSPARENT_COLOR   0x00ffffff

Definition at line 36 of file gifdec.c.

Function Documentation

◆ gif_read_palette()

static void gif_read_palette ( GifState s,
uint32_t *  pal,
int  nb 
)
static

Definition at line 79 of file gifdec.c.

Referenced by gif_read_header1(), and gif_read_image().

◆ gif_fill()

static void gif_fill ( AVFrame picture,
uint32_t  color 
)
static

Definition at line 87 of file gifdec.c.

Referenced by gif_read_image().

◆ gif_fill_rect()

static void gif_fill_rect ( AVFrame picture,
uint32_t  color,
int  l,
int  t,
int  w,
int  h 
)
static

Definition at line 102 of file gifdec.c.

Referenced by gif_read_image().

◆ gif_copy_img_rect()

static void gif_copy_img_rect ( const uint8_t *  src,
uint8_t *  dst,
ptrdiff_t  src_linesize,
ptrdiff_t  dst_linesize,
int  l,
int  t,
int  w,
int  h 
)
static

Definition at line 115 of file gifdec.c.

Referenced by gif_read_image().

◆ gif_read_image()

static int gif_read_image ( GifState s,
AVFrame frame 
)
static

Definition at line 132 of file gifdec.c.

Referenced by gif_parse_next_image().

◆ gif_read_extension()

static int gif_read_extension ( GifState s)
static

Definition at line 318 of file gifdec.c.

Referenced by gif_parse_next_image().

◆ gif_read_header1()

static int gif_read_header1 ( GifState s)
static

Definition at line 379 of file gifdec.c.

Referenced by gif_decode_frame().

◆ gif_parse_next_image()

static int gif_parse_next_image ( GifState s,
AVFrame frame 
)
static

Definition at line 428 of file gifdec.c.

Referenced by gif_decode_frame().

◆ gif_decode_init()

static av_cold int gif_decode_init ( AVCodecContext avctx)
static

Definition at line 454 of file gifdec.c.

◆ gif_decode_frame()

static int gif_decode_frame ( AVCodecContext avctx,
AVFrame rframe,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 470 of file gifdec.c.

◆ gif_decode_close()

static av_cold int gif_decode_close ( AVCodecContext avctx)
static

Definition at line 523 of file gifdec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "trans_color", "color value (ARGB) that is used instead of transparent color",
{.i64 = GIF_TRANSPARENT_COLOR}, 0, 0xffffffff,
{ NULL },
}

Definition at line 535 of file gifdec.c.

◆ decoder_class

const AVClass decoder_class
static
Initial value:
= {
.class_name = "gif decoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 543 of file gifdec.c.

◆ ff_gif_decoder

const FFCodec ff_gif_decoder
Initial value:
= {
.p.name = "gif",
CODEC_LONG_NAME("GIF (Graphics Interchange Format)"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_GIF,
.priv_data_size = sizeof(GifState),
.close = gif_decode_close,
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &decoder_class,
}

Definition at line 551 of file gifdec.c.

GIF_TRANSPARENT_COLOR
#define GIF_TRANSPARENT_COLOR
Definition: gifdec.c:36
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
AV_CLASS_CATEGORY_DECODER
@ AV_CLASS_CATEGORY_DECODER
Definition: log.h:35
AV_OPT_FLAG_VIDEO_PARAM
#define AV_OPT_FLAG_VIDEO_PARAM
Definition: opt.h:284
options
static const AVOption options[]
Definition: gifdec.c:535
gif_decode_frame
static int gif_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
Definition: gifdec.c:470
gif_decode_init
static av_cold int gif_decode_init(AVCodecContext *avctx)
Definition: gifdec.c:454
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:306
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
decoder_class
static const AVClass decoder_class
Definition: gifdec.c:543
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
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
AV_CODEC_ID_GIF
@ AV_CODEC_ID_GIF
Definition: codec_id.h:149
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:282
GifState
Definition: gifdec.c:38
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
gif_decode_close
static av_cold int gif_decode_close(AVCodecContext *avctx)
Definition: gifdec.c:523