@@ -632,6 +632,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
int mb_height, n_slices1=-1;
struct {
uint8_t *buf;
+ uint8_t *buf_start;
+ int buf_size;
GetBitContext gb;
int mby_start;
} *slices = NULL, *tmp;
@@ -738,6 +740,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
ret = AVERROR(ENOMEM);
goto err;
}
+
+ slices[n_slices].buf_start = start;
+ slices[n_slices].buf_size = size + 4;
+
buf_size3 = vc1_unescape_buffer(start + 4, size,
slices[n_slices].buf);
init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
@@ -951,10 +957,27 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
goto err;
} else {
s->picture_structure = PICT_FRAME;
+ s->mb_y = 0;
if ((ret = avctx->hwaccel->start_frame(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
goto err;
- if ((ret = avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
- goto err;
+ if (n_slices == 0) {
+ if ((ret = avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
+ goto err;
+ } else {
+ int i;
+ ret = avctx->hwaccel->decode_slice(avctx, buf_start, slices[0].buf_start - buf_start);
+ if (ret < 0)
+ goto err;
+ for (i = 0 ; i < n_slices; i++) {
+ s->gb = slices[i].gb;
+ s->mb_y = slices[i].mby_start;
+ if (get_bits(&s->gb, 1))
+ ff_vc1_parse_frame_header_adv(v, &s->gb);
+ ret = avctx->hwaccel->decode_slice(avctx, slices[i].buf_start, slices[i].buf_size);
+ if (ret < 0)
+ goto err;
+ }
+ }
if ((ret = avctx->hwaccel->end_frame(avctx)) < 0)
goto err;
}