[Mplayer-cvslog] CVS: main/libmpdemux demux_rawaudio.c,1.10,1.11

Richard Felker CVS syncmail at mplayerhq.hu
Mon Apr 26 05:11:10 CEST 2004


CVS change done by Richard Felker CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv6128/libmpdemux

Modified Files:
	demux_rawaudio.c 
Log Message:
needed for a/v sync with compressed audio (e.g. raw .mp2 or .ac3 file)

Index: demux_rawaudio.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_rawaudio.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- demux_rawaudio.c	20 Sep 2003 12:50:25 -0000	1.10
+++ demux_rawaudio.c	26 Apr 2004 03:11:08 -0000	1.11
@@ -17,6 +17,7 @@
 static int channels = 2;
 static int samplerate = 44100;
 static int samplesize = 2;
+static int bitrate = 0;
 static int format = 0x1; // Raw PCM
 
 m_option_t demux_rawaudio_opts[] = {
@@ -24,6 +25,7 @@
   { "channels", &channels, CONF_TYPE_INT,CONF_RANGE,1,8, NULL },
   { "rate", &samplerate, CONF_TYPE_INT,CONF_RANGE,1000,8*48000, NULL },
   { "samplesize", &samplesize, CONF_TYPE_INT,CONF_RANGE,1,8, NULL },
+  { "bitrate", &bitrate, CONF_TYPE_INT,CONF_MIN,0,0, NULL },
   { "format", &format, CONF_TYPE_INT, CONF_MIN, 0 , 0, NULL },
   {NULL, NULL, 0, 0, 0, 0, NULL}
 };
@@ -40,7 +42,12 @@
   w->wFormatTag = sh_audio->format = format;
   w->nChannels = sh_audio->channels = channels;
   w->nSamplesPerSec = sh_audio->samplerate = samplerate;
-  w->nAvgBytesPerSec = samplerate*samplesize*channels;
+  if (bitrate > 999)
+    w->nAvgBytesPerSec = bitrate/8;
+  else if (bitrate > 0)
+    w->nAvgBytesPerSec = bitrate*125;
+  else
+    w->nAvgBytesPerSec = samplerate*samplesize*channels;
   w->nBlockAlign = channels*samplesize;
   sh_audio->samplesize = samplesize;
   w->wBitsPerSample = 8*samplesize;




More information about the MPlayer-cvslog mailing list