[Mplayer-cvslog] CVS: main mencoder.c,1.66,1.67

Arpi of Ize arpi at mplayer.dev.hu
Sun Jan 27 03:31:15 CET 2002


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

Modified Files:
	mencoder.c 
Log Message:
more audiocopy fixes (especially for .asf)

Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- mencoder.c	27 Jan 2002 01:23:23 -0000	1.66
+++ mencoder.c	27 Jan 2002 02:31:06 -0000	1.67
@@ -766,6 +766,8 @@
 	mux_v->bih->biCompression, (char *)&mux_v->bih->biCompression);
 }
 
+if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf!
+
 // ============= AUDIO ===============
 if(sh_audio){
 
@@ -780,20 +782,12 @@
 
 switch(mux_a->codec){
 case ACODEC_COPY:
-    if(sh_audio->audio.dwScale){
-	mux_a->h.dwSampleSize=sh_audio->audio.dwSampleSize;
-	mux_a->h.dwScale=sh_audio->audio.dwScale;
-	mux_a->h.dwRate=sh_audio->audio.dwRate;
-    } else {
-	mux_a->h.dwSampleSize=1;
-	mux_a->h.dwScale=1;
-	mux_a->h.dwRate=sh_audio->i_bps;
-    }
     if (sh_audio->wf){
 	mux_a->wf=sh_audio->wf;
+	if(!sh_audio->i_bps) sh_audio->i_bps=mux_a->wf->nAvgBytesPerSec;
     } else {
 	mux_a->wf = malloc(sizeof(WAVEFORMATEX));
-	mux_a->wf->nBlockAlign = mux_a->h.dwSampleSize;
+	mux_a->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize;
 	mux_a->wf->wFormatTag = sh_audio->format;
 	mux_a->wf->nChannels = sh_audio->channels;
 	mux_a->wf->nSamplesPerSec = sh_audio->samplerate;
@@ -801,9 +795,18 @@
 	mux_a->wf->wBitsPerSample = 16; // FIXME
 	mux_a->wf->cbSize=0; // FIXME for l3codeca.acm
     }
-    printf("audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d)\n",
+    if(sh_audio->audio.dwScale){
+	mux_a->h.dwSampleSize=sh_audio->audio.dwSampleSize;
+	mux_a->h.dwScale=sh_audio->audio.dwScale;
+	mux_a->h.dwRate=sh_audio->audio.dwRate;
+    } else {
+	mux_a->h.dwSampleSize=mux_a->wf->nBlockAlign;
+	mux_a->h.dwScale=mux_a->h.dwSampleSize;
+	mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec;
+    }
+    printf("audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d bps=%d sample=%d)\n",
 	mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec,
-	mux_a->wf->wBitsPerSample);
+	mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize);
     break;
 case ACODEC_PCM:
     printf("CBR PCM audio selected\n");
@@ -1128,7 +1131,7 @@
 	    // CBR - copy 0.5 sec of audio
 	    switch(mux_a->codec){
 	    case ACODEC_COPY: // copy
-		len=sh_audio->i_bps/2;
+		len=mux_a->wf->nAvgBytesPerSec/2;
 		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);
@@ -1360,6 +1363,7 @@
         unsigned int samples=(sh_audio->audio.dwSampleSize)?
           ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) :
           (d_audio->pack_no); // <- used for VBR audio
+	printf("samples=%d  \n",samples);
         a_pts=samples*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate;
       delay_corrected=1;
     } else {




More information about the MPlayer-cvslog mailing list