summaryrefslogtreecommitdiff
path: root/libavcodec/interplayvideo.c
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2017-06-25 21:59:00 +0200
committerPaul B Mahol <onemda@gmail.com>2017-06-27 15:03:51 +0200
commitba2c385006e3100d6cd506f61c53186ba054a06d (patch)
tree26ecd9f30b86ae061c72bd7f9dd8ac4bb25af268 /libavcodec/interplayvideo.c
parentbbaca6e867999699c026f0de1267f7a5ae06684b (diff)
Interplay MVE: Implement MVE SEND_BUFFER operation
Interplay MVE movies have a SEND_BUFFER operation. Only after this command does the current decoding buffer get displayed. This is required for the other frame formats. They are fixed-size and can't always encode a full frame worth of pixeldata. This code prevents half-finished frames from being emitted. Signed-off-by: Hein-Pieter van Braam <hp@tmm.cx>
Diffstat (limited to 'libavcodec/interplayvideo.c')
-rw-r--r--libavcodec/interplayvideo.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index df3314d4b7..7c699265dd 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -990,17 +990,20 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
IpvideoContext *s = avctx->priv_data;
AVFrame *frame = data;
int ret;
+ int send_buffer;
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
av_frame_unref(s->last_frame);
av_frame_unref(s->second_last_frame);
}
- if (buf_size < 2)
+ if (buf_size < 3)
return AVERROR_INVALIDDATA;
+ send_buffer = AV_RL8(avpkt->data);
+
/* decoding map contains 4 bits of information per 8x8 block */
- s->decoding_map_size = AV_RL16(avpkt->data);
+ s->decoding_map_size = AV_RL16(avpkt->data + 1);
/* compressed buffer needs to be large enough to at least hold an entire
* decoding map */
@@ -1008,9 +1011,9 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
return buf_size;
- s->decoding_map = buf + 2;
- bytestream2_init(&s->stream_ptr, buf + 2 + s->decoding_map_size,
- buf_size - s->decoding_map_size);
+ s->decoding_map = buf + 3;
+ bytestream2_init(&s->stream_ptr, buf + 3 + s->decoding_map_size,
+ buf_size - s->decoding_map_size - 3);
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
@@ -1028,7 +1031,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
ipvideo_decode_opcodes(s, frame);
- *got_frame = 1;
+ *got_frame = send_buffer;
/* shuffle frames */
av_frame_unref(s->second_last_frame);