X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Fh263dec.c;h=4ef7825f0c681bb8c39533b747c0ba52679536c1;hp=e5870faa299d54ab15f8427b5a3459df33714ff4;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/h263dec.c b/ffmpeg/libavcodec/h263dec.c index e5870fa..4ef7825 100644 --- a/ffmpeg/libavcodec/h263dec.c +++ b/ffmpeg/libavcodec/h263dec.c @@ -43,6 +43,14 @@ #include "vdpau_internal.h" #include "thread.h" +static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) +{ + if (avctx->codec->id == AV_CODEC_ID_MSS2) + return AV_PIX_FMT_YUV420P; + + return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); +} + av_cold int ff_h263_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; @@ -57,10 +65,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) s->quant_precision = 5; s->decode_mb = ff_h263_decode_mb; s->low_delay = 1; - if (avctx->codec->id == AV_CODEC_ID_MSS2) - avctx->pix_fmt = AV_PIX_FMT_YUV420P; - else - avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); s->unrestricted_mv = 1; /* select sub codec */ @@ -120,6 +124,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) if (avctx->codec->id != AV_CODEC_ID_H263 && avctx->codec->id != AV_CODEC_ID_H263P && avctx->codec->id != AV_CODEC_ID_MPEG4) { + avctx->pix_fmt = h263_get_format(avctx); ff_mpv_idct_init(s); if ((ret = ff_mpv_common_init(s)) < 0) return ret; @@ -345,7 +350,8 @@ static int decode_slice(MpegEncContext *s) } if (s->workaround_bugs & FF_BUG_AUTODETECT) { - if (s->padding_bug_score > -2 && !s->data_partitioning) + if ( + (s->padding_bug_score > -2 && !s->data_partitioning)) s->workaround_bugs |= FF_BUG_NO_PADDING; else s->workaround_bugs &= ~FF_BUG_NO_PADDING; @@ -504,9 +510,11 @@ retry: return ret; } - if (!s->context_initialized) + if (!s->context_initialized) { + avctx->pix_fmt = h263_get_format(avctx); if ((ret = ff_mpv_common_init(s)) < 0) return ret; + } if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) { int i = ff_find_unused_picture(s, 0); @@ -540,6 +548,12 @@ retry: if ((ret = ff_mpv_common_frame_size_change(s))) return ret; + + if (avctx->pix_fmt != h263_get_format(avctx)) { + av_log(avctx, AV_LOG_ERROR, "format change not supported\n"); + avctx->pix_fmt = AV_PIX_FMT_NONE; + return AVERROR_UNKNOWN; + } } if (s->codec_id == AV_CODEC_ID_H263 ||