summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2012-09-20 01:20:29 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2012-09-20 01:20:29 (GMT)
commit61ced71d79ebef22f8ab6ee3511a7a989f6fd3ac (patch)
tree6000ca917b87276d4e29b6ff5ca4fb7d0fee5b30
parentd57ca5e5a8ba993630c87fbc87ed1f8267309278 (diff)
parent581281e242609a222233a2e5538b89dfb88fb18e (diff)
downloadffmpeg-61ced71d79ebef22f8ab6ee3511a7a989f6fd3ac.zip
ffmpeg-61ced71d79ebef22f8ab6ee3511a7a989f6fd3ac.tar.gz
ffmpeg-61ced71d79ebef22f8ab6ee3511a7a989f6fd3ac.tar.bz2
Merge commit '581281e242609a222233a2e5538b89dfb88fb18e'
* commit '581281e242609a222233a2e5538b89dfb88fb18e': matroskadec: check realloc in lzo encoding matroska: honor error_recognition on unknown doctypes tiffdec: Add support for GRAY16LE. tiffenc: Add support for little endian RGB48 and GRAY16 mpeg4: support frame parameter changes with frame-mt mpegvideo: check ff_find_unused_picture() return value for errors mpegvideo: release frame buffers before freeing them configure: msvc: default to 'lib' as 'ar' tool build: support some non-standard ar variants Conflicts: libavcodec/h263dec.c libavcodec/mpegvideo.c libavcodec/tiff.c libavcodec/tiffenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rwxr-xr-xconfigure14
-rw-r--r--libavcodec/h263dec.c27
-rw-r--r--libavcodec/mpeg4videodec.c3
-rw-r--r--libavcodec/mpegvideo.c21
-rw-r--r--libavcodec/mpegvideo.h4
-rw-r--r--libavcodec/tiffenc.c3
-rw-r--r--libavformat/matroskadec.c10
-rw-r--r--library.mak2
8 files changed, 64 insertions, 20 deletions
diff --git a/configure b/configure
index 78c1749..c238e56 100755
--- a/configure
+++ b/configure
@@ -2316,6 +2316,7 @@ case "$toolchain" in
cc_default="c99wrap cl"
ld_default="c99wrap link"
nm_default="dumpbin -symbols"
+ ar_default="lib"
;;
?*)
die "Unknown toolchain $toolchain"
@@ -2688,6 +2689,17 @@ if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
DEPCCFLAGS=$_flags
fi
+if $ar 2>&1 | grep -q Microsoft; then
+ arflags="-nologo"
+ ar_o='-out:$@'
+elif $ar 2>&1 | grep -q 'Texas Instruments'; then
+ arflags="rq"
+ ar_o='$@'
+else
+ arflags="rc"
+ ar_o='$@'
+fi
+
add_cflags $extra_cflags
add_cxxflags $extra_cxxflags
add_asflags $extra_cflags
@@ -4113,6 +4125,8 @@ DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
YASM=$yasmexe
DEPYASM=$yasmexe
AR=$ar
+ARFLAGS=$arflags
+AR_O=$ar_o
RANLIB=$ranlib
CP=cp -p
LN_S=$ln_s
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 6f7eede..0b85157 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -462,15 +462,6 @@ retry:
if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return ret;
- } 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);
- s->width = avctx->coded_width;
- s->height= avctx->coded_height;
- return AVERROR_PATCHWELCOME; // width / height changed during parallelized decoding
}
avctx->has_b_frames= !s->low_delay;
@@ -607,21 +598,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);
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 139f6d8..a5dc36e 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1630,6 +1630,9 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
height = get_bits(gb, 13);
skip_bits1(gb); /* marker */
if(width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))){ /* they should be non zero but who knows ... */
+ if (s->width && s->height &&
+ (s->width != width || s->height != height))
+ s->context_reinit = 1;
s->width = width;
s->height = height;
}
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index c603eeb..9e1f67c 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -552,6 +552,15 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
}
}
+ if (s->height != s1->height || s->width != s1->width || s->context_reinit) {
+ int err;
+ s->context_reinit = 0;
+ s->height = s1->height;
+ s->width = s1->width;
+ if ((err = ff_MPV_common_frame_size_change(s)) < 0)
+ return err;
+ }
+
s->avctx->coded_height = s1->avctx->coded_height;
s->avctx->coded_width = s1->avctx->coded_width;
s->avctx->width = s1->avctx->width;
@@ -1328,8 +1337,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
pic = s->current_picture_ptr;
} else {
i = ff_find_unused_picture(s, 0);
- if (i < 0)
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
+ }
pic = &s->picture[i];
}
@@ -1393,8 +1404,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
- if (i < 0)
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
+ }
s->last_picture_ptr = &s->picture[i];
s->last_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
@@ -1416,8 +1429,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->pict_type == AV_PICTURE_TYPE_B) {
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
- if (i < 0)
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
return i;
+ }
s->next_picture_ptr = &s->picture[i];
s->next_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 1b8791c..27a77c9 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -713,6 +713,10 @@ typedef struct MpegEncContext {
/* temp buffers for rate control */
float *cplx_tab, *bits_tab;
+
+ /* flag to indicate a reinitialization is required, e.g. after
+ * a frame size change */
+ int context_reinit;
} MpegEncContext;
#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index fe74016..7d97523 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -520,7 +520,8 @@ AVCodec ff_tiff_encoder = {
.encode2 = encode_frame,
.close = encode_close,
.pix_fmts = (const enum PixelFormat[]) {
- PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16LE,
+ PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8,
+ PIX_FMT_GRAY8A, PIX_FMT_GRAY16LE,
PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE,
PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV440P, PIX_FMT_YUV444P,
PIX_FMT_YUV410P, PIX_FMT_YUV411P, PIX_FMT_RGB48LE,
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index e6ade11..48b2d9b 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1065,7 +1065,11 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
case MATROSKA_TRACK_ENCODING_COMP_LZO:
do {
olen = pkt_size *= 3;
- pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING);
+ newpktdata = av_realloc(pkt_data, pkt_size + AV_LZO_OUTPUT_PADDING);
+ if (!newpktdata) {
+ goto failed;
+ }
+ pkt_data = newpktdata;
result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
} while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
if (result)
@@ -1443,6 +1447,10 @@ static int matroska_read_header(AVFormatContext *s)
break;
if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) {
av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype);
+ if (matroska->ctx->error_recognition & AV_EF_EXPLODE) {
+ ebml_free(ebml_syntax, &ebml);
+ return AVERROR_INVALIDDATA;
+ }
}
ebml_free(ebml_syntax, &ebml);
diff --git a/library.mak b/library.mak
index e943615..821fe7e 100644
--- a/library.mak
+++ b/library.mak
@@ -25,7 +25,7 @@ $(TESTOBJS): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS)
$(RM) $@
- $(AR) rc $@ $^ $(EXTRAOBJS)
+ $(AR) $(ARFLAGS) $(AR_O) $^ $(EXTRAOBJS)
$(RANLIB) $@
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig