summaryrefslogtreecommitdiff
path: root/ffmpeg/libavcodec/eacmv.c
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
committerTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
commitf7813a5324be39d13ab536c245d15dfc602a7849 (patch)
treefad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/eacmv.c
parentb7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff)
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/eacmv.c')
-rw-r--r--ffmpeg/libavcodec/eacmv.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/ffmpeg/libavcodec/eacmv.c b/ffmpeg/libavcodec/eacmv.c
index 4e96c1a..b3ffb3f 100644
--- a/ffmpeg/libavcodec/eacmv.c
+++ b/ffmpeg/libavcodec/eacmv.c
@@ -123,28 +123,30 @@ static void cmv_decode_inter(CmvContext *s, AVFrame *frame, const uint8_t *buf,
int yoffset = ((buf[i] >> 4)) - 7;
if (s->last_frame->data[0])
cmv_motcomp(frame->data[0], frame->linesize[0],
- s->last_frame->data[0], s->last_frame->linesize[0],
- x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
+ s->last_frame->data[0], s->last_frame->linesize[0],
+ x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
}
i++;
}
}
-static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
+static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
{
- int pal_start, pal_count, i;
+ int pal_start, pal_count, i, ret;
if(buf_end - buf < 16) {
av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
- return;
+ return AVERROR_INVALIDDATA;
}
s->width = AV_RL16(&buf[4]);
s->height = AV_RL16(&buf[6]);
if (s->avctx->width!=s->width || s->avctx->height!=s->height) {
- avcodec_set_dimensions(s->avctx, s->width, s->height);
av_frame_unref(s->last_frame);
av_frame_unref(s->last2_frame);
+ ret = ff_set_dimensions(s->avctx, s->width, s->height);
+ if (ret < 0)
+ return ret;
}
s->avctx->time_base.num = 1;
@@ -158,6 +160,8 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t
s->palette[i] = 0xFFU << 24 | AV_RB24(buf);
buf += 3;
}
+
+ return 0;
}
#define EA_PREAMBLE_SIZE 8
@@ -179,7 +183,9 @@ static int cmv_decode_frame(AVCodecContext *avctx,
if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) {
unsigned size = AV_RL32(buf + 4);
- cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
+ ret = cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
+ if (ret < 0)
+ return ret;
if (size > buf_end - buf - EA_PREAMBLE_SIZE)
return -1;
buf += size;
@@ -225,6 +231,7 @@ static av_cold int cmv_decode_end(AVCodecContext *avctx){
AVCodec ff_eacmv_decoder = {
.name = "eacmv",
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_CMV,
.priv_data_size = sizeof(CmvContext),
@@ -232,5 +239,4 @@ AVCodec ff_eacmv_decoder = {
.close = cmv_decode_end,
.decode = cmv_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"),
};