[Mplayer-cvslog] CVS: main mencoder.c,1.12,1.13 cfg-mencoder.h,1.1,1.2

Arpi of Ize arpi at mplayer.dev.hu
Fri Nov 2 04:22:36 CET 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv8044

Modified Files:
	mencoder.c cfg-mencoder.h 
Log Message:
divx4 and lame subconfig support

Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- mencoder.c	2 Nov 2001 02:08:00 -0000	1.12
+++ mencoder.c	2 Nov 2001 03:22:33 -0000	1.13
@@ -73,9 +73,25 @@
 
 int force_srate=0;
 
+char* out_filename="test.avi";
+char* mp3_filename=NULL;
+char* ac3_filename=NULL;
+
+char *out_audio_codec=NULL; // override audio codec
+char *out_video_codec=NULL; // override video codec
+
 //#include "libmpeg2/mpeg2.h"
 //#include "libmpeg2/mpeg2_internal.h"
 
+ENC_PARAM divx4_param;
+
+int lame_param_quality=0; // best
+int lame_param_vbr=vbr_default;
+int lame_param_mode=-1; // unset
+int lame_param_padding=-1; // unset
+int lame_param_br=-1; // unset
+int lame_param_ratio=-1; // unset
+
 //-------------------------- config stuff:
 
 #include "cfgparser.h"
@@ -185,7 +201,6 @@
 aviwrite_stream_t* mux_v=NULL;
 FILE* muxer_f=NULL;
 
-ENC_PARAM enc_param;
 ENC_FRAME enc_frame;
 ENC_RESULT enc_result;
 void* enc_handle=NULL;
@@ -302,15 +317,12 @@
     vo_image_ptr=vo_image;
 }
 
-divx_quality=4;
-
 if(!init_video(sh_video)){
      mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_CouldntInitVideoCodec);
      exit(1);
 }
 
 
-
 if(sh_audio){
   // Go through the codec.conf and find the best codec...
   sh_audio->codec=NULL;
@@ -354,7 +366,7 @@
 video_out.draw_frame=draw_frame;
 
 // set up output file:
-muxer_f=fopen("test.avi","wb");
+muxer_f=fopen(out_filename,"wb");
 muxer=aviwrite_new_muxer();
 
 // ============= VIDEO ===============
@@ -446,23 +458,15 @@
     break;
 case VCODEC_DIVX4:
     // init divx4linux:
-    enc_param.x_dim=sh_video->disp_w;
-    enc_param.y_dim=sh_video->disp_h;
-    enc_param.framerate=(float)mux_v->h.dwRate/mux_v->h.dwScale;
-    enc_param.bitrate=800000;
-    enc_param.rc_period=0;
-    enc_param.rc_reaction_period=0;
-    enc_param.rc_reaction_ratio=0;
-    enc_param.max_quantizer=0;
-    enc_param.min_quantizer=0;
-    enc_param.max_key_interval=0;
-    enc_param.use_bidirect=0;
-    enc_param.deinterlace=0;
-    enc_param.quality=5; // the quality of compression ( 1 - fastest, 5 - best )
-    enc_param.obmc=0;
-    enc_param.handle=NULL;
-    encore(NULL,ENC_OPT_INIT,&enc_param,NULL);
-    enc_handle=enc_param.handle;
+    divx4_param.x_dim=sh_video->disp_w;
+    divx4_param.y_dim=sh_video->disp_h;
+    divx4_param.framerate=(float)mux_v->h.dwRate/mux_v->h.dwScale;
+    if(!divx4_param.bitrate) divx4_param.bitrate=800000;
+    else if(divx4_param.bitrate<=16000) divx4_param.bitrate*=1000;
+    if(!divx4_param.quality) divx4_param.quality=5; // the quality of compression ( 1 - fastest, 5 - best )
+    divx4_param.handle=NULL;
+    encore(NULL,ENC_OPT_INIT,&divx4_param,NULL);
+    enc_handle=divx4_param.handle;
     break;
 }
 
@@ -472,25 +476,24 @@
 case ACODEC_VBRMP3:
 
 lame=lame_init();
-
 lame_set_bWriteVbrTag(lame,0);
 lame_set_in_samplerate(lame,sh_audio->samplerate);
 lame_set_num_channels(lame,mux_a->wf->nChannels);
 lame_set_out_samplerate(lame,mux_a->h.dwRate);
-lame_set_quality(lame,0); // best q
-//lame_set_mode(lame,JOINT_STEREO); // j-st
-//lame_set_brate(lame,64);
-//lame_set_compression_ratio(lame,20);
-lame_set_VBR(lame,vbr_default); // ???
-//lame_set_VBR(lame,vbr_abr); // ???
-lame_set_VBR_q(lame,6); // 1 = best vbr q  6=~128k
-//lame_set_VBR_mean_bitrate_kbps(lame,128);
-
+if(lame_param_vbr){  // VBR:
+    lame_set_VBR(lame,lame_param_vbr); // vbr mode
+    lame_set_VBR_q(lame,lame_param_quality+1); // 1 = best vbr q  6=~128k
+    if(lame_param_br>0) lame_set_VBR_mean_bitrate_kbps(lame,lame_param_br);
+} else {    // CBR:
+    lame_set_quality(lame,lame_param_quality); // 0 = best q
+    if(lame_param_br>0) lame_set_brate(lame,lame_param_br);
+}
+if(lame_param_mode>=0) lame_set_mode(lame,lame_param_mode); // j-st
+if(lame_param_ratio>0) lame_set_compression_ratio(lame,lame_param_ratio);
 lame_init_params(lame);
-
 if(verbose){
-lame_print_config(lame);
-lame_print_internals(lame);
+    lame_print_config(lame);
+    lame_print_internals(lame);
 }
     
 }

Index: cfg-mencoder.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cfg-mencoder.h	2 Nov 2001 01:25:13 -0000	1.1
+++ cfg-mencoder.h	2 Nov 2001 03:22:33 -0000	1.2
@@ -9,10 +9,46 @@
 extern int use_old_pp;
 #endif
 
+struct config divx4opts_conf[]={
+	{"br", &divx4_param.bitrate, CONF_TYPE_INT, CONF_RANGE, 4, 24000000},
+	{"rc_period", &divx4_param.rc_period, CONF_TYPE_INT, 0,0,0},
+	{"rc_reaction_period", &divx4_param.rc_reaction_period, CONF_TYPE_INT, 0,0,0},
+	{"rc_reaction_ratio", &divx4_param.rc_reaction_ratio, CONF_TYPE_INT, 0,0,0},
+	{"min_quant", &divx4_param.min_quantizer, CONF_TYPE_INT, CONF_RANGE,0,32},
+	{"max_quant", &divx4_param.max_quantizer, CONF_TYPE_INT, CONF_RANGE,0,32},
+	{"key", &divx4_param.max_key_interval, CONF_TYPE_INT, CONF_MIN,0,0},
+	{"deinterlace", &divx4_param.deinterlace, CONF_TYPE_FLAG, 0,0,1},
+	{"q", &divx4_param.quality, CONF_TYPE_INT, CONF_RANGE, 1, 5},
+	{"help", "TODO: divx4opts help!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
+	{NULL, NULL, 0, 0, 0, 0}
+};
+
+struct config lameopts_conf[]={
+	{"q", &lame_param_quality, CONF_TYPE_INT, CONF_RANGE, 0, 9},
+	{"vbr", &lame_param_vbr, CONF_TYPE_INT, CONF_RANGE, 0, vbr_max_indicator},
+	{"cbr", &lame_param_vbr, CONF_TYPE_FLAG, 0, 0, 0},
+	{"mode", &lame_param_mode, CONF_TYPE_INT, CONF_RANGE, 0, MAX_INDICATOR},
+	{"padding", &lame_param_padding, CONF_TYPE_INT, CONF_RANGE, 0, PAD_MAX_INDICATOR},
+	{"br", &lame_param_br, CONF_TYPE_INT, CONF_RANGE, 0, 1024},
+	{"ratio", &lame_param_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 100},
+	{NULL, NULL, 0, 0, 0, 0}
+};
+
 struct config conf[]={
 	/* name, pointer, type, flags, min, max */
 	{"include", cfg_include, CONF_TYPE_FUNC_PARAM, 0, 0, 0}, /* this must be the first!!! */
 
+	{"ofps", &force_ofps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0},
+	{"o", &out_filename, CONF_TYPE_STRING, 0, 0, 0},
+
+	{"mp3file", &mp3_filename, CONF_TYPE_STRING, 0, 0, 0},
+	{"ac3file", &ac3_filename, CONF_TYPE_STRING, 0, 0, 0},
+
+	{"oac", &out_audio_codec, CONF_TYPE_STRING, 0, 0, 0},
+	{"ovc", &out_video_codec, CONF_TYPE_STRING, 0, 0, 0},
+	
+	{"divx4opts", divx4opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0},
+	{"lameopts", lameopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0},
 
 #include "cfg-common.h"
 




More information about the MPlayer-cvslog mailing list