summaryrefslogtreecommitdiff
path: root/libavcodec/h263dec.c
diff options
context:
space:
mode:
authorJanne Grunau <janne-libav@jannau.net>2012-09-18 15:48:14 +0200
committerJanne Grunau <janne-libav@jannau.net>2012-09-19 19:58:15 +0200
commit8701f4f8e8a7aa71c39f0917472d22bf6a1f0f43 (patch)
tree8f8ba7cfff9d11c2754e740cf1f887d977af8f33 /libavcodec/h263dec.c
parent01fc5d6609e31539684785295d6c10b84d70b215 (diff)
mpeg4: support frame parameter changes with frame-mt
Adds a flag context_reinit to MpegEncContext to relieable keep track of frame parameter changes which require a context reinitialization. This is required for broken inputs which change the frame size but error out before the context can be reinitialized.
Diffstat (limited to 'libavcodec/h263dec.c')
-rw-r--r--libavcodec/h263dec.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 8e6085beeb..ba7fb8ae12 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -434,13 +434,6 @@ retry:
if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return -1;
- } else if ((s->width != avctx->coded_width ||
- s->height != avctx->coded_height ||
- (s->width + 15) >> 4 != s->mb_width ||
- (s->height + 15) >> 4 != s->mb_height) &&
- (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))) {
- av_log_missing_feature(s->avctx, "Width/height/bit depth/chroma idc changing with threads is", 0);
- return AVERROR_PATCHWELCOME; // width / height changed during parallelized decoding
}
avctx->has_b_frames= !s->low_delay;
@@ -577,21 +570,29 @@ retry:
/* FIXME: By the way H263 decoder is evolving it should have */
/* an H263EncContext */
- if ( s->width != avctx->coded_width
- || s->height != avctx->coded_height) {
- /* H.263 could change picture size any time */
+ if (!avctx->coded_width || !avctx->coded_height) {
ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat
s->parse_context.buffer=0;
ff_MPV_common_end(s);
s->parse_context= pc;
- }
- if (!s->context_initialized) {
avcodec_set_dimensions(avctx, s->width, s->height);
goto retry;
}
+ if (s->width != avctx->coded_width ||
+ s->height != avctx->coded_height ||
+ s->context_reinit) {
+ /* H.263 could change picture size any time */
+ s->context_reinit = 0;
+
+ avcodec_set_dimensions(avctx, s->width, s->height);
+
+ if ((ret = ff_MPV_common_frame_size_change(s)))
+ return ret;
+ }
+
if((s->codec_id==AV_CODEC_ID_H263 || s->codec_id==AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_H263I))
s->gob_index = ff_h263_get_gob_height(s);