[Mplayer-cvslog] CVS: main mencoder.c,1.133,1.134

Alex Beregszaszi alex at mplayerhq.hu
Sun Jun 23 19:34:32 CEST 2002


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

Modified Files:
	mencoder.c 
Log Message:
mono mp3 encoding support by Paul Ortyl <ortylp at 3miasto.net>

Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- mencoder.c	13 Jun 2002 21:35:10 -0000	1.133
+++ mencoder.c	23 Jun 2002 17:34:29 -0000	1.134
@@ -716,10 +716,10 @@
     if(sizeof(MPEGLAYER3WAVEFORMAT)!=30) mp_msg(MSGT_MENCODER,MSGL_WARN,"sizeof(MPEGLAYER3WAVEFORMAT)==%d!=30, maybe broken C compiler?\n",sizeof(MPEGLAYER3WAVEFORMAT));
     mux_a->wf=malloc(sizeof(MPEGLAYER3WAVEFORMAT)); // should be 30
     mux_a->wf->wFormatTag=0x55; // MP3
-    mux_a->wf->nChannels=sh_audio->channels;
+    mux_a->wf->nChannels=(lame_param_mode == 3) ? 1 : sh_audio->channels;
     mux_a->wf->nSamplesPerSec=force_srate?force_srate:sh_audio->samplerate;
     mux_a->wf->nAvgBytesPerSec=192000/8; // FIXME!
-    mux_a->wf->nBlockAlign=(mux_a->h.dwRate<32000)?576:1152; // requires for l3codeca.acm + WMP 6.4
+    mux_a->wf->nBlockAlign=(mux_a->h.dwRate<32000)?576:1152; // required for l3codeca.acm + WMP 6.4
     mux_a->wf->wBitsPerSample=0; //16;
     // from NaNdub:  (requires for l3codeca.acm)
     mux_a->wf->cbSize=12;
@@ -732,6 +732,8 @@
 }
 }
 
+if (verbose>1) print_wave_header(mux_a->wf);
+
 printf("Writing AVI header...\n");
 aviwrite_write_header(muxer,muxer_f);
 
@@ -849,9 +851,18 @@
 		  unsigned char tmp[2304];
 		  int len=dec_audio(sh_audio,tmp,2304);
 		  if(len<=0) break; // eof
-		  len=lame_encode_buffer_interleaved(lame,
+		  /* mono encoding, a bit tricky */
+		  if (mux_a->wf->nChannels == 1)
+		  {
+		    len = lame_encode_buffer(lame, tmp, tmp, len/4,
+			mux_a->buffer+mux_a->buffer_len, mux_a->buffer_size-mux_a->buffer_len);
+		  }
+		  else
+		  {
+		    len=lame_encode_buffer_interleaved(lame,
 		      tmp,len/4,
 		      mux_a->buffer+mux_a->buffer_len,mux_a->buffer_size-mux_a->buffer_len);
+		  }
 		  if(len<0) break; // error
 		  mux_a->buffer_len+=len;
 		}




More information about the MPlayer-cvslog mailing list