Mercurial > mplayer.hg
changeset 14254:21e72b6d8d11
Do not use audio plugins anymore
author | reimar |
---|---|
date | Mon, 27 Dec 2004 19:34:42 +0000 |
parents | 6c9f27a5ea02 |
children | 137896e25c24 |
files | Gui/interface.c Gui/interface.h cfg-mplayer.h libao2/Makefile libao2/audio_out.c mplayer.c |
diffstat | 6 files changed, 77 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/interface.c Mon Dec 27 19:27:07 2004 +0000 +++ b/Gui/interface.c Mon Dec 27 19:34:42 2004 +0000 @@ -27,9 +27,11 @@ #include "../input/input.h" #include "../libao2/audio_out.h" #include "../mixer.h" -#include "../libao2/audio_plugin.h" +#include "../libaf/af.h" #include "../libao2/eq.h" +extern af_cfg_t af_cfg; + #ifdef USE_ICONV #include <iconv.h> #endif @@ -106,6 +108,9 @@ else gstrcat( str,what ); } +/** + * \brief this actually creates a new list containing only one element... + */ void gaddlist( char *** list,char * entry ) { int i; @@ -121,6 +126,32 @@ (*list)[1]=NULL; } +/** + * \brief this replaces a string starting with search by replace. + * If not found, replace is appended. + */ +void greplace(char ***list, char *search, char *replace) +{ + int i = 0; + int len = (search) ? strlen(search) : 0; + + if (*list) { + for (i = 0; (*list)[i]; i++) { + if (search && (strncmp((*list)[i], search, len) == 0)) { + free((*list)[i]); + (*list)[i] = gstrdup(replace); + return; + } + } + *list = realloc(*list, (i + 2) * sizeof(char *)); + } + else + *list = malloc(2 * sizeof(char *)); + + (*list)[i] = gstrdup(replace); + (*list)[i + 1] = NULL; +} + #ifdef USE_ICONV char * gconvert_uri_to_filename( char * str ) { @@ -543,6 +574,9 @@ case guiSetDemuxer: guiIntfStruct.demuxer=(void *)arg; break; + case guiSetAfilter: + guiIntfStruct.afilter=(void *)arg; + break; case guiSetShVideo: { if ( !appMPlayer.subWindow.isFullScreen ) @@ -786,12 +820,17 @@ // --- audio opts // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } - if ( gtkAONorm ) gset( &ao_plugin_cfg.plugin_list,"volnorm" ); - if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" ); + if (gtkAONorm) + greplace(&af_cfg.list, "volnorm", "volnorm"); + if (gtkEnableAudioEqualizer) + greplace(&af_cfg.list, "equalizer", "equalizer"); if ( gtkAOExtraStereo ) { - gset( &ao_plugin_cfg.plugin_list,"extrastereo" ); - ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul; + char *name = malloc(12 + 20 + 1); + snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); + name[12 + 20] = 0; + greplace(&af_cfg.list, "extrastereo", name); + free(name); } #ifdef USE_OSS_AUDIO if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) ) @@ -1078,7 +1117,9 @@ return NULL; case gtkSetExtraStereo: gtkAOExtraStereoMul=fparam; - audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(void *)>kAOExtraStereoMul ); + if (guiIntfStruct.afilter) + af_control_any_rev(guiIntfStruct.afilter, + AF_CONTROL_ES_MUL | AF_CONTROL_SET, >kAOExtraStereoMul); return NULL; case gtkSetPanscan: { @@ -1106,20 +1147,32 @@ if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam ); return NULL; case gtkSetEqualizer: + { + af_control_ext_t tmp; if ( eq ) { gtkEquChannels[eq->channel][eq->band]=eq->gain; - audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)eq ); + tmp.ch = eq->channel; + tmp.arg = gtkEquChannels[eq->channel]; + if (guiIntfStruct.afilter) + af_control_any_rev(guiIntfStruct.afilter, + AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); } else { - int i,j; equalizer_t tmp; tmp.gain=0.0f; + int i; memset( gtkEquChannels,0,sizeof( gtkEquChannels ) ); + if (guiIntfStruct.afilter) for ( i=0;i<6;i++ ) - for ( j=0;j<10;j++ ) - { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)&tmp ); } + { + tmp.ch = i; + tmp.arg = gtkEquChannels[i]; + af_control_any_rev(guiIntfStruct.afilter, + AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp); + } } return NULL; + } } return NULL; }
--- a/Gui/interface.h Mon Dec 27 19:27:07 2004 +0000 +++ b/Gui/interface.h Mon Dec 27 19:34:42 2004 +0000 @@ -59,6 +59,7 @@ guiUnknownErrorStruct error; void * sh_video; + void * afilter; void * demuxer; void * event_struct; @@ -130,6 +131,7 @@ #define guiSetFileFormat 14 #define guiSetDemuxer 15 #define guiSetParameters 16 +#define guiSetAfilter 17 #define guiSetStop 0 #define guiSetPlay 1
--- a/cfg-mplayer.h Mon Dec 27 19:27:07 2004 +0000 +++ b/cfg-mplayer.h Mon Dec 27 19:34:42 2004 +0000 @@ -122,18 +122,6 @@ /* from libvo/aspect.c */ extern float monitor_aspect; -/* Options related to audio out plugins */ -m_option_t ao_plugin_conf[]={ - {"list", &ao_plugin_cfg.plugin_list, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"delay", &ao_plugin_cfg.pl_delay_len, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, - {"format", &ao_plugin_cfg.pl_format_type, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, - {"fout", &ao_plugin_cfg.pl_resample_fout, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, - {"volume", &ao_plugin_cfg.pl_volume_volume, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL}, - {"mul", &ao_plugin_cfg.pl_extrastereo_mul, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL}, - {"softclip", &ao_plugin_cfg.pl_volume_softclip, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {NULL, NULL, 0, 0, 0, 0, NULL} -}; - extern int sws_flags; extern int readPPOpt(void *conf, char *arg); extern void revertPPOpt(void *conf, char* opt); @@ -166,7 +154,7 @@ {"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL}, {"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"aop", ao_plugin_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, + {"aop", "-aop is deprecated, use -af instead.\n", CONF_TYPE_PRINT, CONF_NOCFG, 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}, {"mixer-channel", &mixer_channel, CONF_TYPE_STRING, 0, 0, 0, NULL},
--- a/libao2/Makefile Mon Dec 27 19:27:07 2004 +0000 +++ b/libao2/Makefile Mon Dec 27 19:34:42 2004 +0000 @@ -2,7 +2,7 @@ LIBNAME = libao2.a -SRCS=audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c ao_plugin.c pl_delay.c pl_format.c pl_surround.c remez.c pl_resample.c pl_volume.c pl_extrastereo.c pl_volnorm.c pl_eq.c $(OPTIONAL_SRCS) +SRCS=audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c $(OPTIONAL_SRCS) OBJS=$(SRCS:.c=.o)
--- a/libao2/audio_out.c Mon Dec 27 19:27:07 2004 +0000 +++ b/libao2/audio_out.c Mon Dec 27 19:34:42 2004 +0000 @@ -64,7 +64,6 @@ extern ao_functions_t audio_out_mpegpes; extern ao_functions_t audio_out_pcm; extern ao_functions_t audio_out_pss; -extern ao_functions_t audio_out_plugin; ao_functions_t* audio_out_drivers[] = { @@ -123,7 +122,6 @@ &audio_out_null, // should not be auto-selected: &audio_out_pcm, - &audio_out_plugin, NULL }; @@ -163,10 +161,6 @@ ao_functions_t* audio_out=audio_out_drivers[i]; if(!strncmp(audio_out->info->short_name,ao,ao_len)){ // name matches, try it - if(use_plugin){ - audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out); - audio_out=&audio_out_plugin; - } if(audio_out->init(rate,channels,format,flags)) return audio_out; // success! } @@ -182,10 +176,6 @@ // now try the rest... for(i=0;audio_out_drivers[i];i++){ ao_functions_t* audio_out=audio_out_drivers[i]; - if(use_plugin){ - audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out); - audio_out=&audio_out_plugin; - } // if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE) if(audio_out->init(rate,channels,format,flags)) return audio_out; // success!
--- a/mplayer.c Mon Dec 27 19:27:07 2004 +0000 +++ b/mplayer.c Mon Dec 27 19:34:42 2004 +0000 @@ -58,7 +58,6 @@ #endif #include "libao2/audio_out.h" -#include "libao2/audio_plugin.h" #include "codec-cfg.h" @@ -389,6 +388,9 @@ inited_flags&=~INITED_ACODEC; current_module="uninit_acodec"; if(sh_audio) uninit_audio(sh_audio); +#ifdef HAVE_NEW_GUI + guiGetEvent(guiSetAfilter, (char *)NULL); +#endif sh_audio=NULL; } @@ -927,6 +929,9 @@ int result; if (!sh_audio) { +#ifdef HAVE_NEW_GUI + guiGetEvent(guiSetAfilter, (char *)NULL); +#endif mixer.afilter = NULL; return 0; } @@ -945,6 +950,9 @@ af_fmt2bits(ao_data->format) / 8, /* ao_data.bps, */ ao_data->outburst * 4, ao_data->buffersize); mixer.afilter = sh_audio->afilter; +#ifdef HAVE_NEW_GUI + guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter); +#endif return result; } @@ -2105,7 +2113,7 @@ #endif current_module="ao2_init"; if(!(audio_out=init_best_audio_out(audio_driver_list, - (ao_plugin_cfg.plugin_list!=NULL), // plugin flag + 0, // plugin flag force_srate?force_srate:ao_data.samplerate, audio_output_channels?audio_output_channels:ao_data.channels, audio_output_format?audio_output_format:ao_data.format,0))){