mirror of https://github.com/mpv-player/mpv
Do not use audio plugins anymore
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14255 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
bd6b315f6b
commit
0fdaa5ab30
|
@ -27,9 +27,11 @@
|
||||||
#include "../input/input.h"
|
#include "../input/input.h"
|
||||||
#include "../libao2/audio_out.h"
|
#include "../libao2/audio_out.h"
|
||||||
#include "../mixer.h"
|
#include "../mixer.h"
|
||||||
#include "../libao2/audio_plugin.h"
|
#include "../libaf/af.h"
|
||||||
#include "../libao2/eq.h"
|
#include "../libao2/eq.h"
|
||||||
|
|
||||||
|
extern af_cfg_t af_cfg;
|
||||||
|
|
||||||
#ifdef USE_ICONV
|
#ifdef USE_ICONV
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,6 +108,9 @@ void gset( char ** str,char * what )
|
||||||
else gstrcat( str,what );
|
else gstrcat( str,what );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief this actually creates a new list containing only one element...
|
||||||
|
*/
|
||||||
void gaddlist( char *** list,char * entry )
|
void gaddlist( char *** list,char * entry )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -121,6 +126,32 @@ void gaddlist( char *** list,char * entry )
|
||||||
(*list)[1]=NULL;
|
(*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
|
#ifdef USE_ICONV
|
||||||
char * gconvert_uri_to_filename( char * str )
|
char * gconvert_uri_to_filename( char * str )
|
||||||
{
|
{
|
||||||
|
@ -543,6 +574,9 @@ int guiGetEvent( int type,char * arg )
|
||||||
case guiSetDemuxer:
|
case guiSetDemuxer:
|
||||||
guiIntfStruct.demuxer=(void *)arg;
|
guiIntfStruct.demuxer=(void *)arg;
|
||||||
break;
|
break;
|
||||||
|
case guiSetAfilter:
|
||||||
|
guiIntfStruct.afilter=(void *)arg;
|
||||||
|
break;
|
||||||
case guiSetShVideo:
|
case guiSetShVideo:
|
||||||
{
|
{
|
||||||
if ( !appMPlayer.subWindow.isFullScreen )
|
if ( !appMPlayer.subWindow.isFullScreen )
|
||||||
|
@ -786,12 +820,17 @@ int guiGetEvent( int type,char * arg )
|
||||||
|
|
||||||
// --- audio opts
|
// --- audio opts
|
||||||
// if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
|
// 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 (gtkAONorm)
|
||||||
if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" );
|
greplace(&af_cfg.list, "volnorm", "volnorm");
|
||||||
|
if (gtkEnableAudioEqualizer)
|
||||||
|
greplace(&af_cfg.list, "equalizer", "equalizer");
|
||||||
if ( gtkAOExtraStereo )
|
if ( gtkAOExtraStereo )
|
||||||
{
|
{
|
||||||
gset( &ao_plugin_cfg.plugin_list,"extrastereo" );
|
char *name = malloc(12 + 20 + 1);
|
||||||
ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
|
snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
|
||||||
|
name[12 + 20] = 0;
|
||||||
|
greplace(&af_cfg.list, "extrastereo", name);
|
||||||
|
free(name);
|
||||||
}
|
}
|
||||||
#ifdef USE_OSS_AUDIO
|
#ifdef USE_OSS_AUDIO
|
||||||
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
|
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
|
||||||
|
@ -1078,7 +1117,9 @@ void * gtkSet( int cmd,float fparam, void * vparam )
|
||||||
return NULL;
|
return NULL;
|
||||||
case gtkSetExtraStereo:
|
case gtkSetExtraStereo:
|
||||||
gtkAOExtraStereoMul=fparam;
|
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;
|
return NULL;
|
||||||
case gtkSetPanscan:
|
case gtkSetPanscan:
|
||||||
{
|
{
|
||||||
|
@ -1106,20 +1147,32 @@ void * gtkSet( int cmd,float fparam, void * vparam )
|
||||||
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
|
if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
|
||||||
return NULL;
|
return NULL;
|
||||||
case gtkSetEqualizer:
|
case gtkSetEqualizer:
|
||||||
|
{
|
||||||
|
af_control_ext_t tmp;
|
||||||
if ( eq )
|
if ( eq )
|
||||||
{
|
{
|
||||||
gtkEquChannels[eq->channel][eq->band]=eq->gain;
|
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
|
else
|
||||||
{
|
{
|
||||||
int i,j; equalizer_t tmp; tmp.gain=0.0f;
|
int i;
|
||||||
memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
|
memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
|
||||||
|
if (guiIntfStruct.afilter)
|
||||||
for ( i=0;i<6;i++ )
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ typedef struct
|
||||||
guiUnknownErrorStruct error;
|
guiUnknownErrorStruct error;
|
||||||
|
|
||||||
void * sh_video;
|
void * sh_video;
|
||||||
|
void * afilter;
|
||||||
void * demuxer;
|
void * demuxer;
|
||||||
void * event_struct;
|
void * event_struct;
|
||||||
|
|
||||||
|
@ -130,6 +131,7 @@ extern guiInterface_t guiIntfStruct;
|
||||||
#define guiSetFileFormat 14
|
#define guiSetFileFormat 14
|
||||||
#define guiSetDemuxer 15
|
#define guiSetDemuxer 15
|
||||||
#define guiSetParameters 16
|
#define guiSetParameters 16
|
||||||
|
#define guiSetAfilter 17
|
||||||
|
|
||||||
#define guiSetStop 0
|
#define guiSetStop 0
|
||||||
#define guiSetPlay 1
|
#define guiSetPlay 1
|
||||||
|
|
|
@ -122,18 +122,6 @@ extern int nortc;
|
||||||
/* from libvo/aspect.c */
|
/* from libvo/aspect.c */
|
||||||
extern float monitor_aspect;
|
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 sws_flags;
|
||||||
extern int readPPOpt(void *conf, char *arg);
|
extern int readPPOpt(void *conf, char *arg);
|
||||||
extern void revertPPOpt(void *conf, char* opt);
|
extern void revertPPOpt(void *conf, char* opt);
|
||||||
|
@ -166,7 +154,7 @@ m_option_t mplayer_opts[]={
|
||||||
{"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
{"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||||
{"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, 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},
|
{"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", &mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||||
{"mixer-channel", &mixer_channel, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
{"mixer-channel", &mixer_channel, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||||
|
|
|
@ -2,7 +2,7 @@ include config.mak
|
||||||
|
|
||||||
LIBNAME = libao2.a
|
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)
|
OBJS=$(SRCS:.c=.o)
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ extern ao_functions_t audio_out_dxr2;
|
||||||
extern ao_functions_t audio_out_mpegpes;
|
extern ao_functions_t audio_out_mpegpes;
|
||||||
extern ao_functions_t audio_out_pcm;
|
extern ao_functions_t audio_out_pcm;
|
||||||
extern ao_functions_t audio_out_pss;
|
extern ao_functions_t audio_out_pss;
|
||||||
extern ao_functions_t audio_out_plugin;
|
|
||||||
|
|
||||||
ao_functions_t* audio_out_drivers[] =
|
ao_functions_t* audio_out_drivers[] =
|
||||||
{
|
{
|
||||||
|
@ -123,7 +122,6 @@ ao_functions_t* audio_out_drivers[] =
|
||||||
&audio_out_null,
|
&audio_out_null,
|
||||||
// should not be auto-selected:
|
// should not be auto-selected:
|
||||||
&audio_out_pcm,
|
&audio_out_pcm,
|
||||||
&audio_out_plugin,
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,10 +161,6 @@ ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int c
|
||||||
ao_functions_t* audio_out=audio_out_drivers[i];
|
ao_functions_t* audio_out=audio_out_drivers[i];
|
||||||
if(!strncmp(audio_out->info->short_name,ao,ao_len)){
|
if(!strncmp(audio_out->info->short_name,ao,ao_len)){
|
||||||
// name matches, try it
|
// 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))
|
if(audio_out->init(rate,channels,format,flags))
|
||||||
return audio_out; // success!
|
return audio_out; // success!
|
||||||
}
|
}
|
||||||
|
@ -182,10 +176,6 @@ ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int c
|
||||||
// now try the rest...
|
// now try the rest...
|
||||||
for(i=0;audio_out_drivers[i];i++){
|
for(i=0;audio_out_drivers[i];i++){
|
||||||
ao_functions_t* audio_out=audio_out_drivers[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->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE)
|
||||||
if(audio_out->init(rate,channels,format,flags))
|
if(audio_out->init(rate,channels,format,flags))
|
||||||
return audio_out; // success!
|
return audio_out; // success!
|
||||||
|
|
12
mplayer.c
12
mplayer.c
|
@ -58,7 +58,6 @@ extern int mp_input_win32_slave_cmd_func(int fd,char* dest,int size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libao2/audio_out.h"
|
#include "libao2/audio_out.h"
|
||||||
#include "libao2/audio_plugin.h"
|
|
||||||
|
|
||||||
#include "codec-cfg.h"
|
#include "codec-cfg.h"
|
||||||
|
|
||||||
|
@ -389,6 +388,9 @@ static void uninit_player(unsigned int mask){
|
||||||
inited_flags&=~INITED_ACODEC;
|
inited_flags&=~INITED_ACODEC;
|
||||||
current_module="uninit_acodec";
|
current_module="uninit_acodec";
|
||||||
if(sh_audio) uninit_audio(sh_audio);
|
if(sh_audio) uninit_audio(sh_audio);
|
||||||
|
#ifdef HAVE_NEW_GUI
|
||||||
|
guiGetEvent(guiSetAfilter, (char *)NULL);
|
||||||
|
#endif
|
||||||
sh_audio=NULL;
|
sh_audio=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,6 +929,9 @@ static int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data)
|
||||||
int result;
|
int result;
|
||||||
if (!sh_audio)
|
if (!sh_audio)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_NEW_GUI
|
||||||
|
guiGetEvent(guiSetAfilter, (char *)NULL);
|
||||||
|
#endif
|
||||||
mixer.afilter = NULL;
|
mixer.afilter = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -945,6 +950,9 @@ static int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data)
|
||||||
af_fmt2bits(ao_data->format) / 8, /* ao_data.bps, */
|
af_fmt2bits(ao_data->format) / 8, /* ao_data.bps, */
|
||||||
ao_data->outburst * 4, ao_data->buffersize);
|
ao_data->outburst * 4, ao_data->buffersize);
|
||||||
mixer.afilter = sh_audio->afilter;
|
mixer.afilter = sh_audio->afilter;
|
||||||
|
#ifdef HAVE_NEW_GUI
|
||||||
|
guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter);
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2105,7 +2113,7 @@ if(sh_audio){
|
||||||
#endif
|
#endif
|
||||||
current_module="ao2_init";
|
current_module="ao2_init";
|
||||||
if(!(audio_out=init_best_audio_out(audio_driver_list,
|
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,
|
force_srate?force_srate:ao_data.samplerate,
|
||||||
audio_output_channels?audio_output_channels:ao_data.channels,
|
audio_output_channels?audio_output_channels:ao_data.channels,
|
||||||
audio_output_format?audio_output_format:ao_data.format,0))){
|
audio_output_format?audio_output_format:ao_data.format,0))){
|
||||||
|
|
Loading…
Reference in New Issue