comparison utils.c @ 12372:914f484bb476 libavcodec

Remove use of the deprecated function avcodec_check_dimensions(), use av_check_image_size() instead.
author stefano
date Fri, 06 Aug 2010 09:37:04 +0000
parents 5dffb531b1cc
children ffb3668ff7af
comparison
equal deleted inserted replaced
12371:5dffb531b1cc 12372:914f484bb476
233 if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) { 233 if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) {
234 av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n"); 234 av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n");
235 return -1; 235 return -1;
236 } 236 }
237 237
238 if(avcodec_check_dimensions(s,w,h)) 238 if(av_check_image_size(w, h, 0, s))
239 return -1; 239 return -1;
240 240
241 if(s->internal_buffer==NULL){ 241 if(s->internal_buffer==NULL){
242 s->internal_buffer= av_mallocz((INTERNAL_BUFFER_SIZE+1)*sizeof(InternalBuffer)); 242 s->internal_buffer= av_mallocz((INTERNAL_BUFFER_SIZE+1)*sizeof(InternalBuffer));
243 } 243 }
485 else if(avctx->width && avctx->height) 485 else if(avctx->width && avctx->height)
486 avcodec_set_dimensions(avctx, avctx->width, avctx->height); 486 avcodec_set_dimensions(avctx, avctx->width, avctx->height);
487 487
488 #define SANE_NB_CHANNELS 128U 488 #define SANE_NB_CHANNELS 128U
489 if (((avctx->coded_width || avctx->coded_height) 489 if (((avctx->coded_width || avctx->coded_height)
490 && avcodec_check_dimensions(avctx, avctx->coded_width, avctx->coded_height)) 490 && av_check_image_size(avctx->coded_width, avctx->coded_height, 0, avctx))
491 || avctx->channels > SANE_NB_CHANNELS) { 491 || avctx->channels > SANE_NB_CHANNELS) {
492 ret = AVERROR(EINVAL); 492 ret = AVERROR(EINVAL);
493 goto free_and_end; 493 goto free_and_end;
494 } 494 }
495 495
552 { 552 {
553 if(buf_size < FF_MIN_BUFFER_SIZE){ 553 if(buf_size < FF_MIN_BUFFER_SIZE){
554 av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n"); 554 av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
555 return -1; 555 return -1;
556 } 556 }
557 if(avcodec_check_dimensions(avctx,avctx->width,avctx->height)) 557 if(av_check_image_size(avctx->width, avctx->height, 0, avctx))
558 return -1; 558 return -1;
559 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){ 559 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
560 int ret = avctx->codec->encode(avctx, buf, buf_size, pict); 560 int ret = avctx->codec->encode(avctx, buf, buf_size, pict);
561 avctx->frame_number++; 561 avctx->frame_number++;
562 emms_c(); //needed to avoid an emms_c() call before every return; 562 emms_c(); //needed to avoid an emms_c() call before every return;
602 AVPacket *avpkt) 602 AVPacket *avpkt)
603 { 603 {
604 int ret; 604 int ret;
605 605
606 *got_picture_ptr= 0; 606 *got_picture_ptr= 0;
607 if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height)) 607 if((avctx->coded_width||avctx->coded_height) && av_check_image_size(avctx->coded_width, avctx->coded_height, 0, avctx))
608 return -1; 608 return -1;
609 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){ 609 if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
610 ret = avctx->codec->decode(avctx, picture, got_picture_ptr, 610 ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
611 avpkt); 611 avpkt);
612 612