diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
| commit | f7813a5324be39d13ab536c245d15dfc602a7849 (patch) | |
| tree | fad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/sanm.c | |
| parent | b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff) | |
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/sanm.c')
| -rw-r--r-- | ffmpeg/libavcodec/sanm.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/ffmpeg/libavcodec/sanm.c b/ffmpeg/libavcodec/sanm.c index f217ef3..a6c1c01 100644 --- a/ffmpeg/libavcodec/sanm.c +++ b/ffmpeg/libavcodec/sanm.c @@ -732,12 +732,16 @@ static int process_frame_obj(SANMVideoContext *ctx) w = bytestream2_get_le16u(&ctx->gb); h = bytestream2_get_le16u(&ctx->gb); + if (!w || !h) { + av_log(ctx->avctx, AV_LOG_ERROR, "dimensions are invalid\n"); + return AVERROR_INVALIDDATA; + } + if (ctx->width < left + w || ctx->height < top + h) { - if (av_image_check_size(FFMAX(left + w, ctx->width), - FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0) - return AVERROR_INVALIDDATA; - avcodec_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width), - FFMAX(top + h, ctx->height)); + int ret = ff_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width), + FFMAX(top + h, ctx->height)); + if (ret < 0) + return ret; init_sizes(ctx, FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height)); if (init_buffers(ctx)) { @@ -1039,8 +1043,10 @@ static int decode_5(SANMVideoContext *ctx) #if HAVE_BIGENDIAN npixels = ctx->npixels; frm = ctx->frm0; - while (npixels--) - *frm++ = av_bswap16(*frm); + while (npixels--) { + *frm = av_bswap16(*frm); + frm++; + } #endif return 0; @@ -1289,6 +1295,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, AVCodec ff_sanm_decoder = { .name = "sanm", + .long_name = NULL_IF_CONFIG_SMALL("LucasArts SMUSH video"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_SANM, .priv_data_size = sizeof(SANMVideoContext), @@ -1296,5 +1303,4 @@ AVCodec ff_sanm_decoder = { .close = decode_end, .decode = decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("LucasArts SMUSH video"), }; |
