]> git.sesse.net Git - vlc/blob - modules/gui/macosx/extended.m
* ALL: releasing a few unreleased objects.
[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         vlc_object_release( p_vout );
279     }
280 }
281
282 - (IBAction)audFtls_hdphnVirt:(id)sender
283 {
284     /* en-/disable headphone virtualisation */
285     if ([o_ckb_hdphnVirt state] == NSOnState)
286     {
287         [self changeAFiltersString: "headphone" onOrOff: YES ];
288     }else{
289         [self changeAFiltersString: "headphone" onOrOff: NO ];
290     }
291 }
292
293 - (IBAction)audFtls_maxLevelSld:(id)sender
294 {
295     /* read-out the slider's value and apply it */
296     intf_thread_t * p_intf = VLCIntf;
297     aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
298                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
299     if( p_aout != NULL )
300     {
301         var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] / 10 );
302         vlc_object_release( p_aout );
303     }
304     else
305     {
306         config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] /10 );
307     }
308 }
309
310 - (IBAction)audFtls_vlmeNorm:(id)sender
311 {
312     /* en-/disable volume normalisation */
313     if ([o_ckb_vlme_norm state] == NSOnState)
314     {
315         [self changeAFiltersString: "normvol" onOrOff: YES ];
316     }else{
317         [self changeAFiltersString: "normvol" onOrOff: NO ];
318     }
319 }
320
321 - (IBAction)extWin_exp_adjImg:(id)sender
322 {
323     /* expand or collapse adjImg */
324     NSRect o_win_rect = [o_extended_window frame];
325     NSRect o_box_audFlts_rect = [o_box_audFlts frame];
326     NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
327     NSRect o_box_adjImg_rect = [o_box_adjImg frame];
328     
329     if (o_adjImg_expanded)
330     {
331         /* move the window contents upwards (partially done through settings
332          * inside the nib) and resize the window */
333         o_win_rect.size.height = o_win_rect.size.height - 151;
334         o_win_rect.origin.y = [o_extended_window frame].origin.y + 151;
335         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 151;
336         o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 151;
337         
338         /* remove the inserted view */
339         [o_adjustImg_view removeFromSuperviewWithoutNeedingDisplay];
340     }else{
341     
342         /* move the window contents downwards and resize the window */
343         o_win_rect.size.height = o_win_rect.size.height + 151;
344         o_win_rect.origin.y = [o_extended_window frame].origin.y - 151;
345         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 151;
346         o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 151;
347     }
348     
349     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
350     [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
351     [o_extended_window displayIfNeeded];
352     [o_extended_window setFrame: o_win_rect display:YES animate: YES];
353     
354     if (o_adjImg_expanded)
355     {
356         o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 151;
357         msg_Dbg( VLCIntf, "collapsed adjust-image section");
358         o_adjImg_expanded = NO;
359     } else {
360         /* insert view */
361         o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 151;
362         [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 161)];
363         [o_adjustImg_view setNeedsDisplay:YES];
364         [o_adjustImg_view setAutoresizesSubviews: YES];
365         [[o_box_adjImg contentView] addSubview: o_adjustImg_view];
366         msg_Dbg( VLCIntf, "expanded adjust-image section");
367         o_adjImg_expanded = YES;
368     }
369     [o_box_adjImg setFrameFromContentFrame: o_box_adjImg_rect];
370 }
371
372 - (IBAction)extWin_exp_audFlts:(id)sender
373 {
374     /* expand or collapse audFlts */
375     NSRect o_win_rect = [o_extended_window frame];
376     NSRect o_box_audFlts_rect = [o_box_audFlts frame];
377     
378     if (o_audFlts_expanded)
379     {
380         /* move the window contents upwards (partially done through settings
381          * inside the nib) and resize the window */
382         o_win_rect.size.height = o_win_rect.size.height - 66;
383         o_win_rect.origin.y = [o_extended_window frame].origin.y + 66;
384         
385         /* remove the inserted view */
386         [o_audioFlts_view removeFromSuperviewWithoutNeedingDisplay];
387     }else{
388         /* move the window contents downwards and resize the window */
389         o_win_rect.size.height = o_win_rect.size.height + 66;
390         o_win_rect.origin.y = [o_extended_window frame].origin.y - 66;
391     }
392     [o_extended_window displayIfNeeded];
393     [o_extended_window setFrame: o_win_rect display:YES animate: YES];
394     
395     
396     if (o_audFlts_expanded)
397     {
398         o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height - 66;
399         msg_Dbg( VLCIntf, "collapsed audio-filters section");
400         o_audFlts_expanded = NO;
401     } else {
402         /* insert view */
403         o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height + 66;
404         [o_audioFlts_view setFrame: NSMakeRect( 20, -20, 370, 76)];
405         [o_audioFlts_view setNeedsDisplay:YES];
406         [o_audioFlts_view setAutoresizesSubviews: YES];
407         [[o_box_audFlts contentView] addSubview: o_audioFlts_view];
408         msg_Dbg( VLCIntf, "expanded audio-filters section");
409         o_audFlts_expanded = YES;
410     }
411     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
412 }
413
414 - (IBAction)extWin_exp_vidFlts:(id)sender
415 {
416     /* expand or collapse vidFlts */
417     NSRect o_win_rect = [o_extended_window frame];
418     NSRect o_box_audFlts_rect = [o_box_audFlts frame];
419     NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
420     
421     if (o_vidFlts_expanded)
422     {
423         /* move the window contents upwards (partially done through settings
424          * inside the nib) and resize the window */
425         o_win_rect.size.height = o_win_rect.size.height - 134;
426         o_win_rect.origin.y = [o_extended_window frame].origin.y + 134;
427         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 134;
428         
429         /* remove the inserted view */
430         [o_videoFilters_view removeFromSuperviewWithoutNeedingDisplay];
431     }else{
432     
433         /* move the window contents downwards and resize the window */
434         o_win_rect.size.height = o_win_rect.size.height + 134;
435         o_win_rect.origin.y = [o_extended_window frame].origin.y - 134;
436         o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 134;
437     }
438     
439     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
440     [o_extended_window displayIfNeeded];
441     [o_extended_window setFrame: o_win_rect display:YES animate: YES];
442     
443     if (o_vidFlts_expanded)
444     {
445         o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 134;
446         msg_Dbg( VLCIntf, "collapsed video-filters section");
447         o_vidFlts_expanded = NO;
448     } else {
449         /* insert view */
450         o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 134;
451         [o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 144)];
452         [o_videoFilters_view setNeedsDisplay:YES];
453         [o_videoFilters_view setAutoresizesSubviews: YES];
454         [[o_box_vidFlts contentView] addSubview: o_videoFilters_view];
455         msg_Dbg( VLCIntf, "expanded video-filters section");
456         o_vidFlts_expanded = YES;
457     }
458     [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
459 }
460
461 - (IBAction)vidFlts:(id)sender
462 {
463     /* en-/disable video filters */
464     if (sender == o_ckb_blur)
465     {
466         [self changeVFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];
467     }
468     else if (sender == o_ckb_distortion)
469     {
470         [self changeVFiltersString: "distort" onOrOff: [o_ckb_distortion state]];
471     }
472     else if (sender == o_ckb_imgClone)
473     {
474         [self changeVFiltersString: "clone" onOrOff: [o_ckb_imgClone state]];
475     }
476     else if (sender == o_ckb_imgCrop)
477     {
478         [self changeVFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]];
479     }
480     else if (sender == o_ckb_imgInvers)
481     {
482         [self changeVFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]];
483     }
484     else if (sender == o_ckb_trnsform)
485     {
486         [self changeVFiltersString: "transform" onOrOff: [o_ckb_trnsform state]];
487     } else {
488         /* this shouldn't happen */
489         msg_Warn (VLCIntf, "cannot find selected video-filter");
490     }
491 }
492
493 - (IBAction)vidFlts_mrInfo:(id)sender
494 {
495     /* show info sheet */
496     NSBeginInformationalAlertSheet(_NS("More information"), _NS("OK"), @"", @"", \
497         o_extended_window, nil, nil, nil, nil, _NS("Select the video effects " \
498         "filters to apply. You must restart the stream for these settings to " \
499         "take effect.\nTo configure the filters, go to the Preferences, and " \
500         "go to Modules/Video Filters. You can then configure each filter.\n" \
501         "If you want fine control over the filters ( to choose the order in " \
502         "which they are applied ), you need to enter manually a filters " \
503         "string (Preferences / Video / Filters)."));
504 }
505
506 - (void)changeVFiltersString:(char *)psz_name onOrOff:(BOOL)o_onOrOff 
507 {
508     /* copied from ../wxwidgets/extrapanel.cpp
509      * renamed to conform with Cocoa's rules */
510      
511     vout_thread_t *p_vout;
512     intf_thread_t * p_intf = VLCIntf;
513     
514     char *psz_parser, *psz_string;
515     psz_string = config_GetPsz( p_intf, "vout-filter" );
516     
517     if( !psz_string ) psz_string = strdup("");
518
519     psz_parser = strstr( psz_string, psz_name );
520
521     if( o_onOrOff )
522     {
523         if( !psz_parser )
524         {
525             psz_parser = psz_string;
526             asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
527                             psz_string, psz_name );
528             free( psz_parser );
529         }
530         else
531         {
532             return;
533         }
534     }
535     else
536     {
537         if( psz_parser )
538         {
539             memmove( psz_parser, psz_parser + strlen(psz_name) +
540                             (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
541                             strlen(psz_parser + strlen(psz_name)) + 1 );
542
543             /* Remove trailing : : */
544             if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
545             {
546                 *(psz_string+strlen(psz_string ) -1 ) = '\0';
547             }
548          }
549          else
550          {
551              free( psz_string );
552              return;
553          }
554     }
555     /* Vout is not kept, so put that in the config */
556     config_PutPsz( p_intf, "vout-filter", psz_string );
557
558     /* Try to set on the fly */
559     p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
560                                               FIND_ANYWHERE );
561     if( p_vout )
562     {
563         var_SetString( p_vout, "vout-filter", psz_string );
564         vlc_object_release( p_vout );
565     }
566
567     free( psz_string );
568 }
569
570
571 - (void)changeAFiltersString: (char *)psz_name onOrOff: (BOOL)o_onOrOff;
572 {
573     char *psz_parser, *psz_string;
574     intf_thread_t * p_intf = VLCIntf;
575     aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
576                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
577
578     if( p_aout )
579     {
580         psz_string = var_GetString( p_aout, "audio-filter" );
581     }
582     else
583     {
584         psz_string = config_GetPsz( p_intf, "audio-filter" );
585     }
586
587     if( !psz_string ) psz_string = strdup("");
588
589     psz_parser = strstr( psz_string, psz_name );
590
591     if( o_onOrOff )
592     {
593         if( !psz_parser )
594         {
595             psz_parser = psz_string;
596             asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
597                             psz_string, psz_name );
598             free( psz_parser );
599         }
600         else
601         {
602             return;
603         }
604     }
605     else
606     {
607         if( psz_parser )
608         {
609             memmove( psz_parser, psz_parser + strlen(psz_name) +
610                             (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
611                             strlen(psz_parser + strlen(psz_name)) + 1 );
612
613             if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
614             {
615                 *(psz_string+strlen(psz_string ) -1 ) = '\0';
616             }
617          }
618          else
619          {
620              free( psz_string );
621              return;
622          }
623     }
624
625     if( p_aout == NULL )
626     {
627         config_PutPsz( p_intf, "audio-filter", psz_string );
628     }
629     else
630     {
631         var_SetString( p_aout, "audio-filter", psz_string );
632         int i = 0;
633         while( i < p_aout->i_nb_inputs )
634         {
635             p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
636             i = (i + 1);
637         }
638         vlc_object_release( p_aout );
639     }
640     free( psz_string );
641 }
642 @end