Beispiel #1
0
static int gif_parse_next_image(GifState *s)
{
    int ret, code;

    for (;;) {
        code = bytestream_get_byte(&s->bytestream);
#ifdef DEBUG
        dprintf("gif: code=%02x '%c'\n", code, code);
#endif
        switch (code) {
        case ',':
            if (gif_read_image(s) < 0)
                return -1;
            ret = 0;
            goto the_end;
        case ';':
            /* end of image */
            ret = -1;
            goto the_end;
        case '!':
            if (gif_read_extension(s) < 0)
                return -1;
            break;
        case EOF:
        default:
            /* error or errneous EOF */
            ret = -1;
            goto the_end;
        }
    }
  the_end:
    return ret;
}
Beispiel #2
0
static int gif_parse_next_image(GifState *s, int *got_picture)
{
    int ret;
    *got_picture = sizeof(AVPicture);
    while (s->bytestream < s->bytestream_end) {
        int code = bytestream_get_byte(&s->bytestream);

        av_dlog(s->avctx, "code=%02x '%c'\n", code, code);

        switch (code) {
        case GIF_IMAGE_SEPARATOR:
            return gif_read_image(s);
        case GIF_EXTENSION_INTRODUCER:
            if ((ret = gif_read_extension(s)) < 0)
                return ret;
            break;
        case GIF_TRAILER:
            /* end of image */
            *got_picture = 0;
            return 0;
        default:
            /* erroneous block label */
            return AVERROR_INVALIDDATA;
        }
    }
    return AVERROR_EOF;
}
Beispiel #3
0
static int gif_parse_next_image(GifState *s, AVFrame *frame)
{
    while (bytestream2_get_bytes_left(&s->gb) > 0) {
        int code = bytestream2_get_byte(&s->gb);
        int ret;

        av_log(s->avctx, AV_LOG_DEBUG, "code=%02x '%c'\n", code, code);

        switch (code) {
        case GIF_IMAGE_SEPARATOR:
            return gif_read_image(s, frame);
        case GIF_EXTENSION_INTRODUCER:
            if ((ret = gif_read_extension(s)) < 0)
                return ret;
            break;
        case GIF_TRAILER:
            /* end of image */
            return AVERROR_EOF;
        default:
            /* erroneous block label */
            return AVERROR_INVALIDDATA;
        }
    }
    return AVERROR_EOF;
}
Beispiel #4
0
static int gif_parse_next_image(GifState *s)
{
    while (s->bytestream < s->bytestream_end) {
        int code = bytestream_get_byte(&s->bytestream);
#ifdef DEBUG
        dprintf(s->avctx, "gif: code=%02x '%c'\n", code, code);
#endif
        switch (code) {
        case ',':
            return gif_read_image(s);
        case '!':
            if (gif_read_extension(s) < 0)
                return -1;
            break;
        case ';':
            /* end of image */
        default:
            /* error or erroneous EOF */
            return -1;
        }
    }
    return -1;
}
Beispiel #5
0
static int gif_parse_next_image(GifState *s, AVFrame *frame)
{
    while (bytestream2_get_bytes_left(&s->gb) > 0) {
        int code = bytestream2_get_byte(&s->gb);
        int ret;

        av_dlog(s->avctx, "gif: code=%02x '%c'\n", code, code);

        switch (code) {
        case ',':
            return gif_read_image(s, frame);
        case '!':
            if ((ret = gif_read_extension(s)) < 0)
                return ret;
            break;
        case ';':
        /* end of image */
        default:
            /* error or erroneous EOF */
            return AVERROR_INVALIDDATA;
        }
    }
    return AVERROR_INVALIDDATA;
}