changeset 4369:b768f17c6d36

audio copy fix
author arpi
date Sun, 27 Jan 2002 01:23:23 +0000
parents fae96d93c662
children 18f73fb0380e
files mencoder.c
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mencoder.c	Sun Jan 27 00:43:57 2002 +0000
+++ b/mencoder.c	Sun Jan 27 01:23:23 2002 +0000
@@ -554,7 +554,7 @@
 
 } // if(out_video_codec)
 
-if(sh_audio && out_audio_codec){
+if(sh_audio && (out_audio_codec || !sh_audio->wf)){
   // Go through the codec.conf and find the best codec...
   sh_audio->codec=NULL;
   if(audio_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceAudioFmt,audio_family);
@@ -579,7 +579,7 @@
   }
 }
 
-if(sh_audio && out_audio_codec){
+if(sh_audio && (out_audio_codec || !sh_audio->wf)){
   mp_msg(MSGT_MENCODER,MSGL_V,"Initializing audio codec...\n");
   if(!init_audio(sh_audio)){
     mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CouldntInitAudioCodec);
@@ -780,19 +780,24 @@
 
 switch(mux_a->codec){
 case ACODEC_COPY:
-    mux_a->h.dwSampleSize=sh_audio->audio.dwSampleSize;
-    mux_a->h.dwScale=sh_audio->audio.dwScale;
-    mux_a->h.dwRate=sh_audio->audio.dwRate;
-    if (sh_audio->wf)
+    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;
-    else
-    {
+    } else {
 	mux_a->wf = malloc(sizeof(WAVEFORMATEX));
 	mux_a->wf->nBlockAlign = mux_a->h.dwSampleSize;
-	mux_a->wf->wFormatTag = sh_audio->sample_format;
+	mux_a->wf->wFormatTag = sh_audio->format;
 	mux_a->wf->nChannels = sh_audio->channels;
 	mux_a->wf->nSamplesPerSec = sh_audio->samplerate;
-	mux_a->wf->nAvgBytesPerSec=mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec;
+	mux_a->wf->nAvgBytesPerSec=sh_audio->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec;
 	mux_a->wf->wBitsPerSample = 16; // FIXME
 	mux_a->wf->cbSize=0; // FIXME for l3codeca.acm
     }