aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-03-19 03:51:36 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-03-19 03:51:36 +0000
commit488fa19a86dd9f9ae3adfedcd45fe62acf6d309a (patch)
tree286d8c4532550f392b4362db12ab50a1fa9fd197
parent019d276a127b348f5154e4754c30da114bcfd4ed (diff)
downloadffmpeg-488fa19a86dd9f9ae3adfedcd45fe62acf6d309a.tar.gz
use the width & height from the mpeg4 header ... in the case that its complete
Originally committed as revision 340 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/h263.c4
-rw-r--r--libavcodec/h263dec.c28
2 files changed, 19 insertions, 13 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index d68240bc72..34cfe46b44 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -2149,6 +2149,10 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
skip_bits1(&s->gb); /* marker */
height = get_bits(&s->gb, 13);
skip_bits1(&s->gb); /* marker */
+ if(width && height){ /* they should be non zero but who knows ... */
+ s->width = width;
+ s->height = height;
+ }
}
if(get_bits1(&s->gb)) printf("interlaced not supported\n"); /* interlaced */
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 5da9ac5dd9..8a80af6bb0 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -59,7 +59,7 @@ static int h263_decode_init(AVCodecContext *avctx)
}
/* for h263, we allocate the images after having read the header */
- if (avctx->codec->id != CODEC_ID_H263)
+ if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
if (MPV_common_init(s) < 0)
return -1;
@@ -114,22 +114,24 @@ static int h263_decode_frame(AVCodecContext *avctx,
ret = intel_h263_decode_picture_header(s);
} else {
ret = h263_decode_picture_header(s);
- /* After H263 header decode we have the height, width, */
+ }
+
+ /* After H263 & mpeg4 header decode we have the height, width,*/
/* and other parameters. So then we could init the picture */
/* FIXME: By the way H263 decoder is evolving it should have */
/* an H263EncContext */
- if (!s->context_initialized) {
- avctx->width = s->width;
- avctx->height = s->height;
- if (MPV_common_init(s) < 0)
- return -1;
- } else if (s->width != avctx->width || s->height != avctx->height) {
- /* H.263 could change picture size any time */
- MPV_common_end(s);
- if (MPV_common_init(s) < 0)
- return -1;
- }
+ if (!s->context_initialized) {
+ avctx->width = s->width;
+ avctx->height = s->height;
+ if (MPV_common_init(s) < 0)
+ return -1;
+ } else if (s->width != avctx->width || s->height != avctx->height) {
+ /* H.263 could change picture size any time */
+ MPV_common_end(s);
+ if (MPV_common_init(s) < 0)
+ return -1;
}
+
if (ret < 0)
return -1;