[MPlayer-cvslog] CVS: main mencoder.c,1.283,1.284

Nico Sabbi CVS syncmail at mplayerhq.hu
Sun May 22 17:34:25 CEST 2005


CVS change done by Nico Sabbi CVS

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

Modified Files:
	mencoder.c 
Log Message:
preinit audio filters in order to determine the final samplerate and number of channels, or audio encoders will be initialized with the wrong parameters

Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -r1.283 -r1.284
--- mencoder.c	18 May 2005 12:24:20 -0000	1.283
+++ mencoder.c	22 May 2005 15:34:23 -0000	1.284
@@ -254,6 +254,7 @@
 #endif
 #include "vobsub.h"
 
+#include "libao2/audio_out.h"
 /* FIXME */
 static void mencoder_exit(int level, char *how)
 {
@@ -367,6 +368,7 @@
 int new_srate;
 
 unsigned int timer_start;
+ao_data_t ao_data = {0,0,0,0,OUTBURST,-1,0};
 
 audio_encoding_params_t aparams;
 audio_encoder_t *aencoder = NULL;
@@ -808,8 +810,21 @@
 
 mux_a->codec=out_audio_codec;
 
-aparams.channels = audio_output_channels ? audio_output_channels : sh_audio->channels;
-aparams.sample_rate = force_srate ? force_srate : new_srate;
+ao_data.samplerate = force_srate ? force_srate : new_srate;
+ao_data.channels = audio_output_channels ? audio_output_channels : sh_audio->channels;
+ao_data.format = audio_output_format ? audio_output_format : sh_audio->sample_format;
+if(!preinit_audio_filters(sh_audio,
+   // input:
+   new_srate,
+   sh_audio->channels, sh_audio->sample_format,
+   // output:
+   &ao_data.samplerate, &ao_data.channels, &ao_data.format)) {
+     mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
+     mencoder_exit(1, NULL);
+   }
+
+aparams.channels = ao_data.channels;
+aparams.sample_rate = ao_data.samplerate;
 aparams.audio_preload = 1000 * audio_preload;
 if(mux_a->codec != ACODEC_COPY) {
     aencoder = new_audio_encoder(mux_a, &aparams);




More information about the MPlayer-cvslog mailing list