Merge commit 'f337c29017b10c98ccb4dce20efced4c74b665f6'

* commit 'f337c29017b10c98ccb4dce20efced4c74b665f6':
  eatgq: return meaningful error codes.
  eatgv: cosmetics, reformat

Conflicts:
	libavcodec/eatgq.c
	libavcodec/eatgv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-01-26 14:47:08 +01:00
commit 325ee4ed7a
2 changed files with 81 additions and 76 deletions

View File

@ -194,12 +194,12 @@ static int tgq_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
TgqContext *s = avctx->priv_data;
int x,y;
int x, y, ret;
int big_endian;
if (buf_size < 16) {
av_log(avctx, AV_LOG_WARNING, "truncated header\n");
return -1;
return AVERROR_INVALIDDATA;
}
big_endian = AV_RL32(&buf[4]) > 0x000FFFFF;
bytestream2_init(&s->gb, buf + 8, buf_size - 8);
@ -223,9 +223,9 @@ static int tgq_decode_frame(AVCodecContext *avctx,
s->frame.key_frame = 1;
s->frame.pict_type = AV_PICTURE_TYPE_I;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
if (ff_get_buffer(avctx, &s->frame)) {
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
return ret;
}
}

View File

@ -50,7 +50,8 @@ typedef struct TgvContext {
int num_blocks_packed; ///< current length of block_codebook
} TgvContext;
static av_cold int tgv_decode_init(AVCodecContext *avctx){
static av_cold int tgv_decode_init(AVCodecContext *avctx)
{
TgvContext *s = avctx->priv_data;
s->avctx = avctx;
avctx->time_base = (AVRational){1, 15};
@ -64,7 +65,9 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx){
* Unpack buffer
* @return 0 on success, -1 on critical buffer underflow
*/
static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst, int width, int height) {
static int unpack(const uint8_t *src, const uint8_t *src_end,
unsigned char *dst, int width, int height)
{
unsigned char *dst_end = dst + width*height;
int size, size1, size2, offset, run;
unsigned char *dst_start = dst;
@ -137,7 +140,9 @@ static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst
* Decode inter-frame
* @return 0 on success, -1 on critical buffer underflow
*/
static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *buf_end){
static int tgv_decode_inter(TgvContext *s, const uint8_t *buf,
const uint8_t *buf_end)
{
int num_mvs;
int num_blocks_raw;
int num_blocks_packed;
@ -215,8 +220,8 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b
int mx = x * 4 + s->mv_codebook[vector][0];
int my = y * 4 + s->mv_codebook[vector][1];
if ( mx < 0 || mx + 4 > s->avctx->width
|| my < 0 || my + 4 > s->avctx->height) {
if (mx < 0 || mx + 4 > s->avctx->width ||
my < 0 || my + 4 > s->avctx->height) {
av_log(s->avctx, AV_LOG_ERROR, "MV %d %d out of picture\n", mx, my);
continue;
}