34 typedef enum GIFParseStates {
57 int buf_size,
void *logctx)
83 g->gct_flag = !!(buf[
index] & 0x80);
84 g->gct_size = 3 * (1 << ((buf[
index] & 0x07) + 1));
86 if (
g->index >= 12 +
g->gct_flag *
g->gct_size) {
95 if (
g->found_start &&
g->found_end &&
g->found_sig) {
109 g->block_size = buf[
index];
117 g->block_size = buf[
index];
118 if (
g->index >=
g->block_size) {
120 if (!
g->block_size) {
131 if (
g->index >= 1 &&
g->index <= 2) {
132 g->delay |= buf[
index] << (8 * (
g->index - 1));
135 if (
g->index >=
g->block_size) {
136 g->block_size = buf[
index];
145 g->gct_flag = !!(buf[
index] & 0x80);
146 g->gct_size = 3 * (1 << ((buf[
index] & 0x07) + 1));
148 if (
g->index >= 10 +
g->gct_flag *
g->gct_size) {
163 const uint8_t **poutbuf,
int *poutbuf_size,
164 const uint8_t *buf,
int buf_size)
176 s->duration =
g->delay;
179 *poutbuf_size = buf_size;
simple assert() macros that are a bit more flexible than ISO C assert().
common internal and external API header
#define GIF_IMAGE_SEPARATOR
static const uint8_t gif89a_sig[6]
#define GIF_EXTENSION_INTRODUCER
static const uint8_t gif87a_sig[6]
#define GIF_GCE_EXT_LABEL
static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
static int gif_find_frame_end(GIFParseContext *g, const uint8_t *buf, int buf_size, void *logctx)
AVCodecParser ff_gif_parser
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
void ff_parse_close(AVCodecParserContext *s)
main external API structure.