* Electronic Arts TGV Video Decoder
* Copyright (c) 2007-2008 Peter Ross
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
- * @file libavcodec/eatgv.c
+ * @file
* Electronic Arts TGV Video Decoder
- * by Peter Ross (suxen_drol at hotmail dot com)
+ * by Peter Ross (pross@xvid.org)
*
* Technical details here:
* http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TGV
#define ALT_BITSTREAM_READER_LE
#include "get_bits.h"
#include "libavutil/lzo.h"
+#include "libavutil/imgutils.h"
#define EA_PREAMBLE_SIZE 8
#define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
s->block_codebook[i][15-j] = tmp[get_bits(&gb, 2)];
}
+ if (get_bits_left(&gb) < vector_bits *
+ (s->avctx->height/4) * (s->avctx->width/4))
+ return -1;
+
/* read vectors and build frame */
for(y=0; y<s->avctx->height/4; y++)
for(x=0; x<s->avctx->width/4; x++) {
}
}
- if (avcodec_check_dimensions(avctx, s->width, s->height))
+ if (av_image_check_size(s->width, s->height, 0, avctx))
return -1;
/* shuffle */
/* allocate additional 12 bytes to accomodate av_memcpy_backptr() OUTBUF_PADDED optimisation */
s->frame.data[0] = av_malloc(s->width*s->height + 12);
if (!s->frame.data[0])
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
s->frame.data[1] = av_malloc(AVPALETTE_SIZE);
if (!s->frame.data[1]) {
av_freep(&s->frame.data[0]);
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
}
}
memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
return 0;
}
-AVCodec eatgv_decoder = {
+AVCodec ff_eatgv_decoder = {
"eatgv",
- CODEC_TYPE_VIDEO,
+ AVMEDIA_TYPE_VIDEO,
CODEC_ID_TGV,
sizeof(TgvContext),
tgv_decode_init,