comparison mpegvideo.c @ 771:d4cc92144266 libavcodec

handle direct rendering buffer allocation failure
author michaelni
date Sun, 27 Oct 2002 00:02:23 +0000
parents c3fc09466f92
children 08423289ec57
comparison
equal deleted inserted replaced
770:d1770a34e4f6 771:d4cc92144266
789 memset(last_line + (i + 1) * wrap + width, last_line[width-1], w); /* top right */ 789 memset(last_line + (i + 1) * wrap + width, last_line[width-1], w); /* top right */
790 } 790 }
791 } 791 }
792 792
793 /* generic function for encode/decode called before a frame is coded/decoded */ 793 /* generic function for encode/decode called before a frame is coded/decoded */
794 void MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) 794 int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
795 { 795 {
796 int i; 796 int i;
797 UINT8 *tmp; 797 UINT8 *tmp;
798 798
799 s->mb_skiped = 0; 799 s->mb_skiped = 0;
800 avctx->mbskip_table= s->mbskip_table; 800 avctx->mbskip_table= s->mbskip_table;
801 801
802 if(avctx->flags&CODEC_FLAG_DR1){ 802 if(avctx->flags&CODEC_FLAG_DR1){
803 avctx->get_buffer_callback(avctx, s->width, s->height, s->pict_type); 803 if(avctx->get_buffer_callback(avctx, s->width, s->height, s->pict_type) < 0){
804 fprintf(stderr, "get_buffer() failed\n");
805 return -1;
806 }
804 807
805 s->linesize = avctx->dr_stride; 808 s->linesize = avctx->dr_stride;
806 s->uvlinesize= avctx->dr_uvstride; 809 s->uvlinesize= avctx->dr_uvstride;
807 s->ip_buffer_count= avctx->dr_ip_buffer_count; 810 s->ip_buffer_count= avctx->dr_ip_buffer_count;
808 } 811 }
852 s->dct_unquantize = s->dct_unquantize_mpeg2; 855 s->dct_unquantize = s->dct_unquantize_mpeg2;
853 else 856 else
854 s->dct_unquantize = s->dct_unquantize_h263; 857 s->dct_unquantize = s->dct_unquantize_h263;
855 }else 858 }else
856 s->dct_unquantize = s->dct_unquantize_mpeg1; 859 s->dct_unquantize = s->dct_unquantize_mpeg1;
860
861 return 0;
857 } 862 }
858 863
859 /* generic function for encode/decode called after a frame has been coded/decoded */ 864 /* generic function for encode/decode called after a frame has been coded/decoded */
860 void MPV_frame_end(MpegEncContext *s) 865 void MPV_frame_end(MpegEncContext *s)
861 { 866 {