comparison Gui/interface.c @ 14254:21e72b6d8d11

Do not use audio plugins anymore
author reimar
date Mon, 27 Dec 2004 19:34:42 +0000
parents 6ecf5fca82e2
children db75b76c11b2
comparison
equal deleted inserted replaced
14253:6c9f27a5ea02 14254:21e72b6d8d11
25 #include "../libvo/font_load.h" 25 #include "../libvo/font_load.h"
26 #include "../libvo/sub.h" 26 #include "../libvo/sub.h"
27 #include "../input/input.h" 27 #include "../input/input.h"
28 #include "../libao2/audio_out.h" 28 #include "../libao2/audio_out.h"
29 #include "../mixer.h" 29 #include "../mixer.h"
30 #include "../libao2/audio_plugin.h" 30 #include "../libaf/af.h"
31 #include "../libao2/eq.h" 31 #include "../libao2/eq.h"
32
33 extern af_cfg_t af_cfg;
32 34
33 #ifdef USE_ICONV 35 #ifdef USE_ICONV
34 #include <iconv.h> 36 #include <iconv.h>
35 #endif 37 #endif
36 38
104 { 106 {
105 if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }} 107 if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }}
106 else gstrcat( str,what ); 108 else gstrcat( str,what );
107 } 109 }
108 110
111 /**
112 * \brief this actually creates a new list containing only one element...
113 */
109 void gaddlist( char *** list,char * entry ) 114 void gaddlist( char *** list,char * entry )
110 { 115 {
111 int i; 116 int i;
112 117
113 if ( (*list) ) 118 if ( (*list) )
117 } 122 }
118 123
119 (*list)=malloc( 2 * sizeof(char **) ); 124 (*list)=malloc( 2 * sizeof(char **) );
120 (*list)[0]=gstrdup( entry ); 125 (*list)[0]=gstrdup( entry );
121 (*list)[1]=NULL; 126 (*list)[1]=NULL;
127 }
128
129 /**
130 * \brief this replaces a string starting with search by replace.
131 * If not found, replace is appended.
132 */
133 void greplace(char ***list, char *search, char *replace)
134 {
135 int i = 0;
136 int len = (search) ? strlen(search) : 0;
137
138 if (*list) {
139 for (i = 0; (*list)[i]; i++) {
140 if (search && (strncmp((*list)[i], search, len) == 0)) {
141 free((*list)[i]);
142 (*list)[i] = gstrdup(replace);
143 return;
144 }
145 }
146 *list = realloc(*list, (i + 2) * sizeof(char *));
147 }
148 else
149 *list = malloc(2 * sizeof(char *));
150
151 (*list)[i] = gstrdup(replace);
152 (*list)[i + 1] = NULL;
122 } 153 }
123 154
124 #ifdef USE_ICONV 155 #ifdef USE_ICONV
125 char * gconvert_uri_to_filename( char * str ) 156 char * gconvert_uri_to_filename( char * str )
126 { 157 {
540 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } 571 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
541 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); 572 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
542 break; 573 break;
543 case guiSetDemuxer: 574 case guiSetDemuxer:
544 guiIntfStruct.demuxer=(void *)arg; 575 guiIntfStruct.demuxer=(void *)arg;
576 break;
577 case guiSetAfilter:
578 guiIntfStruct.afilter=(void *)arg;
545 break; 579 break;
546 case guiSetShVideo: 580 case guiSetShVideo:
547 { 581 {
548 if ( !appMPlayer.subWindow.isFullScreen ) 582 if ( !appMPlayer.subWindow.isFullScreen )
549 { 583 {
784 if ( gtkVopPP ) add_vop( "pp" ); 818 if ( gtkVopPP ) add_vop( "pp" );
785 else remove_vop( "pp" ); 819 else remove_vop( "pp" );
786 820
787 // --- audio opts 821 // --- audio opts
788 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } 822 // if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
789 if ( gtkAONorm ) gset( &ao_plugin_cfg.plugin_list,"volnorm" ); 823 if (gtkAONorm)
790 if ( gtkEnableAudioEqualizer ) gset( &ao_plugin_cfg.plugin_list,"eq" ); 824 greplace(&af_cfg.list, "volnorm", "volnorm");
825 if (gtkEnableAudioEqualizer)
826 greplace(&af_cfg.list, "equalizer", "equalizer");
791 if ( gtkAOExtraStereo ) 827 if ( gtkAOExtraStereo )
792 { 828 {
793 gset( &ao_plugin_cfg.plugin_list,"extrastereo" ); 829 char *name = malloc(12 + 20 + 1);
794 ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul; 830 snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
831 name[12 + 20] = 0;
832 greplace(&af_cfg.list, "extrastereo", name);
833 free(name);
795 } 834 }
796 #ifdef USE_OSS_AUDIO 835 #ifdef USE_OSS_AUDIO
797 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) ) 836 if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
798 { 837 {
799 char *tmp; 838 char *tmp;
1076 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0; 1115 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;
1077 #endif 1116 #endif
1078 return NULL; 1117 return NULL;
1079 case gtkSetExtraStereo: 1118 case gtkSetExtraStereo:
1080 gtkAOExtraStereoMul=fparam; 1119 gtkAOExtraStereoMul=fparam;
1081 audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(void *)&gtkAOExtraStereoMul ); 1120 if (guiIntfStruct.afilter)
1121 af_control_any_rev(guiIntfStruct.afilter,
1122 AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
1082 return NULL; 1123 return NULL;
1083 case gtkSetPanscan: 1124 case gtkSetPanscan:
1084 { 1125 {
1085 mp_cmd_t * mp_cmd; 1126 mp_cmd_t * mp_cmd;
1086 mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) ); 1127 mp_cmd=(mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
1104 return NULL; 1145 return NULL;
1105 case gtkSetSaturation: 1146 case gtkSetSaturation:
1106 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam ); 1147 if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
1107 return NULL; 1148 return NULL;
1108 case gtkSetEqualizer: 1149 case gtkSetEqualizer:
1150 {
1151 af_control_ext_t tmp;
1109 if ( eq ) 1152 if ( eq )
1110 { 1153 {
1111 gtkEquChannels[eq->channel][eq->band]=eq->gain; 1154 gtkEquChannels[eq->channel][eq->band]=eq->gain;
1112 audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)eq ); 1155 tmp.ch = eq->channel;
1156 tmp.arg = gtkEquChannels[eq->channel];
1157 if (guiIntfStruct.afilter)
1158 af_control_any_rev(guiIntfStruct.afilter,
1159 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
1113 } 1160 }
1114 else 1161 else
1115 { 1162 {
1116 int i,j; equalizer_t tmp; tmp.gain=0.0f; 1163 int i;
1117 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) ); 1164 memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
1165 if (guiIntfStruct.afilter)
1118 for ( i=0;i<6;i++ ) 1166 for ( i=0;i<6;i++ )
1119 for ( j=0;j<10;j++ ) 1167 {
1120 { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(void *)&tmp ); } 1168 tmp.ch = i;
1169 tmp.arg = gtkEquChannels[i];
1170 af_control_any_rev(guiIntfStruct.afilter,
1171 AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
1172 }
1121 } 1173 }
1122 return NULL; 1174 return NULL;
1175 }
1123 } 1176 }
1124 return NULL; 1177 return NULL;
1125 } 1178 }
1126 1179
1127 #define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1)) 1180 #define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))