changeset 7614:ce6a938aa6d3

Adding -format and -af switches
author anders
date Sun, 06 Oct 2002 11:23:02 +0000
parents ff6bcf692358
children c67328dd459a
files cfg-common.h cfg-mplayer.h libmpcodecs/dec_audio.c mencoder.c mplayer.c
diffstat 5 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-common.h	Sun Oct 06 10:49:41 2002 +0000
+++ b/cfg-common.h	Sun Oct 06 11:23:02 2002 +0000
@@ -92,6 +92,7 @@
 	{"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL},
 	{"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL},
 	{"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 1, 6, NULL},
+	{"format", &audio_output_format, CONF_TYPE_INT, CONF_RANGE, 0, 0x00002000, NULL},
 
 // ------------------------- codec/vfilter options --------------------
 
--- a/cfg-mplayer.h	Sun Oct 06 10:49:41 2002 +0000
+++ b/cfg-mplayer.h	Sun Oct 06 11:23:02 2002 +0000
@@ -111,6 +111,14 @@
 /* from libvo/aspect.c */
 extern float monitor_aspect;
 
+#include "libaf/af.h"
+extern af_cfg_t af_cfg; // Audio filter configuration, defined in libmpcodecs/dec_audio.c
+struct config audio_filter_conf[]={       
+	{"list", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
+        {"force", &af_cfg.force, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
+	{NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
 /* Options related to audio out plugins */
 struct config ao_plugin_conf[]={
 	{"list", &ao_plugin_cfg.plugin_list, CONF_TYPE_STRING, 0, 0, 0, NULL},
@@ -167,6 +175,7 @@
 	{"ao", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
 
 	{"aop", ao_plugin_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+	{"af", audio_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
 	{"dsp", "Use -ao oss:dsp_path!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
         {"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"master", "Option -master has been removed, use -aop list=volume instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
--- a/libmpcodecs/dec_audio.c	Sun Oct 06 10:49:41 2002 +0000
+++ b/libmpcodecs/dec_audio.c	Sun Oct 06 11:23:02 2002 +0000
@@ -25,6 +25,7 @@
 #endif
 /* used for ac3surround decoder - set using -channels option */
 int audio_output_channels = 2;
+af_cfg_t af_cfg; // Configuration for audio filters
 
 static ad_functions_t* mpadec;
 
@@ -255,8 +256,7 @@
   afs->output.bps    = out_bps ? out_bps : afs->input.bps;
 
   // filter config:  
-  afs->cfg.force = 0;
-  afs->cfg.list = NULL;
+  memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t));
   
   mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Building audio filter chain for %dHz/%dch/%dbit -> %dHz/%dch/%dbit...\n",
       afs->input.rate,afs->input.nch,afs->input.bps*8,
--- a/mencoder.c	Sun Oct 06 10:49:41 2002 +0000
+++ b/mencoder.c	Sun Oct 06 11:23:02 2002 +0000
@@ -130,6 +130,7 @@
 static int skip_limit=-1;
 
 static int force_srate=0;
+static int audio_output_format=0;
 
 char *vobsub_out=NULL;
 unsigned int vobsub_out_index=0;
@@ -671,7 +672,7 @@
     } else {
 	mux_a->wf = malloc(sizeof(WAVEFORMATEX));
 	mux_a->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize;
-	mux_a->wf->wFormatTag = sh_audio->format;
+	mux_a->wf->wFormatTag = audio_output_format?audio_output_format:sh_audio->format;
 	mux_a->wf->nChannels = sh_audio->channels;
 	mux_a->wf->nSamplesPerSec = sh_audio->samplerate;
 	mux_a->wf->nAvgBytesPerSec=sh_audio->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec;
--- a/mplayer.c	Sun Oct 06 10:49:41 2002 +0000
+++ b/mplayer.c	Sun Oct 06 11:23:02 2002 +0000
@@ -212,6 +212,7 @@
 
 static float force_fps=0;
 static int force_srate=0;
+static int audio_output_format=0;
        int frame_dropping=0; // option  0=no drop  1= drop vo  2= drop decode
 static int play_n_frames=-1;
 static int play_n_frames_mf=-1;
@@ -1240,7 +1241,8 @@
       (ao_plugin_cfg.plugin_list), // plugin flag
       force_srate?force_srate:sh_audio->samplerate*playback_speed,
       audio_output_channels?audio_output_channels:
-      sh_audio->channels,sh_audio->sample_format,0))){
+      sh_audio->channels,audio_output_format?audio_output_format:
+      sh_audio->sample_format,0))){
     // FAILED:
     mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO);
     sh_audio=d_audio->sh=NULL; // -> nosound