FFmpeg
Data Structures | Macros | Functions | Variables
gifdec.c File Reference
#include "avformat.h"
#include "demux.h"
#include "libavutil/bprint.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avio_internal.h"
#include "internal.h"
#include "libavcodec/gif.h"

Go to the source code of this file.

Data Structures

struct  GIFDemuxContext
 

Macros

#define GIF_PACKET_SIZE   1024
 
#define GIF_DEFAULT_DELAY   10
 Major web browsers display gifs at ~10-15fps when rate is not explicitly set or have too low values. More...
 
#define GIF_MIN_DELAY   2
 By default delay values less than this threshold considered to be invalid. More...
 

Functions

static int gif_probe (const AVProbeData *p)
 
static int resync (AVIOContext *pb)
 
static int gif_skip_subblocks (AVIOContext *pb)
 
static int gif_read_header (AVFormatContext *s)
 
static int gif_read_packet (AVFormatContext *s, AVPacket *pkt)
 

Variables

static const AVOption options []
 
static const AVClass demuxer_class
 
const FFInputFormat ff_gif_demuxer
 

Detailed Description

GIF demuxer.

Definition in file gifdec.c.

Macro Definition Documentation

◆ GIF_PACKET_SIZE

#define GIF_PACKET_SIZE   1024

Definition at line 36 of file gifdec.c.

◆ GIF_DEFAULT_DELAY

#define GIF_DEFAULT_DELAY   10

Major web browsers display gifs at ~10-15fps when rate is not explicitly set or have too low values.

We assume default rate to be 10. Default delay = 100hundredths of second / 10fps = 10hos per frame.

Definition at line 67 of file gifdec.c.

◆ GIF_MIN_DELAY

#define GIF_MIN_DELAY   2

By default delay values less than this threshold considered to be invalid.

Definition at line 71 of file gifdec.c.

Function Documentation

◆ gif_probe()

static int gif_probe ( const AVProbeData p)
static

Definition at line 73 of file gifdec.c.

◆ resync()

static int resync ( AVIOContext pb)
static

Definition at line 86 of file gifdec.c.

Referenced by gif_read_header().

◆ gif_skip_subblocks()

static int gif_skip_subblocks ( AVIOContext pb)
static

Definition at line 99 of file gifdec.c.

Referenced by gif_read_header().

◆ gif_read_header()

static int gif_read_header ( AVFormatContext s)
static

Definition at line 111 of file gifdec.c.

◆ gif_read_packet()

static int gif_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 241 of file gifdec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "min_delay" , "minimum valid delay between frames (in hundredths of second)", 0x42 , AV_OPT_TYPE_INT, {.i64 = GIF_MIN_DELAY} , 0, 100 * 60, AV_OPT_FLAG_DECODING_PARAM },
{ "max_gif_delay", "maximum valid delay between frames (in hundredths of seconds)", 0x42 , AV_OPT_TYPE_INT, {.i64 = 65535} , 0, 65535 , AV_OPT_FLAG_DECODING_PARAM },
{ "default_delay", "default delay between frames (in hundredths of second)" , 0x42, AV_OPT_TYPE_INT, {.i64 = GIF_DEFAULT_DELAY}, 0, 100 * 60, AV_OPT_FLAG_DECODING_PARAM },
{ "ignore_loop" , "ignore loop setting (netscape extension)" , 0x42 , AV_OPT_TYPE_BOOL,{.i64 = 1} , 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
}

Definition at line 266 of file gifdec.c.

◆ demuxer_class

const AVClass demuxer_class
static
Initial value:
= {
.class_name = "GIF demuxer",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 274 of file gifdec.c.

◆ ff_gif_demuxer

const FFInputFormat ff_gif_demuxer
Initial value:
= {
.p.name = "gif",
.p.long_name = NULL_IF_CONFIG_SMALL("CompuServe Graphics Interchange Format (GIF)"),
.p.flags = AVFMT_GENERIC_INDEX,
.p.extensions = "gif",
.p.priv_class = &demuxer_class,
.priv_data_size = sizeof(GIFDemuxContext),
}

Definition at line 282 of file gifdec.c.

GIF_MIN_DELAY
#define GIF_MIN_DELAY
By default delay values less than this threshold considered to be invalid.
Definition: gifdec.c:71
options
static const AVOption options[]
Definition: gifdec.c:266
GIFDemuxContext
Definition: gifdec.c:38
gif_read_header
static int gif_read_header(AVFormatContext *s)
Definition: gifdec.c:111
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:480
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
AV_CLASS_CATEGORY_DEMUXER
@ AV_CLASS_CATEGORY_DEMUXER
Definition: log.h:33
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
NULL
#define NULL
Definition: coverity.c:32
demuxer_class
static const AVClass demuxer_class
Definition: gifdec.c:274
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
gif_read_packet
static int gif_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: gifdec.c:241
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:94
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
gif_probe
static int gif_probe(const AVProbeData *p)
Definition: gifdec.c:73
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:273
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
GIF_DEFAULT_DELAY
#define GIF_DEFAULT_DELAY
Major web browsers display gifs at ~10-15fps when rate is not explicitly set or have too low values.
Definition: gifdec.c:67