summaryrefslogtreecommitdiff
path: root/ffmpeg/libavcodec/vqavideo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffmpeg/libavcodec/vqavideo.c')
-rw-r--r--ffmpeg/libavcodec/vqavideo.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/ffmpeg/libavcodec/vqavideo.c b/ffmpeg/libavcodec/vqavideo.c
index a47e2db..9133855 100644
--- a/ffmpeg/libavcodec/vqavideo.c
+++ b/ffmpeg/libavcodec/vqavideo.c
@@ -134,8 +134,15 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
/* load up the VQA parameters from the header */
s->vqa_version = s->avctx->extradata[0];
- if (s->vqa_version < 1 || s->vqa_version > 3) {
- av_log(s->avctx, AV_LOG_ERROR, "unsupported version %d\n", s->vqa_version);
+ switch (s->vqa_version) {
+ case 1:
+ case 2:
+ break;
+ case 3:
+ avpriv_report_missing_feature(avctx, "VQA Version %d", s->vqa_version);
+ return AVERROR_PATCHWELCOME;
+ default:
+ avpriv_request_sample(avctx, "VQA Version %i", s->vqa_version);
return AVERROR_PATCHWELCOME;
}
s->width = AV_RL16(&s->avctx->extradata[6]);
@@ -231,7 +238,7 @@ static int decode_format80(VqaContext *s, int src_size,
/* 0x80 means that frame is finished */
if (opcode == 0x80)
- return 0;
+ break;
if (dest_index >= dest_size) {
av_log(s->avctx, AV_LOG_ERROR, "decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n",
@@ -296,9 +303,11 @@ static int decode_format80(VqaContext *s, int src_size,
* codebook entry; it is not important for compressed codebooks because
* not every entry needs to be filled */
if (check_size)
- if (dest_index < dest_size)
+ if (dest_index < dest_size) {
av_log(s->avctx, AV_LOG_ERROR, "decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n",
dest_index, dest_size);
+ memset(dest + dest_index, 0, dest_size - dest_index);
+ }
return 0; // let's display what we decoded anyway
}
@@ -628,6 +637,7 @@ static av_cold int vqa_decode_end(AVCodecContext *avctx)
AVCodec ff_vqa_decoder = {
.name = "vqavideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WS_VQA,
.priv_data_size = sizeof(VqaContext),
@@ -635,5 +645,4 @@ AVCodec ff_vqa_decoder = {
.close = vqa_decode_end,
.decode = vqa_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"),
};