comparison ffv1.c @ 1598:932d306bf1dc libavcodec

av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
author michael
date Mon, 03 Nov 2003 13:26:22 +0000
parents 5495691106c3
children 2fb583cb0013
comparison
equal deleted inserted replaced
1597:4c9165372ab3 1598:932d306bf1dc
596 break; 596 break;
597 case PIX_FMT_RGBA32: 597 case PIX_FMT_RGBA32:
598 s->colorspace= 1; 598 s->colorspace= 1;
599 break; 599 break;
600 default: 600 default:
601 fprintf(stderr, "format not supported\n"); 601 av_log(avctx, AV_LOG_ERROR, "format not supported\n");
602 return -1; 602 return -1;
603 } 603 }
604 avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift); 604 avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
605 605
606 s->picture_number=0; 606 s->picture_number=0;
640 const int height= f->height; 640 const int height= f->height;
641 AVFrame * const p= &f->picture; 641 AVFrame * const p= &f->picture;
642 int used_count= 0; 642 int used_count= 0;
643 643
644 if(avctx->strict_std_compliance >= 0){ 644 if(avctx->strict_std_compliance >= 0){
645 printf("this codec is under development, files encoded with it wont be decodeable with future versions!!!\n" 645 av_log(avctx, AV_LOG_ERROR, "this codec is under development, files encoded with it wont be decodeable with future versions!!!\n"
646 "use vstrict=-1 to use it anyway\n"); 646 "use vstrict=-1 to use it anyway\n");
647 return -1; 647 return -1;
648 } 648 }
649 649
650 ff_init_cabac_encoder(c, buf, buf_size); 650 ff_init_cabac_encoder(c, buf, buf_size);
883 case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P; break; 883 case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P; break;
884 case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P; break; 884 case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P; break;
885 case 0x20: f->avctx->pix_fmt= PIX_FMT_YUV411P; break; 885 case 0x20: f->avctx->pix_fmt= PIX_FMT_YUV411P; break;
886 case 0x33: f->avctx->pix_fmt= PIX_FMT_YUV410P; break; 886 case 0x33: f->avctx->pix_fmt= PIX_FMT_YUV410P; break;
887 default: 887 default:
888 fprintf(stderr, "format not supported\n"); 888 av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
889 return -1; 889 return -1;
890 } 890 }
891 }else if(f->colorspace==1){ 891 }else if(f->colorspace==1){
892 if(f->chroma_h_shift || f->chroma_v_shift){ 892 if(f->chroma_h_shift || f->chroma_v_shift){
893 fprintf(stderr, "chroma subsampling not supported in this colorspace\n"); 893 av_log(f->avctx, AV_LOG_ERROR, "chroma subsampling not supported in this colorspace\n");
894 return -1; 894 return -1;
895 } 895 }
896 f->avctx->pix_fmt= PIX_FMT_RGBA32; 896 f->avctx->pix_fmt= PIX_FMT_RGBA32;
897 }else{ 897 }else{
898 fprintf(stderr, "colorspace not supported\n"); 898 av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
899 return -1; 899 return -1;
900 } 900 }
901 901
902 //printf("%d %d %d\n", f->chroma_h_shift, f->chroma_v_shift,f->avctx->pix_fmt); 902 //printf("%d %d %d\n", f->chroma_h_shift, f->chroma_v_shift,f->avctx->pix_fmt);
903 903
904 context_count=1; 904 context_count=1;
905 for(i=0; i<5; i++){ 905 for(i=0; i<5; i++){
906 context_count*= read_quant_table(c, f->quant_table[i], context_count); 906 context_count*= read_quant_table(c, f->quant_table[i], context_count);
907 if(context_count < 0){ 907 if(context_count < 0){
908 printf("read_quant_table error\n"); 908 av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
909 return -1; 909 return -1;
910 } 910 }
911 } 911 }
912 context_count= (context_count+1)/2; 912 context_count= (context_count+1)/2;
913 913
963 p->key_frame= 0; 963 p->key_frame= 0;
964 } 964 }
965 965
966 p->reference= 0; 966 p->reference= 0;
967 if(avctx->get_buffer(avctx, p) < 0){ 967 if(avctx->get_buffer(avctx, p) < 0){
968 fprintf(stderr, "get_buffer() failed\n"); 968 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
969 return -1; 969 return -1;
970 } 970 }
971 971
972 if(avctx->debug&FF_DEBUG_PICT_INFO) 972 if(avctx->debug&FF_DEBUG_PICT_INFO)
973 printf("keyframe:%d coder:%d\n", p->key_frame, f->ac); 973 av_log(avctx, AV_LOG_ERROR, "keyframe:%d coder:%d\n", p->key_frame, f->ac);
974 974
975 if(!f->ac){ 975 if(!f->ac){
976 bytes_read = get_cabac_terminate(c); 976 bytes_read = get_cabac_terminate(c);
977 if(bytes_read ==0) printf("error at end of AC stream\n"); 977 if(bytes_read ==0) av_log(avctx, AV_LOG_ERROR, "error at end of AC stream\n");
978 //printf("pos=%d\n", bytes_read); 978 //printf("pos=%d\n", bytes_read);
979 init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read); 979 init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read);
980 } else { 980 } else {
981 bytes_read = 0; /* avoid warning */ 981 bytes_read = 0; /* avoid warning */
982 } 982 }
1002 1002
1003 *data_size = sizeof(AVFrame); 1003 *data_size = sizeof(AVFrame);
1004 1004
1005 if(f->ac){ 1005 if(f->ac){
1006 bytes_read= get_cabac_terminate(c); 1006 bytes_read= get_cabac_terminate(c);
1007 if(bytes_read ==0) printf("error at end of frame\n"); 1007 if(bytes_read ==0) av_log(f->avctx, AV_LOG_ERROR, "error at end of frame\n");
1008 }else{ 1008 }else{
1009 bytes_read+= (get_bits_count(&f->gb)+7)/8; 1009 bytes_read+= (get_bits_count(&f->gb)+7)/8;
1010 } 1010 }
1011 1011
1012 return bytes_read; 1012 return bytes_read;