# HG changeset patch # User michaelni # Date 1035676943 0 # Node ID d4cc92144266fbd8310e93cb96cd5ac4f875b408 # Parent d1770a34e4f68349ed7ab08ee609fe5e638d9970 handle direct rendering buffer allocation failure diff -r d1770a34e4f6 -r d4cc92144266 avcodec.h --- a/avcodec.h Sat Oct 26 18:56:43 2002 +0000 +++ b/avcodec.h Sun Oct 27 00:02:23 2002 +0000 @@ -5,8 +5,8 @@ #define LIBAVCODEC_VERSION_INT 0x000406 #define LIBAVCODEC_VERSION "0.4.6" -#define LIBAVCODEC_BUILD 4631 -#define LIBAVCODEC_BUILD_STR "4631" +#define LIBAVCODEC_BUILD 4632 +#define LIBAVCODEC_BUILD_STR "4632" enum CodecID { CODEC_ID_NONE, @@ -503,7 +503,7 @@ * encoding: unused * decoding: set by user */ - void (*get_buffer_callback)(struct AVCodecContext *c, int width, int height, int pict_type); + int (*get_buffer_callback)(struct AVCodecContext *c, int width, int height, int pict_type); /** * is 1 if the decoded stream contains b frames, 0 otherwise diff -r d1770a34e4f6 -r d4cc92144266 h263dec.c --- a/h263dec.c Sat Oct 26 18:56:43 2002 +0000 +++ b/h263dec.c Sun Oct 27 00:02:23 2002 +0000 @@ -457,7 +457,8 @@ s->next_p_frame_damaged=0; } - MPV_frame_start(s, avctx); + if(MPV_frame_start(s, avctx) < 0) + return -1; #ifdef DEBUG printf("qscale=%d\n", s->qscale); diff -r d1770a34e4f6 -r d4cc92144266 mpeg12.c --- a/mpeg12.c Sat Oct 26 18:56:43 2002 +0000 +++ b/mpeg12.c Sun Oct 27 00:02:23 2002 +0000 @@ -1581,7 +1581,8 @@ /* start frame decoding */ if (s->first_slice) { s->first_slice = 0; - MPV_frame_start(s, avctx); + if(MPV_frame_start(s, avctx) < 0) + return -1; } init_get_bits(&s->gb, buf, buf_size); diff -r d1770a34e4f6 -r d4cc92144266 mpegvideo.c --- a/mpegvideo.c Sat Oct 26 18:56:43 2002 +0000 +++ b/mpegvideo.c Sun Oct 27 00:02:23 2002 +0000 @@ -791,7 +791,7 @@ } /* generic function for encode/decode called before a frame is coded/decoded */ -void MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) +int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) { int i; UINT8 *tmp; @@ -800,7 +800,10 @@ avctx->mbskip_table= s->mbskip_table; if(avctx->flags&CODEC_FLAG_DR1){ - avctx->get_buffer_callback(avctx, s->width, s->height, s->pict_type); + if(avctx->get_buffer_callback(avctx, s->width, s->height, s->pict_type) < 0){ + fprintf(stderr, "get_buffer() failed\n"); + return -1; + } s->linesize = avctx->dr_stride; s->uvlinesize= avctx->dr_uvstride; @@ -854,6 +857,8 @@ s->dct_unquantize = s->dct_unquantize_h263; }else s->dct_unquantize = s->dct_unquantize_mpeg1; + + return 0; } /* generic function for encode/decode called after a frame has been coded/decoded */ diff -r d1770a34e4f6 -r d4cc92144266 mpegvideo.h --- a/mpegvideo.h Sat Oct 26 18:56:43 2002 +0000 +++ b/mpegvideo.h Sun Oct 27 00:02:23 2002 +0000 @@ -518,7 +518,7 @@ int MPV_common_init(MpegEncContext *s); void MPV_common_end(MpegEncContext *s); void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); -void MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx); +int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx); void MPV_frame_end(MpegEncContext *s); #ifdef HAVE_MMX void MPV_common_init_mmx(MpegEncContext *s); diff -r d1770a34e4f6 -r d4cc92144266 rv10.c --- a/rv10.c Sat Oct 26 18:56:43 2002 +0000 +++ b/rv10.c Sun Oct 27 00:02:23 2002 +0000 @@ -416,7 +416,8 @@ } if (s->mb_x == 0 && s->mb_y == 0) { - MPV_frame_start(s, avctx); + if(MPV_frame_start(s, avctx) < 0) + return -1; } #ifdef DEBUG diff -r d1770a34e4f6 -r d4cc92144266 svq1.c --- a/svq1.c Sat Oct 26 18:56:43 2002 +0000 +++ b/svq1.c Sun Oct 27 00:02:23 2002 +0000 @@ -1085,7 +1085,8 @@ result = svq1_decode_frame_header (&s->gb, s); - MPV_frame_start(s, avctx); + if(MPV_frame_start(s, avctx) < 0) + return -1; if (result != 0) {