diff options
author | Dirk Ausserhaus <dausserhaus@gmail.com> | 2014-06-20 20:15:20 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2014-06-23 09:29:39 +0200 |
commit | e121ac634ba324a318f4a97f978dcfb48da6b735 (patch) | |
tree | 50bbdb76b3190e0a87c26302a41dc7e89b98437f | |
parent | c67b449bebbe0b35c73b203683e77a0a649bc765 (diff) | |
download | ffmpeg-e121ac634ba324a318f4a97f978dcfb48da6b735.tar.gz |
indeo45: use is_indeo4 context flag instead of checking codec ID
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
-rw-r--r-- | libavcodec/indeo4.c | 2 | ||||
-rw-r--r-- | libavcodec/indeo5.c | 2 | ||||
-rw-r--r-- | libavcodec/ivi_common.c | 10 | ||||
-rw-r--r-- | libavcodec/ivi_common.h | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c index 3e97221229..6893077346 100644 --- a/libavcodec/indeo4.c +++ b/libavcodec/indeo4.c @@ -620,6 +620,8 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->switch_buffers = switch_buffers; ctx->is_nonnull_frame = is_nonnull_frame; + ctx->is_indeo4 = 1; + ctx->p_frame = av_frame_alloc(); if (!ctx->p_frame) return AVERROR(ENOMEM); diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c index 476355b633..2465ce6c1c 100644 --- a/libavcodec/indeo5.c +++ b/libavcodec/indeo5.c @@ -640,6 +640,8 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->switch_buffers = switch_buffers; ctx->is_nonnull_frame = is_nonnull_frame; + ctx->is_indeo4 = 0; + avctx->pix_fmt = AV_PIX_FMT_YUV410P; return 0; diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index 6eb5b6cdf4..93936c220c 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -968,8 +968,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (ctx->gop_invalid) return AVERROR_INVALIDDATA; - if (avctx->codec_id == AV_CODEC_ID_INDEO4 && - ctx->frame_type == IVI4_FRAMETYPE_NULL_LAST) { + if (ctx->is_indeo4 && ctx->frame_type == IVI4_FRAMETYPE_NULL_LAST) { if (ctx->got_p_frame) { av_frame_move_ref(data, ctx->p_frame); *got_frame = 1; @@ -1027,7 +1026,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } if (ctx->is_scalable) { - if (avctx->codec_id == AV_CODEC_ID_INDEO4) + if (ctx->is_indeo4) ff_ivi_recompose_haar(&ctx->planes[0], frame->data[0], frame->linesize[0]); else ff_ivi_recompose53 (&ctx->planes[0], frame->data[0], frame->linesize[0]); @@ -1045,8 +1044,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, * to be the only way to handle the B-frames mode. * That's exactly the same Intel decoders do. */ - if (avctx->codec_id == AV_CODEC_ID_INDEO4 && - ctx->frame_type == IVI4_FRAMETYPE_INTRA) { + if (ctx->is_indeo4 && ctx->frame_type == IVI4_FRAMETYPE_INTRA) { int left; while (get_bits(&ctx->gb, 8)); // skip version string @@ -1077,7 +1075,7 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx) ff_free_vlc(&ctx->mb_vlc.cust_tab); #if IVI4_STREAM_ANALYSER - if (avctx->codec_id == AV_CODEC_ID_INDEO4) { + if (ctx->is_indeo4) { if (ctx->is_scalable) av_log(avctx, AV_LOG_ERROR, "This video uses scalability mode!\n"); if (ctx->uses_tiling) diff --git a/libavcodec/ivi_common.h b/libavcodec/ivi_common.h index 604b54958b..515b073ca9 100644 --- a/libavcodec/ivi_common.h +++ b/libavcodec/ivi_common.h @@ -261,6 +261,8 @@ typedef struct IVI45DecContext { int gop_invalid; + int is_indeo4; + AVFrame *p_frame; int got_p_frame; } IVI45DecContext; |