vc1: wait for bitstream recovery before starting decoding
This commit is contained in:
parent
40e6cb85f5
commit
135dbf0580
|
@ -396,6 +396,8 @@ typedef struct VC1Context{
|
||||||
|
|
||||||
int parse_only; ///< Context is used within parser
|
int parse_only; ///< Context is used within parser
|
||||||
int resync_marker; ///< could this stream contain resync markers
|
int resync_marker; ///< could this stream contain resync markers
|
||||||
|
|
||||||
|
int recovered;
|
||||||
} VC1Context;
|
} VC1Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1045,6 +1045,13 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!v->recovered && !(avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL)) {
|
||||||
|
if (s->pict_type == AV_PICTURE_TYPE_I)
|
||||||
|
v->recovered = 1;
|
||||||
|
else
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
/* skip B-frames if we don't have reference frames */
|
/* skip B-frames if we don't have reference frames */
|
||||||
if (!s->last_picture_ptr && s->pict_type == AV_PICTURE_TYPE_B) {
|
if (!s->last_picture_ptr && s->pict_type == AV_PICTURE_TYPE_B) {
|
||||||
av_log(v->s.avctx, AV_LOG_DEBUG, "Skipping B frame without reference frames\n");
|
av_log(v->s.avctx, AV_LOG_DEBUG, "Skipping B frame without reference frames\n");
|
||||||
|
@ -1381,6 +1388,14 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vc1_decode_flush(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
VC1Context *v = avctx->priv_data;
|
||||||
|
|
||||||
|
ff_mpeg_flush(avctx);
|
||||||
|
|
||||||
|
v->recovered = 0;
|
||||||
|
}
|
||||||
|
|
||||||
const FFCodec ff_vc1_decoder = {
|
const FFCodec ff_vc1_decoder = {
|
||||||
.p.name = "vc1",
|
.p.name = "vc1",
|
||||||
|
@ -1391,7 +1406,7 @@ const FFCodec ff_vc1_decoder = {
|
||||||
.init = vc1_decode_init,
|
.init = vc1_decode_init,
|
||||||
.close = ff_vc1_decode_end,
|
.close = ff_vc1_decode_end,
|
||||||
FF_CODEC_DECODE_CB(vc1_decode_frame),
|
FF_CODEC_DECODE_CB(vc1_decode_frame),
|
||||||
.flush = ff_mpeg_flush,
|
.flush = vc1_decode_flush,
|
||||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||||
.hw_configs = (const AVCodecHWConfigInternal *const []) {
|
.hw_configs = (const AVCodecHWConfigInternal *const []) {
|
||||||
#if CONFIG_VC1_DXVA2_HWACCEL
|
#if CONFIG_VC1_DXVA2_HWACCEL
|
||||||
|
@ -1430,7 +1445,7 @@ const FFCodec ff_wmv3_decoder = {
|
||||||
.init = vc1_decode_init,
|
.init = vc1_decode_init,
|
||||||
.close = ff_vc1_decode_end,
|
.close = ff_vc1_decode_end,
|
||||||
FF_CODEC_DECODE_CB(vc1_decode_frame),
|
FF_CODEC_DECODE_CB(vc1_decode_frame),
|
||||||
.flush = ff_mpeg_flush,
|
.flush = vc1_decode_flush,
|
||||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||||
.hw_configs = (const AVCodecHWConfigInternal *const []) {
|
.hw_configs = (const AVCodecHWConfigInternal *const []) {
|
||||||
#if CONFIG_WMV3_DXVA2_HWACCEL
|
#if CONFIG_WMV3_DXVA2_HWACCEL
|
||||||
|
|
Loading…
Reference in New Issue