[Mplayer-cvslog] CVS: main cfg-mencoder.h,1.46,1.47 mencoder.c,1.142,1.143

Arpi of Ize arpi at mplayerhq.hu
Thu Aug 1 10:39:46 CEST 2002


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

Modified Files:
	cfg-mencoder.h mencoder.c 
Log Message:
audio preload/density/delay configurable


Index: cfg-mencoder.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- cfg-mencoder.h	8 Jul 2002 21:44:51 -0000	1.46
+++ cfg-mencoder.h	1 Aug 2002 08:39:33 -0000	1.47
@@ -101,6 +101,10 @@
 	{"noskiplimit", &skip_limit, CONF_TYPE_FLAG, 0, 0, -1, NULL},
 	{"noskip", &skip_limit, CONF_TYPE_FLAG, 0, 0, 0, NULL},
 
+	{"audio-density", &audio_density, CONF_TYPE_INT, CONF_RANGE, 1, 50, NULL},
+	{"audio-preload", &audio_preload, CONF_TYPE_FLOAT, CONF_RANGE, 0, 2, NULL},
+	{"audio-delay",   &audio_delay, CONF_TYPE_FLOAT, 0, 0, 0, NULL},
+
 	{"x", "This option is obsolete, use -vop scale=w:h for scaling\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
 	{"xsize", "This option is obsolete, use -vop crop=w:h:x0:y0 for cropping\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
 

Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- mencoder.c	25 Jul 2002 03:37:27 -0000	1.142
+++ mencoder.c	1 Aug 2002 08:39:33 -0000	1.143
@@ -140,6 +140,10 @@
 static float max_pts_correction=0;//default_max_pts_correction;
 static float c_total=0;
 
+float audio_preload=0.5;
+float audio_delay=0.0;
+int audio_density=2;
+
 float force_fps=0;
 float force_ofps=0; // set to 24 for inverse telecine
 static int skip_limit=-1;
@@ -331,8 +335,6 @@
 lame_global_flags *lame;
 #endif
 
-float audio_preload=0.5;
-
 double v_pts_corr=0;
 double v_timer_corr=0;
 
@@ -724,6 +726,7 @@
 	mux_a->h.dwSampleSize=sh_audio->audio.dwSampleSize;
 	mux_a->h.dwScale=sh_audio->audio.dwScale;
 	mux_a->h.dwRate=sh_audio->audio.dwRate;
+//	mux_a->h.dwStart=sh_audio->audio.dwStart;
     } else {
 	mux_a->h.dwSampleSize=mux_a->wf->nBlockAlign;
 	mux_a->h.dwScale=mux_a->h.dwSampleSize;
@@ -769,10 +772,16 @@
     ((MPEGLAYER3WAVEFORMAT*)(mux_a->wf))->nCodecDelay=0;
     break;
 }
-}
 
 if (verbose>1) print_wave_header(mux_a->wf);
 
+if(audio_delay!=0.0){
+    mux_a->h.dwStart=audio_delay*mux_a->h.dwRate/mux_a->h.dwScale;
+    printf("Setting AUDIO DELAY to %5.3f\n",mux_a->h.dwStart*mux_a->h.dwScale/(float)mux_a->h.dwRate);
+}
+
+} // if(sh_audio)
+
 printf("Writing AVI header...\n");
 aviwrite_write_header(muxer,muxer_f);
 
@@ -869,13 +878,13 @@
 	    // CBR - copy 0.5 sec of audio
 	    switch(mux_a->codec){
 	    case ACODEC_COPY: // copy
-		len=mux_a->wf->nAvgBytesPerSec/2;
+		len=mux_a->wf->nAvgBytesPerSec/audio_density;
 		len/=mux_a->h.dwSampleSize;if(len<1) len=1;
 		len*=mux_a->h.dwSampleSize;
 		len=demux_read_data(sh_audio->ds,mux_a->buffer,len);
 		break;
 	    case ACODEC_PCM:
-		len=mux_a->h.dwSampleSize*(mux_a->h.dwRate/2);
+		len=mux_a->h.dwSampleSize*(mux_a->h.dwRate/audio_density);
 		len=dec_audio(sh_audio,mux_a->buffer,len);
 		break;
 	    }




More information about the MPlayer-cvslog mailing list