[MPlayer-cvslog] r33592 - in trunk: libmpcodecs/ae.h libmpcodecs/ae_lavc.c mencoder.c

reimar subversion at mplayerhq.hu
Sun Jun 12 02:28:53 CEST 2011


Author: reimar
Date: Sun Jun 12 02:28:51 2011
New Revision: 33592

Log:
Pass "native" filter chain sample format to audio encoder.
Make ae_lavc try to match this format.

Modified:
   trunk/libmpcodecs/ae.h
   trunk/libmpcodecs/ae_lavc.c
   trunk/mencoder.c

Modified: trunk/libmpcodecs/ae.h
==============================================================================
--- trunk/libmpcodecs/ae.h	Sun Jun 12 02:23:10 2011	(r33591)
+++ trunk/libmpcodecs/ae.h	Sun Jun 12 02:28:51 2011	(r33592)
@@ -38,6 +38,7 @@ typedef struct {
 	int bitrate;
 	int samples_per_frame;
 	int audio_preload;
+	int sample_format;
 } audio_encoding_params_t;
 
 typedef struct audio_encoder_s {

Modified: trunk/libmpcodecs/ae_lavc.c
==============================================================================
--- trunk/libmpcodecs/ae_lavc.c	Sun Jun 12 02:23:10 2011	(r33591)
+++ trunk/libmpcodecs/ae_lavc.c	Sun Jun 12 02:28:51 2011	(r33592)
@@ -193,7 +193,7 @@ int mpae_init_lavc(audio_encoder_t *enco
 		const enum AVSampleFormat *fmts;
 		lavc_actx->sample_fmt = lavc_acodec->sample_fmts[0]; // fallback to first format
 		for (fmts = lavc_acodec->sample_fmts; *fmts != AV_SAMPLE_FMT_NONE; fmts++) {
-			if (*fmts == AV_SAMPLE_FMT_S16) { // preferred format found
+			if (samplefmt2affmt(*fmts) == encoder->params.sample_format) { // preferred format found
 				lavc_actx->sample_fmt = *fmts;
 				break;
 			}

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	Sun Jun 12 02:23:10 2011	(r33591)
+++ trunk/mencoder.c	Sun Jun 12 02:28:51 2011	(r33592)
@@ -157,7 +157,7 @@ static int skip_limit=-1;
 float playback_speed=1.0;
 
 static int force_srate=0;
-static int audio_output_format=0;
+static int audio_output_format=AF_FORMAT_UNKNOWN;
 
 char *vobsub_out=NULL;
 unsigned int vobsub_out_index=0;
@@ -1071,6 +1071,7 @@ if(!init_audio_filters(sh_audio,
 
 aparams.channels = ao_data.channels;
 aparams.sample_rate = ao_data.samplerate;
+aparams.sample_format = ao_data.format;
 aparams.audio_preload = 1000 * audio_preload;
 if(mux_a->codec != ACODEC_COPY) {
     aencoder = new_audio_encoder(mux_a, &aparams);
@@ -1082,6 +1083,9 @@ if(mux_a->codec != ACODEC_COPY) {
       mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoMatchingFilter);
       mencoder_exit(1,NULL);
     }
+    ao_data.format = aencoder->input_format;
+    ao_data.channels = aparams.channels;
+    ao_data.samplerate = aparams.sample_rate;
 }
 switch(mux_a->codec){
 case ACODEC_COPY:


More information about the MPlayer-cvslog mailing list