FFmpeg  4.0
Data Structures | Macros | Functions | Variables
gif.c File Reference
#include "avformat.h"
#include "internal.h"
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  GIFContext
 

Macros

#define DEFAULT_TRANSPARENCY_INDEX   0x1f
 
#define OFFSET(x)   offsetof(GIFContext, x)
 
#define ENC   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int get_palette_transparency_index (const uint32_t *palette)
 
static int gif_image_write_header (AVIOContext *pb, AVStream *st, int loop_count, uint32_t *palette)
 
static int gif_write_header (AVFormatContext *s)
 
static int flush_packet (AVFormatContext *s, AVPacket *new)
 
static int gif_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int gif_write_trailer (AVFormatContext *s)
 

Variables

static const AVOption options []
 
static const AVClass gif_muxer_class
 
AVOutputFormat ff_gif_muxer
 

Macro Definition Documentation

◆ DEFAULT_TRANSPARENCY_INDEX

#define DEFAULT_TRANSPARENCY_INDEX   0x1f

Definition at line 33 of file gif.c.

Referenced by flush_packet(), and gif_image_write_header().

◆ OFFSET

#define OFFSET (   x)    offsetof(GIFContext, x)

Definition at line 226 of file gif.c.

◆ ENC

#define ENC   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 227 of file gif.c.

Function Documentation

◆ get_palette_transparency_index()

static int get_palette_transparency_index ( const uint32_t *  palette)
static

Definition at line 35 of file gif.c.

Referenced by flush_packet(), and gif_image_write_header().

◆ gif_image_write_header()

static int gif_image_write_header ( AVIOContext pb,
AVStream st,
int  loop_count,
uint32_t *  palette 
)
static

Definition at line 53 of file gif.c.

Referenced by gif_write_header(), and gif_write_packet().

◆ gif_write_header()

static int gif_write_header ( AVFormatContext s)
static

Definition at line 112 of file gif.c.

◆ flush_packet()

static int flush_packet ( AVFormatContext s,
AVPacket new 
)
static

Definition at line 140 of file gif.c.

Referenced by gif_write_packet(), and gif_write_trailer().

◆ gif_write_packet()

static int gif_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 183 of file gif.c.

◆ gif_write_trailer()

static int gif_write_trailer ( AVFormatContext s)
static

Definition at line 214 of file gif.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "loop", "Number of times to loop the output: -1 - no loop, 0 - infinite loop", OFFSET(loop),
AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 65535, ENC },
{ "final_delay", "Force delay (in centiseconds) after the last frame", OFFSET(last_delay),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 65535, ENC },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: gif.c:226
#define ENC
Definition: gif.c:227
static int loop
Definition: ffplay.c:336

Definition at line 228 of file gif.c.

◆ gif_muxer_class

const AVClass gif_muxer_class
static
Initial value:
= {
.class_name = "GIF muxer",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
static const AVOption options[]
Definition: gif.c:228

Definition at line 236 of file gif.c.

◆ ff_gif_muxer

AVOutputFormat ff_gif_muxer
Initial value:
= {
.name = "gif",
.long_name = NULL_IF_CONFIG_SMALL("GIF Animation"),
.mime_type = "image/gif",
.extensions = "gif",
.priv_data_size = sizeof(GIFContext),
.audio_codec = AV_CODEC_ID_NONE,
.video_codec = AV_CODEC_ID_GIF,
.priv_class = &gif_muxer_class,
}
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:679
static int gif_write_header(AVFormatContext *s)
Definition: gif.c:112
static const AVClass gif_muxer_class
Definition: gif.c:236
static int flags
Definition: log.c:55
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
Definition: gif.c:42
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
static int gif_write_trailer(AVFormatContext *s)
Definition: gif.c:214
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:472
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:337
static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: gif.c:183

Definition at line 243 of file gif.c.