1 /*****************************************************************************
2 * extended.m: MacOS X Extended interface panel
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Felix Kühne <fkuehne@users.sf.net>
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.
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.
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 *****************************************************************************/
25 /*****************************************************************************
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 *****************************************************************************/
35 /*****************************************************************************
37 *****************************************************************************/
43 #import <aout_internal.h>
47 /*****************************************************************************
48 * VLCExtended implementation
49 *****************************************************************************/
51 @implementation VLCExtended
53 static VLCExtended *_o_sharedInstance = nil;
55 + (VLCExtended *)sharedInstance
57 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
62 if (_o_sharedInstance) {
65 _o_sharedInstance = [super init];
68 return _o_sharedInstance;
71 /*****************************************************************************
73 *****************************************************************************/
77 /* localise GUI-strings */
78 /* method is called from intf.m (in method showExtended) */
79 [o_extended_window setTitle: _NS("Extended controls")];
80 [o_lbl_video setStringValue: _NS("Video")];
81 [o_lbl_audio setStringValue: _NS("Audio")];
82 [o_lbl_audioFlts setStringValue: _NS("Audio filters")];
83 [o_lbl_videoFlts setStringValue: _NS("Video filters")];
84 [o_lbl_adjustImage setStringValue: _NS("Adjust Image")];
85 [o_btn_vidFlts_mrInfo setTitle: _NS("More Info")];
86 [o_ckb_blur setTitle: _NS("Blurring")];
87 [o_ckb_blur setToolTip: _NS("Creates a motion blurring on the image")];
88 [o_ckb_distortion setTitle: _NS("Distortion")];
89 [o_ckb_distortion setToolTip: _NS("Adds distorsion effects")];
90 [o_ckb_imgClone setTitle: _NS("Image clone")];
91 [o_ckb_imgClone setToolTip: _NS("Creates several clones of the image")];
92 [o_ckb_imgCrop setTitle: _NS("Image cropping")];
93 [o_ckb_imgCrop setToolTip: _NS("Crops the image")];
94 [o_ckb_imgInvers setTitle: _NS("Image inversion")];
95 [o_ckb_imgInvers setToolTip: _NS("Inverts the image colors")];
96 [o_ckb_trnsform setTitle: _NS("Transformation")];
97 [o_ckb_trnsform setToolTip: _NS("Rotates or flips the image")];
98 [o_ckb_vlme_norm setTitle: _NS("Volume normalization")];
99 [o_ckb_vlme_norm setToolTip: _NS("This filters prevents the audio output " \
100 "power from going over a defined value.")];
101 [o_ckb_hdphnVirt setTitle: _NS("Headphone virtualization")];
102 [o_ckb_hdphnVirt setToolTip: _NS("This filter gives the feeling of a " \
103 "5.1 speaker set when using a headphone.")];
104 [o_lbl_maxLevel setStringValue: _NS("Maximum level")];
105 [o_btn_rstrDefaults setTitle: _NS("Restore Defaults")];
106 [o_ckb_enblAdjustImg setTitle: _NS("Enable")];
107 [o_lbl_brightness setStringValue: _NS("Brightness")];
108 [o_lbl_contrast setStringValue: _NS("Contrast")];
109 [o_lbl_gamma setStringValue: _NS("Gamma")];
110 [o_lbl_hue setStringValue: _NS("Hue")];
111 [o_lbl_saturation setStringValue: _NS("Saturation")];
112 [o_lbl_opaque setStringValue: _NS("Opaqueness")];
118 /* set the adjust-filter-sliders to the values from the prefs and enable
121 intf_thread_t * p_intf = VLCIntf;
122 psz_vfilters = config_GetPsz( p_intf, "vout-filter" );
123 if( psz_vfilters && strstr( psz_vfilters, "adjust" ) )
125 [o_ckb_enblAdjustImg setState: NSOnState];
126 [o_btn_rstrDefaults setEnabled: YES];
127 [o_sld_brightness setEnabled: YES];
128 [o_sld_contrast setEnabled: YES];
129 [o_sld_gamma setEnabled: YES];
130 [o_sld_hue setEnabled: YES];
131 [o_sld_saturation setEnabled: YES];
135 [o_ckb_enblAdjustImg setState: NSOffState];
136 [o_btn_rstrDefaults setEnabled: NO];
137 [o_sld_brightness setEnabled: NO];
138 [o_sld_contrast setEnabled: NO];
139 [o_sld_gamma setEnabled: NO];
140 [o_sld_hue setEnabled: NO];
141 [o_sld_saturation setEnabled: NO];
144 /* set the other video-filter-checkboxes to the correct values */
147 [o_ckb_blur setState: (int)strstr( psz_vfilters, "motionblur")];
148 [o_ckb_distortion setState: (int)strstr( psz_vfilters, "distort")];
149 [o_ckb_imgClone setState: (int)strstr( psz_vfilters, "clone")];
150 [o_ckb_imgCrop setState: (int)strstr( psz_vfilters, "crop")];
151 [o_ckb_imgInvers setState: (int)strstr( psz_vfilters, "invert")];
152 [o_ckb_trnsform setState: (int)strstr( psz_vfilters, "transform")];
154 free( psz_vfilters );
157 /* set the audio-filter-checkboxes to the values taken from the prefs */
159 psz_afilters = config_GetPsz( p_intf, "audio-filter" );
162 [o_ckb_hdphnVirt setState: (int)strstr( psz_afilters, "headphone" ) ];
163 [o_ckb_vlme_norm setState: (int)strstr( psz_afilters, "normvol" ) ];
165 free( psz_afilters );
171 /* get the correct slider values from the prefs, in case they were changed
173 intf_thread_t * p_intf = VLCIntf;
175 int i_value = config_GetInt( p_intf, "hue" );
176 if( i_value > 0 && i_value < 360 )
178 [o_sld_hue setIntValue: i_value];
183 f_value = config_GetFloat( p_intf, "saturation" );
184 if( f_value > 0 && f_value < 5 )
186 [o_sld_saturation setIntValue: (int)(100 * f_value) ];
189 f_value = config_GetFloat( p_intf, "contrast" );
190 if( f_value > 0 && f_value < 4 )
192 [o_sld_contrast setIntValue: (int)(100 * f_value) ];
195 f_value = config_GetFloat( p_intf, "brightness" );
196 if( f_value > 0 && f_value < 2 )
198 [o_sld_brightness setIntValue: (int)(100 * f_value) ];
201 f_value = config_GetFloat( p_intf, "gamma" );
202 if( f_value > 0 && f_value < 10 )
204 [o_sld_gamma setIntValue: (int)(10 * f_value) ];
207 [o_sld_maxLevel setFloatValue: (config_GetFloat(p_intf, "norm-max-level") \
210 [o_sld_opaque setFloatValue: (config_GetFloat( p_intf, \
211 "macosx-opaqueness") * 100)];
214 /* show the window */
215 [o_extended_window displayIfNeeded];
216 [o_extended_window makeKeyAndOrderFront:nil];
219 - (IBAction)adjImg_Enbl:(id)sender
221 /* en-/disable the sliders */
222 if ([o_ckb_enblAdjustImg state] == NSOnState)
224 [o_btn_rstrDefaults setEnabled: YES];
225 [o_sld_brightness setEnabled: YES];
226 [o_sld_contrast setEnabled: YES];
227 [o_sld_gamma setEnabled: YES];
228 [o_sld_hue setEnabled: YES];
229 [o_sld_saturation setEnabled: YES];
230 [self changeVFiltersString: "adjust" onOrOff: VLC_TRUE];
232 [o_btn_rstrDefaults setEnabled: NO];
233 [o_sld_brightness setEnabled: NO];
234 [o_sld_contrast setEnabled: NO];
235 [o_sld_gamma setEnabled: NO];
236 [o_sld_hue setEnabled: NO];
237 [o_sld_saturation setEnabled: NO];
238 [self changeVFiltersString: "adjust" onOrOff: VLC_FALSE];
242 - (IBAction)adjImg_rstrDefaults:(id)sender
244 /* reset the sliders */
245 [o_sld_brightness setIntValue: 100];
246 [o_sld_contrast setIntValue: 100];
247 [o_sld_gamma setIntValue: 10];
248 [o_sld_hue setIntValue: 0];
249 [o_sld_saturation setIntValue: 100];
251 /* transmit the values */
252 [self adjImg_sliders: o_sld_brightness];
253 [self adjImg_sliders: o_sld_contrast];
254 [self adjImg_sliders: o_sld_gamma];
255 [self adjImg_sliders: o_sld_hue];
256 [self adjImg_sliders: o_sld_saturation];
259 - (IBAction)adjImg_sliders:(id)sender
261 /* read-out the sliders' values and apply them */
262 intf_thread_t * p_intf = VLCIntf;
263 vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find(p_intf,
264 VLC_OBJECT_VOUT, FIND_ANYWHERE);
267 if (sender == o_sld_brightness)
269 config_PutFloat( p_intf , "brightness" , [o_sld_brightness floatValue] / 100);
270 } else if (sender == o_sld_contrast)
272 config_PutFloat( p_intf , "contrast" , [o_sld_contrast floatValue] / 100);
273 } else if (sender == o_sld_gamma)
275 config_PutFloat( p_intf , "gamma" , [o_sld_gamma floatValue] / 10);
276 } else if (sender == o_sld_hue)
278 config_PutInt( p_intf , "hue" , [o_sld_hue intValue]);
279 } else if (sender == o_sld_saturation)
281 config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100);
283 msg_Warn( p_intf, "cannot find adjust-image-subfilter related to " \
288 if (sender == o_sld_brightness)
290 val.f_float = [o_sld_brightness floatValue] / 100;
291 var_Set( p_vout, "brightness", val );
292 config_PutFloat( p_intf , "brightness" , [o_sld_brightness floatValue] / 100);
293 } else if (sender == o_sld_contrast)
295 val.f_float = [o_sld_contrast floatValue] / 100;
296 var_Set( p_vout, "contrast", val );
297 config_PutFloat( p_intf , "contrast" , [o_sld_contrast floatValue] / 100);
298 } else if (sender == o_sld_gamma)
300 val.f_float = [o_sld_gamma floatValue] / 10;
301 var_Set( p_vout, "gamma", val );
302 config_PutFloat( p_intf , "gamma" , [o_sld_gamma floatValue] / 10);
303 } else if (sender == o_sld_hue)
305 val.i_int = [o_sld_hue intValue];
306 var_Set( p_vout, "hue", val );
307 config_PutInt( p_intf , "hue" , [o_sld_hue intValue]);
308 } else if (sender == o_sld_saturation)
310 val.f_float = [o_sld_saturation floatValue] / 100;
311 var_Set( p_vout, "saturation", val );
312 config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100);
314 msg_Warn( p_intf, "cannot find adjust-image-subfilter related to " \
317 vlc_object_release( p_vout );
321 /* change the opaqueness of the vouts */
322 - (IBAction)adjImg_opaque:(id)sender
325 id o_window = [NSApp keyWindow];
326 NSArray *o_windows = [NSApp orderedWindows];
327 NSEnumerator *o_enumerator = [o_windows objectEnumerator];
328 playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, \
330 vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
331 vout_thread_t *p_real_vout;
333 val.f_float = [o_sld_opaque floatValue] / 100;
337 if( p_vout->i_object_type == VLC_OBJECT_OPENGL )
339 p_real_vout = (vout_thread_t *) p_vout->p_parent;
343 p_real_vout = p_vout;
345 var_Set( p_real_vout, "macosx-opaqueness", val );
347 while ((o_window = [o_enumerator nextObject]))
349 if( [[o_window className] isEqualToString: @"VLCWindow"] )
351 [o_window setAlphaValue: val.f_float];
354 vlc_object_release( p_vout );
358 config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
360 vlc_object_release( p_playlist );
363 - (IBAction)audFtls_hdphnVirt:(id)sender
365 /* en-/disable headphone virtualisation */
366 if ([o_ckb_hdphnVirt state] == NSOnState)
368 [self changeAFiltersString: "headphone" onOrOff: VLC_TRUE ];
370 [self changeAFiltersString: "headphone" onOrOff: VLC_FALSE ];
374 - (IBAction)audFtls_maxLevelSld:(id)sender
376 /* read-out the slider's value and apply it */
377 intf_thread_t * p_intf = VLCIntf;
378 aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
379 VLC_OBJECT_AOUT, FIND_ANYWHERE);
382 var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] / 10 );
383 vlc_object_release( p_aout );
387 config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] /10 );
391 - (IBAction)audFtls_vlmeNorm:(id)sender
393 /* en-/disable volume normalisation */
394 if ([o_ckb_vlme_norm state] == NSOnState)
396 [self changeAFiltersString: "normvol" onOrOff: YES ];
398 [self changeAFiltersString: "normvol" onOrOff: NO ];
402 - (IBAction)extWin_exp_adjImg:(id)sender
404 /* expand or collapse adjImg */
405 NSRect o_win_rect = [o_extended_window frame];
406 NSRect o_box_audFlts_rect = [o_box_audFlts frame];
407 NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
408 NSRect o_box_adjImg_rect = [o_box_adjImg frame];
410 if (o_adjImg_expanded)
412 /* move the window contents upwards (partially done through settings
413 * inside the nib) and resize the window */
414 o_win_rect.size.height = o_win_rect.size.height - 171;
415 o_win_rect.origin.y = [o_extended_window frame].origin.y + 171;
416 o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 171;
417 o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 171;
419 /* remove the inserted view */
420 [o_adjustImg_view removeFromSuperviewWithoutNeedingDisplay];
423 /* move the window contents downwards and resize the window */
424 o_win_rect.size.height = o_win_rect.size.height + 171;
425 o_win_rect.origin.y = [o_extended_window frame].origin.y - 171;
426 o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 171;
427 o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 171;
430 [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
431 [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
432 [o_extended_window displayIfNeeded];
433 [o_extended_window setFrame: o_win_rect display:YES animate: YES];
435 if (o_adjImg_expanded)
437 o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 171;
438 msg_Dbg( VLCIntf, "collapsed adjust-image section");
439 o_adjImg_expanded = NO;
442 o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 171;
443 [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 181)];
444 [o_adjustImg_view setNeedsDisplay:YES];
445 [o_adjustImg_view setAutoresizesSubviews: YES];
446 [[o_box_adjImg contentView] addSubview: o_adjustImg_view];
447 msg_Dbg( VLCIntf, "expanded adjust-image section");
448 o_adjImg_expanded = YES;
450 [o_box_adjImg setFrameFromContentFrame: o_box_adjImg_rect];
453 - (IBAction)extWin_exp_audFlts:(id)sender
455 /* expand or collapse audFlts */
456 NSRect o_win_rect = [o_extended_window frame];
457 NSRect o_box_audFlts_rect = [o_box_audFlts frame];
459 if (o_audFlts_expanded)
461 /* move the window contents upwards (partially done through settings
462 * inside the nib) and resize the window */
463 o_win_rect.size.height = o_win_rect.size.height - 66;
464 o_win_rect.origin.y = [o_extended_window frame].origin.y + 66;
466 /* remove the inserted view */
467 [o_audioFlts_view removeFromSuperviewWithoutNeedingDisplay];
469 /* move the window contents downwards and resize the window */
470 o_win_rect.size.height = o_win_rect.size.height + 66;
471 o_win_rect.origin.y = [o_extended_window frame].origin.y - 66;
473 [o_extended_window displayIfNeeded];
474 [o_extended_window setFrame: o_win_rect display:YES animate: YES];
477 if (o_audFlts_expanded)
479 o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height - 66;
480 msg_Dbg( VLCIntf, "collapsed audio-filters section");
481 o_audFlts_expanded = NO;
484 o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height + 66;
485 [o_audioFlts_view setFrame: NSMakeRect( 20, -20, 370, 76)];
486 [o_audioFlts_view setNeedsDisplay:YES];
487 [o_audioFlts_view setAutoresizesSubviews: YES];
488 [[o_box_audFlts contentView] addSubview: o_audioFlts_view];
489 msg_Dbg( VLCIntf, "expanded audio-filters section");
490 o_audFlts_expanded = YES;
492 [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
495 - (IBAction)extWin_exp_vidFlts:(id)sender
497 /* expand or collapse vidFlts */
498 NSRect o_win_rect = [o_extended_window frame];
499 NSRect o_box_audFlts_rect = [o_box_audFlts frame];
500 NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
502 if (o_vidFlts_expanded)
504 /* move the window contents upwards (partially done through settings
505 * inside the nib) and resize the window */
506 o_win_rect.size.height = o_win_rect.size.height - 134;
507 o_win_rect.origin.y = [o_extended_window frame].origin.y + 134;
508 o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 134;
510 /* remove the inserted view */
511 [o_videoFilters_view removeFromSuperviewWithoutNeedingDisplay];
514 /* move the window contents downwards and resize the window */
515 o_win_rect.size.height = o_win_rect.size.height + 134;
516 o_win_rect.origin.y = [o_extended_window frame].origin.y - 134;
517 o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 134;
520 [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
521 [o_extended_window displayIfNeeded];
522 [o_extended_window setFrame: o_win_rect display:YES animate: YES];
524 if (o_vidFlts_expanded)
526 o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 134;
527 msg_Dbg( VLCIntf, "collapsed video-filters section");
528 o_vidFlts_expanded = NO;
531 o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 134;
532 [o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 144)];
533 [o_videoFilters_view setNeedsDisplay:YES];
534 [o_videoFilters_view setAutoresizesSubviews: YES];
535 [[o_box_vidFlts contentView] addSubview: o_videoFilters_view];
536 msg_Dbg( VLCIntf, "expanded video-filters section");
537 o_vidFlts_expanded = YES;
539 [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
542 - (IBAction)vidFlts:(id)sender
544 /* en-/disable video filters */
545 if (sender == o_ckb_blur)
547 [self changeVFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];
549 else if (sender == o_ckb_distortion)
551 [self changeVFiltersString: "distort" onOrOff: [o_ckb_distortion state]];
553 else if (sender == o_ckb_imgClone)
555 [self changeVFiltersString: "clone" onOrOff: [o_ckb_imgClone state]];
557 else if (sender == o_ckb_imgCrop)
559 [self changeVFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]];
561 else if (sender == o_ckb_imgInvers)
563 [self changeVFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]];
565 else if (sender == o_ckb_trnsform)
567 [self changeVFiltersString: "transform" onOrOff: [o_ckb_trnsform state]];
569 /* this shouldn't happen */
570 msg_Warn (VLCIntf, "cannot find selected video-filter");
574 - (IBAction)vidFlts_mrInfo:(id)sender
576 /* show info sheet */
577 NSBeginInformationalAlertSheet(_NS("More information"), _NS("OK"), @"", @"", \
578 o_extended_window, nil, nil, nil, nil, _NS("Select the video effects " \
579 "filters to apply. You must restart the stream for these settings to " \
580 "take effect.\nTo configure the filters, go to the Preferences, and " \
581 "go to Modules/Video Filters. You can then configure each filter.\n" \
582 "If you want fine control over the filters ( to choose the order in " \
583 "which they are applied ), you need to enter manually a filters " \
584 "string (Preferences / Video / Filters)."));
588 /*****************************************************************************
589 * methods to communicate changes to VLC's core
590 *****************************************************************************/
592 - (void)changeVFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add
594 /* copied from ../wxwidgets/extrapanel.cpp
595 * renamed to conform with Cocoa's rules */
597 vout_thread_t *p_vout;
598 intf_thread_t * p_intf = VLCIntf;
600 char *psz_parser, *psz_string;
601 psz_string = config_GetPsz( p_intf, "vout-filter" );
603 if( !psz_string ) psz_string = strdup("");
605 psz_parser = strstr( psz_string, psz_name );
611 psz_parser = psz_string;
612 asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
613 psz_string, psz_name );
625 memmove( psz_parser, psz_parser + strlen(psz_name) +
626 (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
627 strlen(psz_parser + strlen(psz_name)) + 1 );
629 /* Remove trailing : : */
630 if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
632 *(psz_string+strlen(psz_string ) -1 ) = '\0';
641 /* Vout is not kept, so put that in the config */
642 config_PutPsz( p_intf, "vout-filter", psz_string );
644 /* Try to set on the fly */
645 p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
649 var_SetString( p_vout, "vout-filter", psz_string );
650 vlc_object_release( p_vout );
659 - (void)changeAFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
661 char *psz_parser, *psz_string;
662 intf_thread_t * p_intf = VLCIntf;
663 aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
664 VLC_OBJECT_AOUT, FIND_ANYWHERE);
668 psz_string = var_GetString( p_aout, "audio-filter" );
672 psz_string = config_GetPsz( p_intf, "audio-filter" );
675 if( !psz_string ) psz_string = strdup("");
677 psz_parser = strstr( psz_string, psz_name );
683 psz_parser = psz_string;
684 asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
685 psz_string, psz_name );
697 memmove( psz_parser, psz_parser + strlen(psz_name) +
698 (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
699 strlen(psz_parser + strlen(psz_name)) + 1 );
701 if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
703 *(psz_string+strlen(psz_string ) -1 ) = '\0';
715 config_PutPsz( p_intf, "audio-filter", psz_string );
719 var_SetString( p_aout, "audio-filter", psz_string );
721 while( i < p_aout->i_nb_inputs )
723 p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
726 vlc_object_release( p_aout );
735 /* save the preferences to make sure that our module-changes will up on
736 * next launch again */
737 playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, \
741 returnedValue = config_SaveConfigFile( p_playlist, NULL);
742 if (returnedValue == 0)
744 msg_Dbg(p_playlist, "VLCExtended: saved preferences successfully");
746 msg_Dbg(p_playlist, "VLCExtended: error while saving the preferences " \
747 "(%i)" , returnedValue);
749 vlc_object_release( p_playlist );
753 /*****************************************************************************
755 *****************************************************************************/
757 - (BOOL)applicationShouldTerminate:(NSWindow *)sender
759 /* save the prefs before shutting down */