]> git.sesse.net Git - vlc/blob - modules/gui/macosx/extended.m
* added video filters and i18n support -- still ToDo: loaded the settings from the...
[vlc] / modules / gui / macosx / extended.m
1 /*****************************************************************************
2  * extended.m: MacOS X Extended interface panel
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Felix Kühne <fkuehne@users.sf.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24
25 /*****************************************************************************
26  * Note: 
27  * the code used to bind with VLC's modules is heavily based upon 
28  * ../wxwidgets/extrapanel.cpp, written by Clément Stenac.
29  * the code used to insert/remove the views was inspired by intf.m, 
30  * written by Derk-Jan Hartman and Benjamin Pracht. 
31  * (all 3 are members of the VideoLAN team) 
32  *****************************************************************************/
33
34
35 /*****************************************************************************
36  * Preamble
37  *****************************************************************************/
38
39 #import "extended.h"
40 #import "intf.h"
41 #import <vlc/vlc.h>
42 #import <vlc/aout.h>
43 #import <aout_internal.h>
44 #import <vlc/vout.h>
45 #import <vlc/intf.h>
46
47 /*****************************************************************************
48  * VLCExtended implementation
49  *****************************************************************************/
50
51 @implementation VLCExtended
52
53 static VLCExtended *_o_sharedInstance = nil;
54
55 + (VLCExtended *)sharedInstance
56 {
57     return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
58 }
59
60 - (id)init
61 {
62     if (_o_sharedInstance) {
63         [self dealloc];
64     } else {
65         _o_sharedInstance = [super init];
66     }
67
68     return _o_sharedInstance;
69 }
70
71 - (void)initStrings
72 {
73     /* localise GUI-strings */
74     /* method is called from intf.m (in method showExtended) */
75     [o_extended_window setTitle: _NS("Extended controls")];
76     [o_lbl_video setStringValue: _NS("Video")];
77     [o_lbl_audio setStringValue: _NS("Audio")];
78     [o_lbl_audioFlts setStringValue: _NS("Audio filters")];
79     [o_lbl_videoFlts setStringValue: _NS("Video filters")];
80     [o_lbl_adjustImage setStringValue: _NS("Adjust Image")];
81     [o_btn_vidFlts_mrInfo setTitle: _NS("More Info")];
82     [o_ckb_blur setTitle: _NS("Blurring")];
83     [o_ckb_distortion setTitle: _NS("Distortion")];
84     [o_ckb_imgClone setTitle: _NS("Image clone")];
85     [o_ckb_imgCrop setTitle: _NS("Image cropping")];
86     [o_ckb_imgInvers setTitle: _NS("Image inversion")];
87     [o_ckb_trnsform setTitle: _NS("Transformation")];
88     [o_ckb_vlme_norm setTitle: _NS("Volume normalization")];
89     [o_ckb_hdphnVirt setTitle: _NS("Headphone virtualization")];
90     [o_lbl_maxLevel setStringValue: _NS("Maximum level")];
91     [o_btn_rstrDefaults setTitle: _NS("Restore Defaults")];
92     [o_ckb_enblAdjustImg setTitle: _NS("Enable")];
93     [o_lbl_brightness setStringValue: _NS("Brightness")];
94     [o_lbl_contrast setStringValue: _NS("Contrast")];
95     [o_lbl_gamma setStringValue: _NS("Gamma")];
96     [o_lbl_hue setStringValue: _NS("Hue")];
97     [o_lbl_saturation setStringValue: _NS("Saturation")];
98 }
99
100 - (void)awakeFromNib
101 {
102     /* set the adjust-filter-sliders to the values from the prefs and enable
103      * them, if wanted */
104     char * psz_vfilters;
105     intf_thread_t * p_intf = VLCIntf;
106     psz_vfilters = config_GetPsz( p_intf, "vout-filter" );
107     if( psz_vfilters && strstr( psz_vfilters, "adjust" ) )
108     {
109         [o_ckb_enblAdjustImg setState: NSOnState];
110         [o_btn_rstrDefaults setEnabled: YES];
111         [o_sld_brightness setEnabled: YES];
112         [o_sld_contrast setEnabled: YES];
113         [o_sld_gamma setEnabled: YES];
114         [o_sld_hue setEnabled: YES];
115         [o_sld_saturation setEnabled: YES];
116     }
117     else
118     {
119         [o_ckb_enblAdjustImg setState: NSOffState];
120         [o_btn_rstrDefaults setEnabled: NO];
121         [o_sld_brightness setEnabled: NO];
122         [o_sld_contrast setEnabled: NO];
123         [o_sld_gamma setEnabled: NO];
124         [o_sld_hue setEnabled: NO];
125         [o_sld_saturation setEnabled: NO];
126     }
127     if( psz_vfilters ) free( psz_vfilters );
128
129     int i_value = config_GetInt( p_intf, "hue" );
130     if( i_value > 0 && i_value < 360 )
131     {
132         [o_sld_hue setIntValue: i_value];
133     }
134     
135     float f_value;
136     
137     f_value = config_GetFloat( p_intf, "saturation" );
138     if( f_value > 0 && f_value < 5 )
139     {
140         [o_sld_saturation setIntValue: (int)(100 * f_value) ];
141     }
142     
143     f_value = config_GetFloat( p_intf, "contrast" );
144     if( f_value > 0 && f_value < 4 )
145     {
146         [o_sld_contrast setIntValue: (int)(100 * f_value) ];
147     }
148     
149     f_value = config_GetFloat( p_intf, "brightness" );
150     if( f_value > 0 && f_value < 2 )
151     {
152         [o_sld_brightness setIntValue: (int)(100 * f_value) ];
153     }
154     
155     f_value = config_GetFloat( p_intf, "gamma" );
156     if( f_value > 0 && f_value < 10 )
157     {
158         [o_sld_gamma setIntValue: (int)(10 * f_value) ];
159     }
160     
161     
162     /* set the audio-filter-checkboxes to the values taken from the prefs */
163     char * psz_afilters;
164     psz_afilters = config_GetPsz( p_intf, "audio-filter" );
165     if( psz_afilters )
166     {
167         [o_ckb_hdphnVirt setState: (int)strstr( psz_afilters, "headphone" ) ];
168         [o_ckb_vlme_norm setState: (int)strstr( psz_afilters, "normvol" ) ];
169         free( psz_afilters );
170     }
171 }
172
173 - (void)showPanel
174 {
175     /* show the window */
176     [o_extended_window displayIfNeeded];
177     [o_extended_window makeKeyAndOrderFront:nil];
178 }
179
180 - (IBAction)adjImg_Enbl:(id)sender
181 {
182     /* en-/disable the sliders */
183     if ([o_ckb_enblAdjustImg state] == NSOnState)
184     {
185         [o_btn_rstrDefaults setEnabled: YES];
186         [o_sld_brightness setEnabled: YES];
187         [o_sld_contrast setEnabled: YES];
188         [o_sld_gamma setEnabled: YES];
189         [o_sld_hue setEnabled: YES];
190         [o_sld_saturation setEnabled: YES];
191         [self changeVFiltersString: "adjust" onOrOff: YES];
192     }else{
193         [o_btn_rstrDefaults setEnabled: NO];
194         [o_sld_brightness setEnabled: NO];
195         [o_sld_contrast setEnabled: NO];
196         [o_sld_gamma setEnabled: NO];
197         [o_sld_hue setEnabled: NO];
198         [o_sld_saturation setEnabled: NO];
199         [self changeVFiltersString: "adjust" onOrOff: NO];
200     }
201 }
202
203 - (IBAction)adjImg_rstrDefaults:(id)sender
204 {
205     /* reset the sliders */
206     [o_sld_brightness setIntValue: 100];
207     [o_sld_contrast setIntValue: 100];
208     [o_sld_gamma setIntValue: 10];
209     [o_sld_hue setIntValue: 0];
210     [o_sld_saturation setIntValue: 100];
211     
212     /* transmit the values */
213     [self adjImg_sliders: o_sld_brightness];
214     [self adjImg_sliders: o_sld_contrast];
215     [self adjImg_sliders: o_sld_gamma];
216     [self adjImg_sliders: o_sld_hue];
217     [self adjImg_sliders: o_sld_saturation];
218 }
219
220 - (IBAction)adjImg_sliders:(id)sender
221 {
222     /* read-out the sliders' values and apply them */
223     intf_thread_t * p_intf = VLCIntf;
224     vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find(p_intf,
225                                  VLC_OBJECT_VOUT, FIND_ANYWHERE);
226     if( p_vout == NULL )
227     {
228         if (sender == o_sld_brightness)
229         {
230             config_PutFloat( p_intf , "brightness" , [o_sld_brightness floatValue] / 100);
231         } else if (sender == o_sld_contrast)
232         {
233             config_PutFloat( p_intf , "contrast" , [o_sld_contrast floatValue] / 100);
234         } else if (sender == o_sld_gamma)
235         {
236             config_PutFloat( p_intf , "gamma" , [o_sld_gamma floatValue] / 10);
237         } else if (sender == o_sld_hue)
238         {
239             config_PutInt( p_intf , "hue" , [o_sld_hue intValue]);
240         } else if (sender == o_sld_saturation)
241         {
242             config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100);
243         } else {
244             msg_Warn( p_intf, "cannot find adjust-image-subfilter related to " \
245                 "moved slider");
246         }
247     } else {
248         vlc_value_t val;
249         if (sender == o_sld_brightness)
250         {
251             val.f_float = [o_sld_brightness floatValue] / 100;
252             var_Set( p_vout, "brightness", val );
253             config_PutFloat( p_intf , "brightness" , [o_sld_brightness floatValue] / 100);
254         } else if (sender == o_sld_contrast)
255         {
256             val.f_float = [o_sld_contrast floatValue] / 100;
257             var_Set( p_vout, "contrast", val );
258             config_PutFloat( p_intf , "contrast" , [o_sld_contrast floatValue] / 100);
259         } else if (sender == o_sld_gamma)
260         {
261             val.f_float = [o_sld_gamma floatValue] / 10;
262             var_Set( p_vout, "gamma", val );
263             config_PutFloat( p_intf , "gamma" , [o_sld_gamma floatValue] / 10);
264         } else if (sender == o_sld_hue)
265         {
266             val.i_int = [o_sld_hue intValue];
267             var_Set( p_vout, "hue", val );
268             config_PutInt( p_intf , "hue" , [o_sld_hue intValue]);
269         } else if (sender == o_sld_saturation)
270         {
271             val.f_float = [o_sld_saturation floatValue] / 100;
272             var_Set( p_vout, "saturation", val );
273             config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100);
274         } else {
275             msg_Warn( p_intf, "cannot find adjust-image-subfilter related to " \
276                 "moved slider");
277         }
278     }
279 }
280
281 - (IBAction)audFtls_hdphnVirt:(id)sender
282 {
283     /* en-/disable headphone virtualisation */
284     if ([o_ckb_hdphnVirt state] == NSOnState)
285     {
286         [self changeAFiltersString: "headphone" onOrOff: YES ];
287     }else{
288         [self changeAFiltersString: "headphone" onOrOff: NO ];
289     }
290 }
291
292 - (IBAction)audFtls_maxLevelSld:(id)sender
293 {
294     /* read-out the slider's value and apply it */
295     intf_thread_t * p_intf = VLCIntf;
296     aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
297                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
298     if( p_aout != NULL )
299     {
300         var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] / 10 );
301         vlc_object_release( p_aout );
302     }
303     else
304     {
305         config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] /10 );
306     }
307 }
308
309 - (IBAction)audFtls_vlmeNorm:(id)sender
310 {
311     /* en-/disable volume normalisation */
312     if ([o_ckb_vlme_norm state] == NSOnState)
313     {
314         [self changeAFiltersString: "normvol" onOrOff: YES ];
315     }else{
316         [self changeAFiltersString: "normvol" onOrOff: NO ];
317     }
318 }
319
320 - (IBAction)extWin_exp_adjImg:(id)sender
321 {
322     /* expand or collapse adjImg */
323     NSRect o_win_rect = [o_extended_window frame];
324     NSRect o_box_audFlts_rect = [o_box_audFlts frame];
325     NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
326     NSRect o_box_adjImg_rect = [o_box_adjImg frame];
327     
328     if (o_adjImg_expanded)
329     {
330         /* move the window contents upwards (partially done through settings
331          * inside the nib) and resize the window */
332         o_win_rect.size.height = o_win_rect.size.height - 151;
333         o_win_rect.origin.y = [o_extended_window frame].origin.y + 151;
334         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 151;
335         o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 151;
336         
337         /* remove the inserted view */
338         [o_adjustImg_view removeFromSuperviewWithoutNeedingDisplay];
339     }else{
340     
341         /* move the window contents downwards and resize the window */
342         o_win_rect.size.height = o_win_rect.size.height + 151;
343         o_win_rect.origin.y = [o_extended_window frame].origin.y - 151;
344         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 151;
345         o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 151;
346     }
347     
348     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
349     [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
350     [o_extended_window displayIfNeeded];
351     [o_extended_window setFrame: o_win_rect display:YES animate: YES];
352     
353     if (o_adjImg_expanded)
354     {
355         o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 151;
356         msg_Dbg( VLCIntf, "collapsed adjust-image section");
357         o_adjImg_expanded = NO;
358     } else {
359         /* insert view */
360         o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 151;
361         [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 161)];
362         [o_adjustImg_view setNeedsDisplay:YES];
363         [o_adjustImg_view setAutoresizesSubviews: YES];
364         [[o_box_adjImg contentView] addSubview: o_adjustImg_view];
365         msg_Dbg( VLCIntf, "expanded adjust-image section");
366         o_adjImg_expanded = YES;
367     }
368     [o_box_adjImg setFrameFromContentFrame: o_box_adjImg_rect];
369 }
370
371 - (IBAction)extWin_exp_audFlts:(id)sender
372 {
373     /* expand or collapse audFlts */
374     NSRect o_win_rect = [o_extended_window frame];
375     NSRect o_box_audFlts_rect = [o_box_audFlts frame];
376     
377     if (o_audFlts_expanded)
378     {
379         /* move the window contents upwards (partially done through settings
380          * inside the nib) and resize the window */
381         o_win_rect.size.height = o_win_rect.size.height - 66;
382         o_win_rect.origin.y = [o_extended_window frame].origin.y + 66;
383         
384         /* remove the inserted view */
385         [o_audioFlts_view removeFromSuperviewWithoutNeedingDisplay];
386     }else{
387         /* move the window contents downwards and resize the window */
388         o_win_rect.size.height = o_win_rect.size.height + 66;
389         o_win_rect.origin.y = [o_extended_window frame].origin.y - 66;
390     }
391     [o_extended_window displayIfNeeded];
392     [o_extended_window setFrame: o_win_rect display:YES animate: YES];
393     
394     
395     if (o_audFlts_expanded)
396     {
397         o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height - 66;
398         msg_Dbg( VLCIntf, "collapsed audio-filters section");
399         o_audFlts_expanded = NO;
400     } else {
401         /* insert view */
402         o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height + 66;
403         [o_audioFlts_view setFrame: NSMakeRect( 20, -20, 370, 76)];
404         [o_audioFlts_view setNeedsDisplay:YES];
405         [o_audioFlts_view setAutoresizesSubviews: YES];
406         [[o_box_audFlts contentView] addSubview: o_audioFlts_view];
407         msg_Dbg( VLCIntf, "expanded audio-filters section");
408         o_audFlts_expanded = YES;
409     }
410     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
411 }
412
413 - (IBAction)extWin_exp_vidFlts:(id)sender
414 {
415     /* expand or collapse vidFlts */
416     NSRect o_win_rect = [o_extended_window frame];
417     NSRect o_box_audFlts_rect = [o_box_audFlts frame];
418     NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
419     
420     if (o_vidFlts_expanded)
421     {
422         /* move the window contents upwards (partially done through settings
423          * inside the nib) and resize the window */
424         o_win_rect.size.height = o_win_rect.size.height - 134;
425         o_win_rect.origin.y = [o_extended_window frame].origin.y + 134;
426         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 134;
427         
428         /* remove the inserted view */
429         [o_videoFilters_view removeFromSuperviewWithoutNeedingDisplay];
430     }else{
431     
432         /* move the window contents downwards and resize the window */
433         o_win_rect.size.height = o_win_rect.size.height + 134;
434         o_win_rect.origin.y = [o_extended_window frame].origin.y - 134;
435         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 134;
436     }
437     
438     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
439     [o_extended_window displayIfNeeded];
440     [o_extended_window setFrame: o_win_rect display:YES animate: YES];
441     
442     if (o_vidFlts_expanded)
443     {
444         o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 134;
445         msg_Dbg( VLCIntf, "collapsed video-filters section");
446         o_vidFlts_expanded = NO;
447     } else {
448         /* insert view */
449         o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 134;
450         [o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 144)];
451         [o_videoFilters_view setNeedsDisplay:YES];
452         [o_videoFilters_view setAutoresizesSubviews: YES];
453         [[o_box_vidFlts contentView] addSubview: o_videoFilters_view];
454         msg_Dbg( VLCIntf, "expanded video-filters section");
455         o_vidFlts_expanded = YES;
456     }
457     [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
458 }
459
460 - (IBAction)vidFlts:(id)sender
461 {
462     /* en-/disable video filters */
463     if (sender == o_ckb_blur)
464     {
465         [self changeVFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];
466     }
467     else if (sender == o_ckb_distortion)
468     {
469         [self changeVFiltersString: "distort" onOrOff: [o_ckb_distortion state]];
470     }
471     else if (sender == o_ckb_imgClone)
472     {
473         [self changeVFiltersString: "clone" onOrOff: [o_ckb_imgClone state]];
474     }
475     else if (sender == o_ckb_imgCrop)
476     {
477         [self changeVFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]];
478     }
479     else if (sender == o_ckb_imgInvers)
480     {
481         [self changeVFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]];
482     }
483     else if (sender == o_ckb_trnsform)
484     {
485         [self changeVFiltersString: "transform" onOrOff: [o_ckb_trnsform state]];
486     } else {
487         /* this shouldn't happen */
488         msg_Warn (VLCIntf, "cannot find selected video-filter");
489     }
490 }
491
492 - (IBAction)vidFlts_mrInfo:(id)sender
493 {
494     /* show info sheet */
495     NSBeginInformationalAlertSheet(_NS("More information"), _NS("OK"), @"", @"", \
496         o_extended_window, nil, nil, nil, nil, _NS("Select the video effects " \
497         "filters to apply. You must restart the stream for these settings to " \
498         "take effect.\nTo configure the filters, go to the Preferences, and " \
499         "go to Modules/Video Filters. You can then configure each filter.\n" \
500         "If you want fine control over the filters ( to choose the order in " \
501         "which they are applied ), you need to enter manually a filters " \
502         "string (Preferences / Video / Filters)."));
503 }
504
505 - (void)changeVFiltersString:(char *)psz_name onOrOff:(BOOL)o_onOrOff 
506 {
507     /* copied from ../wxwidgets/extrapanel.cpp
508      * renamed to conform with Cocoa's rules */
509      
510     vout_thread_t *p_vout;
511     intf_thread_t * p_intf = VLCIntf;
512     
513     char *psz_parser, *psz_string;
514     psz_string = config_GetPsz( p_intf, "vout-filter" );
515     
516     if( !psz_string ) psz_string = strdup("");
517
518     psz_parser = strstr( psz_string, psz_name );
519
520     if( o_onOrOff )
521     {
522         if( !psz_parser )
523         {
524             psz_parser = psz_string;
525             asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
526                             psz_string, psz_name );
527             free( psz_parser );
528         }
529         else
530         {
531             return;
532         }
533     }
534     else
535     {
536         if( psz_parser )
537         {
538             memmove( psz_parser, psz_parser + strlen(psz_name) +
539                             (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
540                             strlen(psz_parser + strlen(psz_name)) + 1 );
541
542             /* Remove trailing : : */
543             if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
544             {
545                 *(psz_string+strlen(psz_string ) -1 ) = '\0';
546             }
547          }
548          else
549          {
550              free( psz_string );
551              return;
552          }
553     }
554     /* Vout is not kept, so put that in the config */
555     config_PutPsz( p_intf, "vout-filter", psz_string );
556
557     /* Try to set on the fly */
558     p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
559                                               FIND_ANYWHERE );
560     if( p_vout )
561     {
562         var_SetString( p_vout, "vout-filter", psz_string );
563         vlc_object_release( p_vout );
564     }
565
566     free( psz_string );
567 }
568
569
570 - (void)changeAFiltersString: (char *)psz_name onOrOff: (BOOL)o_onOrOff;
571 {
572     char *psz_parser, *psz_string;
573     intf_thread_t * p_intf = VLCIntf;
574     aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
575                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
576
577     if( p_aout )
578     {
579         psz_string = var_GetString( p_aout, "audio-filter" );
580     }
581     else
582     {
583         psz_string = config_GetPsz( p_intf, "audio-filter" );
584     }
585
586     if( !psz_string ) psz_string = strdup("");
587
588     psz_parser = strstr( psz_string, psz_name );
589
590     if( o_onOrOff )
591     {
592         if( !psz_parser )
593         {
594             psz_parser = psz_string;
595             asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
596                             psz_string, psz_name );
597             free( psz_parser );
598         }
599         else
600         {
601             return;
602         }
603     }
604     else
605     {
606         if( psz_parser )
607         {
608             memmove( psz_parser, psz_parser + strlen(psz_name) +
609                             (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
610                             strlen(psz_parser + strlen(psz_name)) + 1 );
611
612             if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
613             {
614                 *(psz_string+strlen(psz_string ) -1 ) = '\0';
615             }
616          }
617          else
618          {
619              free( psz_string );
620              return;
621          }
622     }
623
624     if( p_aout == NULL )
625     {
626         config_PutPsz( p_intf, "audio-filter", psz_string );
627     }
628     else
629     {
630         var_SetString( p_aout, "audio-filter", psz_string );
631         int i = 0;
632         while( i < p_aout->i_nb_inputs )
633         {
634             p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
635             i = (i + 1);
636         }
637         vlc_object_release( p_aout );
638     }
639     free( psz_string );
640 }
641 @end