comparison mpegvideo.c @ 910:eb448df811be libavcodec

fixing files where the first frame isn a keyframe
author michaelni
date Wed, 04 Dec 2002 22:16:24 +0000
parents 8ae1e4c24e91
children 4a1e6bb1f41c
comparison
equal deleted inserted replaced
909:8ae1e4c24e91 910:eb448df811be
799 avctx->release_buffer(avctx, (AVVideoFrame*)&s->picture[i]); 799 avctx->release_buffer(avctx, (AVVideoFrame*)&s->picture[i]);
800 } 800 }
801 } 801 }
802 } 802 }
803 } 803 }
804 804 alloc:
805 if(!s->encoding){ 805 if(!s->encoding){
806 /* find unused Picture */ 806 /* find unused Picture */
807 for(i=0; i<MAX_PICTURE_COUNT; i++){ 807 for(i=0; i<MAX_PICTURE_COUNT; i++){
808 if(s->picture[i].data[0]==NULL) break; 808 if(s->picture[i].data[0]==NULL) break;
809 } 809 }
810 assert(i<MAX_PICTURE_COUNT); 810 assert(i<MAX_PICTURE_COUNT);
827 alloc_picture(s, (Picture*)pic); 827 alloc_picture(s, (Picture*)pic);
828 828
829 s->current_picture= s->picture[i]; 829 s->current_picture= s->picture[i];
830 } 830 }
831 831
832 s->hurry_up= s->avctx->hurry_up;
833 s->error_resilience= avctx->error_resilience;
834
835 if (s->pict_type != B_TYPE) { 832 if (s->pict_type != B_TYPE) {
836 s->last_picture= s->next_picture; 833 s->last_picture= s->next_picture;
837 s->next_picture= s->current_picture; 834 s->next_picture= s->current_picture;
838 } 835 }
836
837 if(s->pict_type != I_TYPE && s->last_picture.data[0]==NULL){
838 fprintf(stderr, "warning: first frame is no keyframe\n");
839 assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
840 goto alloc;
841 }
839 842
843 s->hurry_up= s->avctx->hurry_up;
844 s->error_resilience= avctx->error_resilience;
845
840 /* set dequantizer, we cant do it during init as it might change for mpeg4 846 /* set dequantizer, we cant do it during init as it might change for mpeg4
841 and we cant do it in the header decode as init isnt called for mpeg4 there yet */ 847 and we cant do it in the header decode as init isnt called for mpeg4 there yet */
842 if(s->out_format == FMT_H263){ 848 if(s->out_format == FMT_H263){
843 if(s->mpeg_quant) 849 if(s->mpeg_quant)
844 s->dct_unquantize = s->dct_unquantize_mpeg2; 850 s->dct_unquantize = s->dct_unquantize_mpeg2;