[Mplayer-cvslog] CVS: main mencoder.c,1.36,1.37
Alex Beregszaszi
alex at mplayer.dev.hu
Sat Dec 8 02:43:10 CET 2001
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv10733
Modified Files:
mencoder.c
Log Message:
do not fault if 2pass VbrControl can't open the logfile
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mencoder.c 7 Dec 2001 00:12:51 -0000 1.36
+++ mencoder.c 8 Dec 2001 01:43:02 -0000 1.37
@@ -108,6 +108,7 @@
static int pass=0;
static char* passtmpfile="divx2pass.log";
+int pass_working=0;
static int play_n_frames=-1;
@@ -524,6 +525,9 @@
mux_v->bih->biBitCount=24;
mux_v->bih->biCompression=mmioFOURCC('d','i','v','x');
mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
+
+ if (pass)
+ printf("Divx: 2-pass logfile: %s\n", passtmpfile);
break;
}
@@ -617,14 +621,26 @@
}
switch(pass){
case 1:
- VbrControl_init_2pass_vbr_analysis(passtmpfile, divx4_param.quality);
+ if (VbrControl_init_2pass_vbr_analysis(passtmpfile, divx4_param.quality) == -1)
+ {
+ printf("2pass failed: filename=%s\n", passtmpfile);
+ pass_working = 0;
+ }
+ else
+ pass_working = 1;
break;
case 2:
- VbrControl_init_2pass_vbr_encoding(passtmpfile,
+ if (VbrControl_init_2pass_vbr_encoding(passtmpfile,
divx4_param.bitrate,
divx4_param.framerate,
divx4_crispness,
- divx4_param.quality);
+ divx4_param.quality) == -1)
+ {
+ printf("2pass failed: filename=%s\n", passtmpfile);
+ pass_working = 0;
+ }
+ else
+ pass_working = 1;
break;
}
break;
@@ -798,8 +814,8 @@
enc_frame.mvs=NULL;
enc_frame.quant=0;
enc_frame.intra=0;
- if(pass==2){ // handle 2-pass:
- enc_frame.quant = VbrControl_get_quant();
+ if(pass==2 && pass_working){ // handle 2-pass:
+ enc_frame.quant = VbrControl_get_quant();
enc_frame.intra = VbrControl_get_intra();
encore(enc_handle,ENC_OPT_ENCODE_VBR,&enc_frame,&enc_result);
VbrControl_update_2pass_vbr_encoding(enc_result.motion_bits,
@@ -807,7 +823,7 @@
enc_result.total_bits);
} else {
encore(enc_handle,ENC_OPT_ENCODE,&enc_frame,&enc_result);
- if(pass==1){
+ if(pass==1 && pass_working){
VbrControl_update_2pass_vbr_analysis(enc_result.is_key_frame,
enc_result.motion_bits,
enc_result.texture_bits,
More information about the MPlayer-cvslog
mailing list