Commit 61ced71d authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '581281e2'

* commit '581281e2':
  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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents d57ca5e5 581281e2
...@@ -2316,6 +2316,7 @@ case "$toolchain" in ...@@ -2316,6 +2316,7 @@ case "$toolchain" in
cc_default="c99wrap cl" cc_default="c99wrap cl"
ld_default="c99wrap link" ld_default="c99wrap link"
nm_default="dumpbin -symbols" nm_default="dumpbin -symbols"
ar_default="lib"
;; ;;
?*) ?*)
die "Unknown toolchain $toolchain" die "Unknown toolchain $toolchain"
...@@ -2688,6 +2689,17 @@ if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then ...@@ -2688,6 +2689,17 @@ if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
DEPCCFLAGS=$_flags DEPCCFLAGS=$_flags
fi 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_cflags $extra_cflags
add_cxxflags $extra_cxxflags add_cxxflags $extra_cxxflags
add_asflags $extra_cflags add_asflags $extra_cflags
...@@ -4113,6 +4125,8 @@ DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS) ...@@ -4113,6 +4125,8 @@ DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
YASM=$yasmexe YASM=$yasmexe
DEPYASM=$yasmexe DEPYASM=$yasmexe
AR=$ar AR=$ar
ARFLAGS=$arflags
AR_O=$ar_o
RANLIB=$ranlib RANLIB=$ranlib
CP=cp -p CP=cp -p
LN_S=$ln_s LN_S=$ln_s
......
...@@ -462,15 +462,6 @@ retry: ...@@ -462,15 +462,6 @@ retry:
if (ret < 0){ if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return ret; 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; avctx->has_b_frames= !s->low_delay;
...@@ -607,21 +598,29 @@ retry: ...@@ -607,21 +598,29 @@ retry:
/* FIXME: By the way H263 decoder is evolving it should have */ /* FIXME: By the way H263 decoder is evolving it should have */
/* an H263EncContext */ /* an H263EncContext */
if ( s->width != avctx->coded_width if (!avctx->coded_width || !avctx->coded_height) {
|| s->height != avctx->coded_height) {
/* H.263 could change picture size any time */
ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat
s->parse_context.buffer=0; s->parse_context.buffer=0;
ff_MPV_common_end(s); ff_MPV_common_end(s);
s->parse_context= pc; s->parse_context= pc;
}
if (!s->context_initialized) {
avcodec_set_dimensions(avctx, s->width, s->height); avcodec_set_dimensions(avctx, s->width, s->height);
goto retry; 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)) 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); s->gob_index = ff_h263_get_gob_height(s);
......
...@@ -1630,6 +1630,9 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ ...@@ -1630,6 +1630,9 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
height = get_bits(gb, 13); height = get_bits(gb, 13);
skip_bits1(gb); /* marker */ skip_bits1(gb); /* marker */
if(width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))){ /* they should be non zero but who knows ... */ 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->width = width;
s->height = height; s->height = height;
} }
......
...@@ -552,6 +552,15 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, ...@@ -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_height = s1->avctx->coded_height;
s->avctx->coded_width = s1->avctx->coded_width; s->avctx->coded_width = s1->avctx->coded_width;
s->avctx->width = s1->avctx->width; s->avctx->width = s1->avctx->width;
...@@ -1328,8 +1337,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) ...@@ -1328,8 +1337,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
pic = s->current_picture_ptr; pic = s->current_picture_ptr;
} else { } else {
i = ff_find_unused_picture(s, 0); 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; return i;
}
pic = &s->picture[i]; pic = &s->picture[i];
} }
...@@ -1393,8 +1404,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) ...@@ -1393,8 +1404,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* Allocate a dummy frame */ /* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0); 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; return i;
}
s->last_picture_ptr = &s->picture[i]; s->last_picture_ptr = &s->picture[i];
s->last_picture_ptr->f.key_frame = 0; s->last_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 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) ...@@ -1416,8 +1429,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->pict_type == AV_PICTURE_TYPE_B) { s->pict_type == AV_PICTURE_TYPE_B) {
/* Allocate a dummy frame */ /* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0); 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; return i;
}
s->next_picture_ptr = &s->picture[i]; s->next_picture_ptr = &s->picture[i];
s->next_picture_ptr->f.key_frame = 0; s->next_picture_ptr->f.key_frame = 0;
if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) { if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {
......
...@@ -713,6 +713,10 @@ typedef struct MpegEncContext { ...@@ -713,6 +713,10 @@ typedef struct MpegEncContext {
/* temp buffers for rate control */ /* temp buffers for rate control */
float *cplx_tab, *bits_tab; float *cplx_tab, *bits_tab;
/* flag to indicate a reinitialization is required, e.g. after
* a frame size change */
int context_reinit;
} MpegEncContext; } MpegEncContext;
#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \ #define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
......
...@@ -520,7 +520,8 @@ AVCodec ff_tiff_encoder = { ...@@ -520,7 +520,8 @@ AVCodec ff_tiff_encoder = {
.encode2 = encode_frame, .encode2 = encode_frame,
.close = encode_close, .close = encode_close,
.pix_fmts = (const enum PixelFormat[]) { .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_MONOBLACK, PIX_FMT_MONOWHITE,
PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV440P, PIX_FMT_YUV444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV440P, PIX_FMT_YUV444P,
PIX_FMT_YUV410P, PIX_FMT_YUV411P, PIX_FMT_RGB48LE, PIX_FMT_YUV410P, PIX_FMT_YUV411P, PIX_FMT_RGB48LE,
......
...@@ -1065,7 +1065,11 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size, ...@@ -1065,7 +1065,11 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
case MATROSKA_TRACK_ENCODING_COMP_LZO: case MATROSKA_TRACK_ENCODING_COMP_LZO:
do { do {
olen = pkt_size *= 3; 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); result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
} while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
if (result) if (result)
...@@ -1443,6 +1447,10 @@ static int matroska_read_header(AVFormatContext *s) ...@@ -1443,6 +1447,10 @@ static int matroska_read_header(AVFormatContext *s)
break; break;
if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) { if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) {
av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype); 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); ebml_free(ebml_syntax, &ebml);
......
...@@ -25,7 +25,7 @@ $(TESTOBJS): CPPFLAGS += -DTEST ...@@ -25,7 +25,7 @@ $(TESTOBJS): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS) $(SUBDIR)$(LIBNAME): $(OBJS)
$(RM) $@ $(RM) $@
$(AR) rc $@ $^ $(EXTRAOBJS) $(AR) $(ARFLAGS) $(AR_O) $^ $(EXTRAOBJS)
$(RANLIB) $@ $(RANLIB) $@
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment