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

Go to the source code of this file.

Data Structures

struct  GIFContext
 

Macros

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

Functions

static av_cold int gif_init (AVFormatContext *s)
 
static int gif_parse_packet (AVFormatContext *s, const uint8_t *data, int size)
 
static int gif_get_delay (GIFContext *gif, AVPacket *prev, AVPacket *new)
 
static int gif_write_packet (AVFormatContext *s, AVPacket *new_pkt)
 
static int gif_write_trailer (AVFormatContext *s)
 

Variables

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

Macro Definition Documentation

◆ OFFSET

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

Definition at line 183 of file gif.c.

◆ ENC

#define ENC   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 184 of file gif.c.

Function Documentation

◆ gif_init()

static av_cold int gif_init ( AVFormatContext s)
static

Definition at line 43 of file gif.c.

◆ gif_parse_packet()

static int gif_parse_packet ( AVFormatContext s,
const uint8_t *  data,
int  size 
)
static

Definition at line 50 of file gif.c.

Referenced by gif_write_packet().

◆ gif_get_delay()

static int gif_get_delay ( GIFContext gif,
AVPacket prev,
AVPacket new 
)
static

Definition at line 77 of file gif.c.

Referenced by gif_write_packet().

◆ gif_write_packet()

static int gif_write_packet ( AVFormatContext s,
AVPacket new_pkt 
)
static

Definition at line 89 of file gif.c.

Referenced by gif_write_trailer().

◆ gif_write_trailer()

static int gif_write_trailer ( AVFormatContext s)
static

Definition at line 166 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 },
}

Definition at line 185 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,
}

Definition at line 193 of file gif.c.

◆ ff_gif_muxer

const FFOutputFormat ff_gif_muxer
Initial value:
= {
.p.name = "gif",
.p.long_name = NULL_IF_CONFIG_SMALL("CompuServe Graphics Interchange Format (GIF)"),
.p.mime_type = "image/gif",
.p.extensions = "gif",
.priv_data_size = sizeof(GIFContext),
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_GIF,
.p.subtitle_codec = AV_CODEC_ID_NONE,
.flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
.init = gif_init,
.write_packet = gif_write_packet,
.write_trailer = gif_write_trailer,
.p.priv_class = &gif_muxer_class,
.p.flags = AVFMT_VARIABLE_FPS,
}

Definition at line 200 of file gif.c.

gif_init
static av_cold int gif_init(AVFormatContext *s)
Definition: gif.c:43
AVFMT_VARIABLE_FPS
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:482
FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
If this flag is set, then the only permitted audio/video/subtitle codec ids are AVOutputFormat....
Definition: mux.h:59
ENC
#define ENC
Definition: gif.c:184
loop
static int loop
Definition: ffplay.c:338
gif_muxer_class
static const AVClass gif_muxer_class
Definition: gif.c:193
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
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:106
GIFContext
Definition: gif.c:43
gif_write_trailer
static int gif_write_trailer(AVFormatContext *s)
Definition: gif.c:166
AV_CODEC_ID_GIF
@ AV_CODEC_ID_GIF
Definition: codec_id.h:149
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
FF_OFMT_FLAG_MAX_ONE_OF_EACH
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH
If this flag is set, it indicates that for each codec type whose corresponding default codec (i....
Definition: mux.h:50
options
static const AVOption options[]
Definition: gif.c:185
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
gif_write_packet
static int gif_write_packet(AVFormatContext *s, AVPacket *new_pkt)
Definition: gif.c:89
OFFSET
#define OFFSET(x)
Definition: gif.c:183