]> git.sesse.net Git - vlc/blob - modules/gui/macosx/VideoEffects.m
macosx/open: added missing sanity checks
[vlc] / modules / gui / macosx / VideoEffects.m
1 /*****************************************************************************
2  * VideoEffects.m: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2011-2012 Felix Paul Kühne
5  * $Id$
6  *
7  * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #import "CompatibilityFixes.h"
25 #import "intf.h"
26 #import <vlc_common.h>
27 #import <vlc_modules.h>
28 #import <vlc_charset.h>
29 #import "VideoEffects.h"
30
31 #pragma mark -
32 #pragma mark Initialization & Generic code
33
34 @implementation VLCVideoEffects
35 static VLCVideoEffects *_o_sharedInstance = nil;
36
37 + (VLCVideoEffects *)sharedInstance
38 {
39     return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
40 }
41
42 - (id)init
43 {
44     if (_o_sharedInstance) {
45         [self dealloc];
46     } else {
47         p_intf = VLCIntf;
48         _o_sharedInstance = [super init];
49     }
50
51     return _o_sharedInstance;
52 }
53
54 - (IBAction)toggleWindow:(id)sender
55 {
56     if( [o_window isVisible] )
57         [o_window orderOut:sender];
58     else
59         [o_window makeKeyAndOrderFront:sender];
60 }
61
62 - (void)awakeFromNib
63 {
64     [o_window setTitle: _NS("Video Effects")];
65     [o_window setExcludedFromWindowsMenu:YES];
66     if (OSX_LION)
67         [o_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
68
69     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"basic"]] setLabel:_NS("Basic")];
70     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"crop"]] setLabel:_NS("Crop")];
71     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"geometry"]] setLabel:_NS("Geometry")];
72     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"color"]] setLabel:_NS("Color")];
73     [[o_tableView tabViewItemAtIndex:[o_tableView indexOfTabViewItemWithIdentifier:@"misc"]] setLabel:_NS("Miscellaneous")];
74
75     [o_adjust_ckb setTitle:_NS("Image Adjust")];
76     [o_adjust_hue_lbl setStringValue:_NS("Hue")];
77     [o_adjust_contrast_lbl setStringValue:_NS("Contrast")];
78     [o_adjust_brightness_lbl setStringValue:_NS("Brightness")];
79     [o_adjust_brightness_ckb setTitle:_NS("Brightness Threshold")];
80     [o_adjust_saturation_lbl setStringValue:_NS("Saturation")];
81     [o_adjust_gamma_lbl setStringValue:_NS("Gamma")];
82     [o_adjust_reset_btn setTitle: _NS("Reset")];
83     [o_sharpen_ckb setTitle:_NS("Sharpen")];
84     [o_sharpen_lbl setStringValue:_NS("Sigma")];
85     [o_banding_ckb setTitle:_NS("Banding removal")];
86     [o_banding_lbl setStringValue:_NS("Radius")];
87     [o_grain_ckb setTitle:_NS("Film Grain")];
88     [o_grain_lbl setStringValue:_NS("Variance")];
89     [o_crop_top_lbl setStringValue:_NS("Top")];
90     [o_crop_left_lbl setStringValue:_NS("Left")];
91     [o_crop_right_lbl setStringValue:_NS("Right")];
92     [o_crop_bottom_lbl setStringValue:_NS("Bottom")];
93     [o_crop_sync_top_bottom_ckb setTitle:_NS("Synchronize top and bottom")];
94     [o_crop_sync_left_right_ckb setTitle:_NS("Synchronize left and right")];
95
96     [o_transform_ckb setTitle:_NS("Transform")];
97     [o_transform_pop removeAllItems];
98     [o_transform_pop addItemWithTitle: _NS("Rotate by 90 degrees")];
99     [[o_transform_pop lastItem] setTag: 90];
100     [o_transform_pop addItemWithTitle: _NS("Rotate by 180 degrees")];
101     [[o_transform_pop lastItem] setTag: 180];
102     [o_transform_pop addItemWithTitle: _NS("Rotate by 270 degrees")];
103     [[o_transform_pop lastItem] setTag: 270];
104     [o_transform_pop addItemWithTitle: _NS("Flip horizontally")];
105     [[o_transform_pop lastItem] setTag: 1];
106     [o_transform_pop addItemWithTitle: _NS("Flip vertically")];
107     [[o_transform_pop lastItem] setTag: 2];
108     [o_zoom_ckb setTitle:_NS("Magnification/Zoom")];
109     [o_puzzle_ckb setTitle:_NS("Puzzle game")];
110     [o_puzzle_rows_lbl setStringValue:_NS("Rows")];
111     [o_puzzle_columns_lbl setStringValue:_NS("Columns")];
112     [o_puzzle_blackslot_ckb setTitle:_NS("Black Slot")];
113
114     [o_threshold_ckb setTitle:_NS("Color threshold")];
115     [o_threshold_color_lbl setStringValue:_NS("Color")];
116     [o_threshold_saturation_lbl setStringValue:_NS("Saturation")];
117     [o_threshold_similarity_lbl setStringValue:_NS("Similarity")];
118     [o_sepia_ckb setTitle:_NS("Sepia")];
119     [o_sepia_lbl setStringValue:_NS("Intensity")];
120     [o_noise_ckb setTitle:_NS("Noise")];
121     [o_gradient_ckb setTitle:_NS("Gradient")];
122     [o_gradient_mode_lbl setStringValue:_NS("Mode")];
123     [o_gradient_mode_pop removeAllItems];
124     [o_gradient_mode_pop addItemWithTitle: _NS("Gradient")];
125     [[o_gradient_mode_pop lastItem] setTag: 1];
126     [o_gradient_mode_pop addItemWithTitle: _NS("Edge")];
127     [[o_gradient_mode_pop lastItem] setTag: 2];
128     [o_gradient_mode_pop addItemWithTitle: _NS("Hough")];
129     [[o_gradient_mode_pop lastItem] setTag: 3];
130     [o_gradient_color_ckb setTitle:_NS("Color")];
131     [o_gradient_cartoon_ckb setTitle:_NS("Cartoon")];
132     [o_extract_ckb setTitle:_NS("Color extraction")];
133     [o_extract_lbl setStringValue:_NS("Color")];
134     [o_invert_ckb setTitle:_NS("Invert colors")];
135     [o_posterize_ckb setTitle:_NS("Posterize")];
136     [o_posterize_lbl setStringValue:_NS("Posterize level")];
137     [o_blur_ckb setTitle:_NS("Motion blur")];
138     [o_blur_lbl setStringValue:_NS("Factor")];
139     [o_motiondetect_ckb setTitle:_NS("Motion Detect")];
140     [o_watereffect_ckb setTitle:_NS("Water effect")];
141     [o_waves_ckb setTitle:_NS("Waves")];
142     [o_psychedelic_ckb setTitle:_NS("Psychedelic")];
143
144     [o_addtext_ckb setTitle:_NS("Add text")];
145     [o_addtext_text_lbl setStringValue:_NS("Text")];
146     [o_addtext_pos_lbl setStringValue:_NS("Position")];
147     [o_addtext_pos_pop removeAllItems];
148     [o_addtext_pos_pop addItemWithTitle: _NS("Center")];
149     [[o_addtext_pos_pop lastItem] setTag: 0];
150     [o_addtext_pos_pop addItemWithTitle: _NS("Left")];
151     [[o_addtext_pos_pop lastItem] setTag: 1];
152     [o_addtext_pos_pop addItemWithTitle: _NS("Right")];
153     [[o_addtext_pos_pop lastItem] setTag: 2];
154     [o_addtext_pos_pop addItemWithTitle: _NS("Top")];
155     [[o_addtext_pos_pop lastItem] setTag: 4];
156     [o_addtext_pos_pop addItemWithTitle: _NS("Bottom")];
157     [[o_addtext_pos_pop lastItem] setTag: 8];
158     [o_addtext_pos_pop addItemWithTitle: _NS("Top-Left")];
159     [[o_addtext_pos_pop lastItem] setTag: 5];
160     [o_addtext_pos_pop addItemWithTitle: _NS("Top-Right")];
161     [[o_addtext_pos_pop lastItem] setTag: 6];
162     [o_addtext_pos_pop addItemWithTitle: _NS("Bottom-Left")];
163     [[o_addtext_pos_pop lastItem] setTag: 9];
164     [o_addtext_pos_pop addItemWithTitle: _NS("Bottom-Right")];
165     [[o_addtext_pos_pop lastItem] setTag: 10];
166     [o_addlogo_ckb setTitle:_NS("Add logo")];
167     [o_addlogo_logo_lbl setStringValue:_NS("Logo")];
168     [o_addlogo_pos_lbl setStringValue:_NS("Position")];
169     [o_addlogo_pos_pop removeAllItems];
170     [o_addlogo_pos_pop addItemWithTitle: _NS("Center")];
171     [[o_addlogo_pos_pop lastItem] setTag: 0];
172     [o_addlogo_pos_pop addItemWithTitle: _NS("Left")];
173     [[o_addlogo_pos_pop lastItem] setTag: 1];
174     [o_addlogo_pos_pop addItemWithTitle: _NS("Right")];
175     [[o_addlogo_pos_pop lastItem] setTag: 2];
176     [o_addlogo_pos_pop addItemWithTitle: _NS("Top")];
177     [[o_addlogo_pos_pop lastItem] setTag: 4];
178     [o_addlogo_pos_pop addItemWithTitle: _NS("Bottom")];
179     [[o_addlogo_pos_pop lastItem] setTag: 8];
180     [o_addlogo_pos_pop addItemWithTitle: _NS("Top-Left")];
181     [[o_addlogo_pos_pop lastItem] setTag: 5];
182     [o_addlogo_pos_pop addItemWithTitle: _NS("Top-Right")];
183     [[o_addlogo_pos_pop lastItem] setTag: 6];
184     [o_addlogo_pos_pop addItemWithTitle: _NS("Bottom-Left")];
185     [[o_addlogo_pos_pop lastItem] setTag: 9];
186     [o_addlogo_pos_pop addItemWithTitle: _NS("Bottom-Right")];
187     [[o_addlogo_pos_pop lastItem] setTag: 10];
188     [o_addlogo_transparency_lbl setStringValue:_NS("Transparency")];
189
190     [o_tableView selectFirstTabViewItem:self];
191
192     [self resetValues];
193 }
194
195 - (void)resetValues
196 {
197     NSString *tmpString;
198     char *tmpChar;
199     BOOL b_state;
200
201     /* do we have any filter enabled? if yes, show it. */
202     char * psz_vfilters;
203     psz_vfilters = config_GetPsz( p_intf, "video-filter" );
204     if( psz_vfilters ) {
205         [o_adjust_ckb setState: (NSInteger)strstr( psz_vfilters, "adjust")];
206         [o_sharpen_ckb setState: (NSInteger)strstr( psz_vfilters, "sharpen")];
207         [o_banding_ckb setState: (NSInteger)strstr( psz_vfilters, "gradfun")];
208         [o_grain_ckb setState: (NSInteger)strstr( psz_vfilters, "grain")];
209         [o_transform_ckb setState: (NSInteger)strstr( psz_vfilters, "transform")];
210         [o_zoom_ckb setState: (NSInteger)strstr( psz_vfilters, "magnify")];
211         [o_puzzle_ckb setState: (NSInteger)strstr( psz_vfilters, "puzzle")];
212         [o_threshold_ckb setState: (NSInteger)strstr( psz_vfilters, "colorthres")];
213         [o_sepia_ckb setState: (NSInteger)strstr( psz_vfilters, "sepia")];
214         [o_noise_ckb setState: (NSInteger)strstr( psz_vfilters, "noise")];
215         [o_gradient_ckb setState: (NSInteger)strstr( psz_vfilters, "gradient")];
216         [o_extract_ckb setState: (NSInteger)strstr( psz_vfilters, "extract")];
217         [o_invert_ckb setState: (NSInteger)strstr( psz_vfilters, "invert")];
218         [o_posterize_ckb setState: (NSInteger)strstr( psz_vfilters, "posterize")];
219         [o_blur_ckb setState: (NSInteger)strstr( psz_vfilters, "motionblur")];
220         [o_motiondetect_ckb setState: (NSInteger)strstr( psz_vfilters, "motiondetect")];
221         [o_watereffect_ckb setState: (NSInteger)strstr( psz_vfilters, "ripple")];
222         [o_waves_ckb setState: (NSInteger)strstr( psz_vfilters, "wave")];
223         [o_psychedelic_ckb setState: (NSInteger)strstr( psz_vfilters, "psychedelic")];
224         free( psz_vfilters );
225     }
226     psz_vfilters = config_GetPsz( p_intf, "sub-source" );
227     if (psz_vfilters) {
228         [o_addtext_ckb setState: (NSInteger)strstr( psz_vfilters, "marq" )];
229         [o_addlogo_ckb setState: (NSInteger)strstr( psz_vfilters, "logo" )];
230         free( psz_vfilters );
231     }
232
233     /* fetch and show the various values */
234     [o_adjust_hue_sld setIntValue: config_GetInt( p_intf, "hue" )];
235     [o_adjust_contrast_sld setFloatValue: config_GetFloat( p_intf, "contrast" )];
236     [o_adjust_brightness_sld setFloatValue: config_GetFloat( p_intf, "brightness" )];
237     [o_adjust_saturation_sld setFloatValue: config_GetFloat( p_intf, "saturation" )];
238     [o_adjust_gamma_sld setFloatValue: config_GetFloat( p_intf, "gamma" )];
239     [o_adjust_brightness_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat( p_intf, "brightness" )]];
240     [o_adjust_contrast_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat( p_intf, "contrast" )]];
241     [o_adjust_gamma_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat( p_intf, "gamma" )]];
242     [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%lli", config_GetInt( p_intf, "hue" )]];
243     [o_adjust_saturation_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat( p_intf, "saturation" )]];
244     b_state = [o_adjust_ckb state];
245     [o_adjust_brightness_sld setEnabled: b_state];
246     [o_adjust_brightness_ckb setEnabled: b_state];
247     [o_adjust_contrast_sld setEnabled: b_state];
248     [o_adjust_gamma_sld setEnabled: b_state];
249     [o_adjust_hue_sld setEnabled: b_state];
250     [o_adjust_saturation_sld setEnabled: b_state];
251     [o_adjust_brightness_lbl setEnabled: b_state];
252     [o_adjust_contrast_lbl setEnabled: b_state];
253     [o_adjust_gamma_lbl setEnabled: b_state];
254     [o_adjust_hue_lbl setEnabled: b_state];
255     [o_adjust_saturation_lbl setEnabled: b_state];
256     [o_adjust_reset_btn setEnabled: b_state];
257     [o_sharpen_sld setFloatValue: config_GetFloat( p_intf, "sharpen-sigma" )];
258     [o_sharpen_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat( p_intf, "sharpen-sigma" )]];
259     [o_sharpen_sld setEnabled: [o_sharpen_ckb state]];
260     [o_sharpen_lbl setEnabled: [o_sharpen_ckb state]];
261     [o_banding_sld setIntValue: config_GetInt( p_intf, "gradfun-radius" )];
262     [o_banding_sld setToolTip: [NSString stringWithFormat:@"%lli", config_GetInt( p_intf, "gradfun-radius" )]];
263     [o_banding_sld setEnabled: [o_banding_ckb state]];
264     [o_banding_lbl setEnabled: [o_banding_ckb state]];
265     [o_grain_sld setFloatValue: config_GetFloat( p_intf, "grain-variance" )];
266     [o_grain_sld setToolTip: [NSString stringWithFormat:@"%0.3f", config_GetFloat( p_intf, "grain-variance" )]];
267     [o_grain_sld setEnabled: [o_grain_ckb state]];
268     [o_grain_lbl setEnabled: [o_grain_ckb state]];
269
270     [o_crop_top_fld setIntValue: 0];
271     [o_crop_left_fld setIntValue: 0];
272     [o_crop_right_fld setIntValue: 0];
273     [o_crop_bottom_fld setIntValue: 0];
274     [o_crop_sync_top_bottom_ckb setState: NSOffState];
275     [o_crop_sync_left_right_ckb setState: NSOffState];
276
277     tmpChar = config_GetPsz( p_intf, "transform-type" );
278     tmpString = [NSString stringWithUTF8String: tmpChar];
279     if( [tmpString isEqualToString:@"hflip"] )
280         [o_transform_pop selectItemWithTag: 1];
281     else if( [tmpString isEqualToString:@"vflip"] )
282         [o_transform_pop selectItemWithTag: 2];
283     else
284         [o_transform_pop selectItemWithTag:[tmpString intValue]];
285     FREENULL( tmpChar );
286     [o_transform_pop setEnabled: [o_transform_ckb state]];
287     [o_puzzle_rows_fld setIntValue: config_GetInt( p_intf, "puzzle-rows" )];
288     [o_puzzle_columns_fld setIntValue: config_GetInt( p_intf, "puzzle-cols" )];
289     [o_puzzle_blackslot_ckb setState: config_GetInt( p_intf, "puzzle-black-slot" )];
290     b_state = [o_puzzle_ckb state];
291     [o_puzzle_rows_fld setEnabled: b_state];
292     [o_puzzle_rows_lbl setEnabled: b_state];
293     [o_puzzle_columns_fld setEnabled: b_state];
294     [o_puzzle_columns_lbl setEnabled: b_state];
295     [o_puzzle_blackslot_ckb setEnabled: b_state];
296
297     [o_threshold_color_fld setStringValue: [[NSString stringWithFormat:@"%llx", config_GetInt( p_intf, "colorthres-color" )] uppercaseString]];
298     [o_threshold_saturation_sld setIntValue: config_GetInt( p_intf, "colorthres-saturationthres" )];
299     [o_threshold_saturation_sld setToolTip: [NSString stringWithFormat:@"%lli", config_GetInt( p_intf, "colorthres-saturationthres" )]];
300     [o_threshold_similarity_sld setIntValue: config_GetInt( p_intf, "colorthres-similaritythres" )];
301     [o_threshold_similarity_sld setToolTip: [NSString stringWithFormat:@"%lli", config_GetInt( p_intf, "colorthres-similaritythres" )]];
302     b_state = [o_threshold_ckb state];
303     [o_threshold_color_fld setEnabled: b_state];
304     [o_threshold_color_lbl setEnabled: b_state];
305     [o_threshold_saturation_sld setEnabled: b_state];
306     [o_threshold_saturation_lbl setEnabled: b_state];
307     [o_threshold_similarity_sld setEnabled: b_state];
308     [o_threshold_similarity_lbl setEnabled: b_state];
309     [o_sepia_fld setIntValue: config_GetInt( p_intf, "sepia-intensity" )];
310     [o_sepia_fld setEnabled: [o_sepia_ckb state]];
311     [o_sepia_lbl setEnabled: [o_sepia_ckb state]];
312     tmpChar = config_GetPsz( p_intf, "gradient-mode" );
313     tmpString = [NSString stringWithUTF8String: tmpChar];
314     if( [tmpString isEqualToString:@"hough"] )
315         [o_gradient_mode_pop selectItemWithTag: 3];
316     else if( [tmpString isEqualToString:@"edge"] )
317         [o_gradient_mode_pop selectItemWithTag: 2];
318     else
319         [o_gradient_mode_pop selectItemWithTag: 1];
320     FREENULL( tmpChar );
321     [o_gradient_cartoon_ckb setState: config_GetInt( p_intf, "gradient-cartoon" )];
322     [o_gradient_color_ckb setState: config_GetInt( p_intf, "gradient-type" )];
323     b_state = [o_gradient_ckb state];
324     [o_gradient_mode_pop setEnabled: b_state];
325     [o_gradient_mode_lbl setEnabled: b_state];
326     [o_gradient_cartoon_ckb setEnabled: b_state];
327     [o_gradient_color_ckb setEnabled: b_state];
328     [o_extract_fld setStringValue: [[NSString stringWithFormat:@"%llx", config_GetInt( p_intf, "extract-component" )] uppercaseString]];
329     [o_extract_fld setEnabled: [o_extract_ckb state]];
330     [o_extract_lbl setEnabled: [o_extract_ckb state]];
331     [o_posterize_fld setIntValue: config_GetInt( p_intf, "posterize-level" )];
332     [o_posterize_fld setEnabled: [o_posterize_ckb state]];
333     [o_posterize_lbl setEnabled: [o_posterize_ckb state]];
334     [o_blur_sld setIntValue: config_GetInt( p_intf, "blur-factor" )];
335     [o_blur_sld setToolTip: [NSString stringWithFormat:@"%lli", config_GetInt( p_intf, "blur-factor" )]];
336     [o_blur_sld setEnabled: [o_blur_ckb state]];
337     [o_blur_lbl setEnabled: [o_blur_ckb state]];
338
339     tmpChar = config_GetPsz( p_intf, "marq-marquee" );
340     if( tmpChar )
341     {
342         [o_addtext_text_fld setStringValue: [NSString stringWithUTF8String: tmpChar]];
343         FREENULL( tmpChar );
344     }
345     [o_addtext_pos_pop selectItemWithTag: config_GetInt( p_intf, "marq-position" )];
346     b_state = [o_addtext_ckb state];
347     [o_addtext_pos_pop setEnabled: b_state];
348     [o_addtext_pos_lbl setEnabled: b_state];
349     [o_addtext_text_lbl setEnabled: b_state];
350     [o_addtext_text_fld setEnabled: b_state];
351
352     tmpChar = config_GetPsz( p_intf, "logo-file" );
353     if( tmpChar )
354     {
355        [o_addlogo_logo_fld setStringValue: [NSString stringWithUTF8String: tmpChar]];
356         FREENULL( tmpChar );
357     }
358     [o_addlogo_pos_pop selectItemWithTag: config_GetInt( p_intf, "logo-position" )];
359     [o_addlogo_transparency_sld setIntValue: config_GetInt( p_intf, "logo-opacity" )];
360     [o_addlogo_transparency_sld setToolTip: [NSString stringWithFormat:@"%lli", config_GetInt( p_intf, "logo-opacity" )]];
361     b_state = [o_addlogo_ckb state];
362     [o_addlogo_pos_pop setEnabled: b_state];
363     [o_addlogo_pos_lbl setEnabled: b_state];
364     [o_addlogo_logo_fld setEnabled: b_state];
365     [o_addlogo_logo_lbl setEnabled: b_state];
366     [o_addlogo_transparency_sld setEnabled: b_state];
367     [o_addlogo_transparency_lbl setEnabled: b_state];
368 }
369
370 - (void)setVideoFilter: (char *)psz_name on:(BOOL)b_on
371 {
372     char *psz_string, *psz_parser;
373     const char *psz_filter_type;
374
375     module_t *p_obj = module_find( psz_name );
376     if( !p_obj )
377     {
378         msg_Err( p_intf, "Unable to find filter module \"%s\".", psz_name );
379         return;
380     }
381     msg_Dbg( p_intf, "will set filter '%s'", psz_name );
382
383     if( module_provides( p_obj, "video splitter" ) )
384     {
385         psz_filter_type = "video-splitter";
386     }
387     else if( module_provides( p_obj, "video filter2" ) )
388     {
389         psz_filter_type = "video-filter";
390     }
391     else if( module_provides( p_obj, "sub source" ) )
392     {
393         psz_filter_type = "sub-source";
394     }
395     else if( module_provides( p_obj, "sub filter" ) )
396     {
397         psz_filter_type = "sub-filter";
398     }
399     else
400     {
401         msg_Err( p_intf, "Unknown video filter type." );
402         return;
403     }
404
405     psz_string = config_GetPsz( p_intf, psz_filter_type );
406
407     if (b_on) {
408         if(! psz_string)
409             psz_string = psz_name;
410         else if( (NSInteger)strstr( psz_string, psz_name ) == NO )
411             psz_string = (char *)[[NSString stringWithFormat: @"%s:%s", psz_string, psz_name] UTF8String];
412     } else {
413         if( !psz_string )
414             return;
415
416         psz_parser = strstr( psz_string, psz_name );
417         if( psz_parser )
418         {
419             if( *( psz_parser + strlen( psz_name ) ) == ':' )
420             {
421                 memmove( psz_parser, psz_parser + strlen( psz_name ) + 1,
422                         strlen( psz_parser + strlen( psz_name ) + 1 ) + 1 );
423             }
424             else
425             {
426                 *psz_parser = '\0';
427             }
428
429             /* Remove trailing : : */
430             if( strlen( psz_string ) > 0 &&
431                *( psz_string + strlen( psz_string ) -1 ) == ':' )
432             {
433                 *( psz_string + strlen( psz_string ) -1 ) = '\0';
434             }
435         }
436         else
437         {
438             free( psz_string );
439             return;
440         }
441     }
442     config_PutPsz( p_intf, psz_filter_type, psz_string );
443
444     /* Try to set on the fly */
445     if( !strcmp( psz_filter_type, "video-splitter" ) )
446     {
447         playlist_t *p_playlist = pl_Get( p_intf );
448         var_SetString( p_playlist, psz_filter_type, psz_string );
449     }
450     else
451     {
452         vout_thread_t *p_vout = getVout();
453         if( p_vout )
454         {
455             var_SetString( p_vout, psz_filter_type, psz_string );
456             vlc_object_release( p_vout );
457         }
458     }
459 }
460
461 - (void)restartFilterIfNeeded: (char *)psz_filter option: (char *)psz_name
462 {
463     vout_thread_t *p_vout = getVout();
464
465     if (p_vout == NULL)
466         return;
467     else
468         vlc_object_release( p_vout );
469
470     vlc_object_t *p_filter = vlc_object_find_name( pl_Get(p_intf), psz_filter );
471     int i_type;
472     i_type = var_Type( p_filter, psz_name );
473     if( i_type == 0 )
474         i_type = config_GetType( p_intf, psz_name );
475
476     if( !(i_type & VLC_VAR_ISCOMMAND) )
477     {
478         msg_Warn( p_intf, "Brute-restarting filter '%s', because the last changed option isn't a command", psz_name );
479         [self setVideoFilter: psz_filter on: NO];
480         [self setVideoFilter: psz_filter on: YES];
481     }
482     else
483         msg_Dbg( p_intf, "restart not needed" );
484
485     if( p_filter )
486         vlc_object_release( p_filter );
487 }
488
489 - (void)setVideoFilterProperty: (char *)psz_name forFilter: (char *)psz_filter integer: (int)i_value
490 {
491     vout_thread_t *p_vout = getVout();
492     vlc_object_t *p_filter;
493
494     if( p_vout == NULL ) {
495         config_PutInt( p_intf , psz_name , i_value );
496     } else {
497         p_filter = vlc_object_find_name( pl_Get(p_intf), psz_filter );
498
499         if(! p_filter ) {
500             msg_Err( p_intf, "we're unable to find the filter '%s'", psz_filter );
501             vlc_object_release( p_vout );
502             return;
503         }
504         var_SetInteger( p_filter, psz_name, i_value );
505         config_PutInt( p_intf, psz_name, i_value );
506         vlc_object_release( p_vout );
507         vlc_object_release( p_filter );
508     }
509
510     [self restartFilterIfNeeded:psz_filter option: psz_name];
511 }
512
513 - (void)setVideoFilterProperty: (char *)psz_name forFilter: (char *)psz_filter float: (float)f_value
514 {
515     vout_thread_t *p_vout = getVout();
516     vlc_object_t *p_filter;
517
518     if( p_vout == NULL ) {
519         config_PutFloat( p_intf , psz_name , f_value );
520     } else {
521         p_filter = vlc_object_find_name( pl_Get(p_intf), psz_filter );
522
523         if(! p_filter ) {
524             msg_Err( p_intf, "we're unable to find the filter '%s'", psz_filter );
525             vlc_object_release( p_vout );
526             return;
527         }
528         var_SetFloat( p_filter, psz_name, f_value );
529         config_PutFloat( p_intf, psz_name, f_value );
530         vlc_object_release( p_vout );
531         vlc_object_release( p_filter );
532
533         [self restartFilterIfNeeded:psz_filter option: psz_name];
534     }
535 }
536
537 - (void)setVideoFilterProperty: (char *)psz_name forFilter: (char *)psz_filter string: (char *)psz_value
538 {
539     vout_thread_t *p_vout = getVout();
540     vlc_object_t *p_filter;
541
542     if( p_vout == NULL ) {
543         config_PutPsz( p_intf, psz_name, EnsureUTF8(psz_value) );
544     } else {
545         p_filter = vlc_object_find_name( pl_Get(p_intf), psz_filter );
546
547         if(! p_filter ) {
548             msg_Err( p_intf, "we're unable to find the filter '%s'", psz_filter );
549             vlc_object_release( p_vout );
550             return;
551         }
552         var_SetString( p_filter, psz_name, EnsureUTF8(psz_value) );
553         config_PutPsz( p_intf, psz_name, EnsureUTF8(psz_value) );
554         vlc_object_release( p_vout );
555         vlc_object_release( p_filter );
556
557         [self restartFilterIfNeeded:psz_filter option: psz_name];
558     }
559 }
560
561 - (void)setVideoFilterProperty: (char *)psz_name forFilter: (char *)psz_filter boolean: (BOOL)b_value
562 {
563     vout_thread_t *p_vout = getVout();
564     vlc_object_t *p_filter;
565
566     if( p_vout == NULL ) {
567         config_PutInt( p_intf, psz_name, b_value );
568     } else {
569         p_filter = vlc_object_find_name( pl_Get(p_intf), psz_filter );
570
571         if(! p_filter ) {
572             msg_Err( p_intf, "we're unable to find the filter '%s'", psz_filter );
573             vlc_object_release( p_vout );
574             return;
575         }
576         var_SetBool( p_filter, psz_name, b_value );
577         config_PutInt( p_intf, psz_name, b_value );
578         vlc_object_release( p_vout );
579     }
580 }
581
582 #pragma mark -
583 #pragma mark basic
584 - (IBAction)enableAdjust:(id)sender
585 {
586     BOOL b_state = [o_adjust_ckb state];
587
588     [self setVideoFilter: "adjust" on: b_state];
589     [o_adjust_brightness_sld setEnabled: b_state];
590     [o_adjust_brightness_ckb setEnabled: b_state];
591     [o_adjust_brightness_lbl setEnabled: b_state];
592     [o_adjust_contrast_sld setEnabled: b_state];
593     [o_adjust_contrast_lbl setEnabled: b_state];
594     [o_adjust_gamma_sld setEnabled: b_state];
595     [o_adjust_gamma_lbl setEnabled: b_state];
596     [o_adjust_hue_sld setEnabled: b_state];
597     [o_adjust_hue_lbl setEnabled: b_state];
598     [o_adjust_saturation_sld setEnabled: b_state];
599     [o_adjust_saturation_lbl setEnabled: b_state];
600     [o_adjust_reset_btn setEnabled: b_state];
601 }
602
603 - (IBAction)adjustSliderChanged:(id)sender
604 {
605     if( sender == o_adjust_brightness_sld )
606         [self setVideoFilterProperty: "brightness" forFilter: "adjust" float: [o_adjust_brightness_sld floatValue]];
607     else if( sender == o_adjust_contrast_sld )
608         [self setVideoFilterProperty: "contrast" forFilter: "adjust" float: [o_adjust_contrast_sld floatValue]];
609     else if( sender == o_adjust_gamma_sld )
610         [self setVideoFilterProperty: "gamma" forFilter: "adjust" float: [o_adjust_gamma_sld floatValue]];
611     else if( sender == o_adjust_hue_sld )
612         [self setVideoFilterProperty: "hue" forFilter: "adjust" integer: [o_adjust_hue_sld intValue]];
613     else if( sender == o_adjust_saturation_sld )
614         [self setVideoFilterProperty: "saturation" forFilter: "adjust" float: [o_adjust_saturation_sld floatValue]];
615
616     if( sender == o_adjust_hue_sld )
617         [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%i", [o_adjust_hue_sld intValue]]];
618     else
619         [sender setToolTip: [NSString stringWithFormat:@"%0.3f", [sender floatValue]]];
620 }
621
622 - (IBAction)enableAdjustBrightnessThreshold:(id)sender
623 {
624     if (sender == o_adjust_reset_btn)
625     {
626         [o_adjust_brightness_sld setFloatValue: 1.0];
627         [o_adjust_contrast_sld setFloatValue: 1.0];
628         [o_adjust_gamma_sld setFloatValue: 1.0];
629         [o_adjust_hue_sld setIntValue: 0];
630         [o_adjust_saturation_sld setFloatValue: 1.0];
631         [o_adjust_brightness_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
632         [o_adjust_contrast_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
633         [o_adjust_gamma_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
634         [o_adjust_hue_sld setToolTip: [NSString stringWithFormat:@"%i", 0]];
635         [o_adjust_saturation_sld setToolTip: [NSString stringWithFormat:@"%0.3f", 1.0]];
636         [self setVideoFilterProperty: "brightness" forFilter: "adjust" float: 1.0];
637         [self setVideoFilterProperty: "contrast" forFilter: "adjust" float: 1.0];
638         [self setVideoFilterProperty: "gamma" forFilter: "adjust" float: 1.0];
639         [self setVideoFilterProperty: "hue" forFilter: "adjust" integer: 0.0];
640         [self setVideoFilterProperty: "saturation" forFilter: "adjust" float: 1.0];
641     }
642     else
643         config_PutInt( p_intf, "brightness-threshold", [o_adjust_brightness_ckb state] );
644 }
645
646 - (IBAction)enableSharpen:(id)sender
647 {
648     BOOL b_state = [o_sharpen_ckb state];
649
650     [self setVideoFilter: "sharpen" on: b_state];
651     [o_sharpen_sld setEnabled: b_state];
652     [o_sharpen_lbl setEnabled: b_state];
653 }
654
655 - (IBAction)sharpenSliderChanged:(id)sender
656 {
657     [self setVideoFilterProperty: "sharpen-sigma" forFilter: "sharpen" float: [sender floatValue]];
658     [sender setToolTip: [NSString stringWithFormat:@"%0.3f", [sender floatValue]]];
659 }
660
661 - (IBAction)enableBanding:(id)sender
662 {
663     BOOL b_state = [o_banding_ckb state];
664
665     [self setVideoFilter: "gradfun" on: b_state];
666     [o_banding_sld setEnabled: b_state];
667     [o_banding_lbl setEnabled: b_state];
668 }
669
670 - (IBAction)bandingSliderChanged:(id)sender
671 {
672     [self setVideoFilterProperty: "gradfun-radius" forFilter: "gradfun" integer: [sender intValue]];
673     [sender setToolTip: [NSString stringWithFormat:@"%i", [sender intValue]]];
674 }
675
676 - (IBAction)enableGrain:(id)sender
677 {
678     BOOL b_state = [o_grain_ckb state];
679
680     [self setVideoFilter: "grain" on: b_state];
681     [o_grain_sld setEnabled: b_state];
682     [o_grain_lbl setEnabled: b_state];
683 }
684
685 - (IBAction)grainSliderChanged:(id)sender
686 {
687     [self setVideoFilterProperty: "grain-variance" forFilter: "grain" float: [sender floatValue]];
688     [sender setToolTip: [NSString stringWithFormat:@"%0.3f", [sender floatValue]]];
689 }
690
691
692 #pragma mark -
693 #pragma mark crop
694
695 #define updateopposite( giver, taker ) \
696     if (sender == giver) \
697         [taker setIntValue: [giver intValue]]
698
699 - (IBAction)cropObjectChanged:(id)sender
700 {
701     updateopposite( o_crop_top_fld, o_crop_top_stp );
702     updateopposite( o_crop_top_stp, o_crop_top_fld );
703     updateopposite( o_crop_left_fld, o_crop_left_stp );
704     updateopposite( o_crop_left_stp, o_crop_left_fld );
705     updateopposite( o_crop_right_fld, o_crop_right_stp );
706     updateopposite( o_crop_right_stp, o_crop_right_fld );
707     updateopposite( o_crop_bottom_fld, o_crop_bottom_stp );
708     updateopposite( o_crop_bottom_stp, o_crop_bottom_fld );
709
710     if( [o_crop_sync_top_bottom_ckb state] ) {
711         if (sender == o_crop_top_fld || sender == o_crop_top_stp ) {
712             [o_crop_bottom_fld setIntValue: [o_crop_top_fld intValue]];
713             [o_crop_bottom_stp setIntValue: [o_crop_top_fld intValue]];
714         }
715         else
716         {
717             [o_crop_top_fld setIntValue: [o_crop_bottom_fld intValue]];
718             [o_crop_top_stp setIntValue: [o_crop_bottom_fld intValue]];
719         }
720     }
721     if( [o_crop_sync_left_right_ckb state] ) {
722         if (sender == o_crop_left_fld || sender == o_crop_left_stp ) {
723             [o_crop_right_fld setIntValue: [o_crop_left_fld intValue]];
724             [o_crop_right_stp setIntValue: [o_crop_left_fld intValue]];
725         }
726         else
727         {
728             [o_crop_left_fld setIntValue: [o_crop_right_fld intValue]];
729             [o_crop_left_stp setIntValue: [o_crop_right_fld intValue]];
730         }
731     }
732
733     vout_thread_t *p_vout = getVout();
734     if( p_vout ) {
735         var_SetInteger( p_vout, "crop-top", [o_crop_top_fld intValue] );
736         var_SetInteger( p_vout, "crop-bottom", [o_crop_bottom_fld intValue] );
737         var_SetInteger( p_vout, "crop-left", [o_crop_left_fld intValue] );
738         var_SetInteger( p_vout, "crop-right", [o_crop_right_fld intValue] );
739         vlc_object_release( p_vout );
740     }
741 }
742
743 #undef updateopposite
744
745 #pragma mark -
746 #pragma mark geometry
747 - (IBAction)enableTransform:(id)sender
748 {
749     [self setVideoFilter: "transform" on: [o_transform_ckb state]];
750     [o_transform_pop setEnabled: [o_transform_ckb state]];
751 }
752
753 - (IBAction)transformModifierChanged:(id)sender
754 {
755     NSInteger tag = [[o_transform_pop selectedItem] tag];
756     char * psz_string = (char *)[[NSString stringWithFormat:@"%li", tag] UTF8String];
757     if( tag == 1 )
758         psz_string = (char *)"hflip";
759     else if( tag == 2 )
760         psz_string = (char *)"vflip";
761
762     [self setVideoFilterProperty: "transform-type" forFilter: "transform" string: psz_string];
763 }
764
765 - (IBAction)enableZoom:(id)sender
766 {
767     [self setVideoFilter: "magnify" on: [o_zoom_ckb state]];
768 }
769
770 - (IBAction)enablePuzzle:(id)sender
771 {
772     BOOL b_state = [o_puzzle_ckb state];
773
774     [self setVideoFilter: "puzzle" on: b_state];
775     [o_puzzle_columns_fld setEnabled: b_state];
776     [o_puzzle_columns_lbl setEnabled: b_state];
777     [o_puzzle_rows_fld setEnabled: b_state];
778     [o_puzzle_rows_lbl setEnabled: b_state];
779     [o_puzzle_blackslot_ckb setEnabled: b_state];
780 }
781
782 - (IBAction)puzzleModifierChanged:(id)sender
783 {
784     if( sender == o_puzzle_blackslot_ckb )
785         [self setVideoFilterProperty: "puzzle-black-slot" forFilter: "puzzle" boolean: [o_puzzle_blackslot_ckb state]];
786     else if( sender == o_puzzle_columns_fld )
787         [self setVideoFilterProperty: "puzzle-cols" forFilter: "puzzle" integer: [o_puzzle_columns_fld intValue]];
788     else
789         [self setVideoFilterProperty: "puzzle-rows" forFilter: "puzzle" integer: [o_puzzle_rows_fld intValue]];
790 }
791
792
793 #pragma mark -
794 #pragma mark color
795 - (IBAction)enableThreshold:(id)sender
796 {
797     BOOL b_state = [o_threshold_ckb state];
798
799     [self setVideoFilter: "colorthres" on: b_state];
800     [o_threshold_color_fld setEnabled: b_state];
801     [o_threshold_color_lbl setEnabled: b_state];
802     [o_threshold_saturation_sld setEnabled: b_state];
803     [o_threshold_saturation_lbl setEnabled: b_state];
804     [o_threshold_similarity_sld setEnabled: b_state];
805     [o_threshold_similarity_lbl setEnabled: b_state];
806 }
807
808 - (IBAction)thresholdModifierChanged:(id)sender
809 {
810     if( sender == o_threshold_color_fld )
811         [self setVideoFilterProperty: "colorthres-color" forFilter: "colorthres" integer: [o_threshold_color_fld intValue]];
812     else if( sender == o_threshold_saturation_sld )
813     {
814         [self setVideoFilterProperty: "colorthres-saturationthres" forFilter: "colorthres" integer: [o_threshold_saturation_sld intValue]];
815         [o_threshold_saturation_sld setToolTip: [NSString stringWithFormat:@"%i", [o_threshold_saturation_sld intValue]]];
816     }
817     else
818     {
819         [self setVideoFilterProperty: "colorthres-similaritythres" forFilter: "colorthres" integer: [o_threshold_similarity_sld intValue]];
820         [o_threshold_similarity_sld setToolTip: [NSString stringWithFormat:@"%i", [o_threshold_similarity_sld intValue]]];
821     }
822 }
823
824 - (IBAction)enableSepia:(id)sender
825 {
826     BOOL b_state = [o_sepia_ckb state];
827
828     [self setVideoFilter: "sepia" on: b_state];
829     [o_sepia_fld setEnabled: b_state];
830     [o_sepia_lbl setEnabled: b_state];
831 }
832
833 - (IBAction)sepiaModifierChanged:(id)sender
834 {
835     [self setVideoFilterProperty: "sepia-intensity" forFilter: "sepia" integer: [o_sepia_fld intValue]];
836 }
837
838 - (IBAction)enableNoise:(id)sender
839 {
840     [self setVideoFilter: "noise" on: [o_noise_ckb state]];
841 }
842
843 - (IBAction)enableGradient:(id)sender
844 {
845     BOOL b_state = [o_gradient_ckb state];
846
847     [self setVideoFilter: "gradient" on: b_state];
848     [o_gradient_mode_pop setEnabled: b_state];
849     [o_gradient_mode_lbl setEnabled: b_state];
850     [o_gradient_color_ckb setEnabled: b_state];
851     [o_gradient_cartoon_ckb setEnabled: b_state];
852 }
853
854 - (IBAction)gradientModifierChanged:(id)sender
855 {
856     if( sender == o_gradient_mode_pop ) {
857         if( [[o_gradient_mode_pop selectedItem] tag] == 3 )
858             [self setVideoFilterProperty: "gradient-mode" forFilter: "gradient" string: "hough"];
859         else if( [[o_gradient_mode_pop selectedItem] tag] == 2 )
860             [self setVideoFilterProperty: "gradient-mode" forFilter: "gradient" string: "edge"];
861         else
862             [self setVideoFilterProperty: "gradient-mode" forFilter: "gradient" string: "gradient"];
863     }
864     else if( sender == o_gradient_color_ckb )
865         [self setVideoFilterProperty: "gradient-type" forFilter: "gradient" integer: [o_gradient_color_ckb state]];
866     else
867         [self setVideoFilterProperty: "gradient-cartoon" forFilter: "gradient" boolean: [o_gradient_cartoon_ckb state]];
868 }
869
870 - (IBAction)enableExtract:(id)sender
871 {
872     BOOL b_state = [o_extract_ckb state];
873     [self setVideoFilter: "extract" on: b_state];
874     [o_extract_fld setEnabled: b_state];
875     [o_extract_lbl setEnabled: b_state];
876 }
877
878 - (IBAction)extractModifierChanged:(id)sender
879 {
880     [self setVideoFilterProperty: "extract-component" forFilter: "extract" integer: [o_extract_fld intValue]];
881 }
882
883 - (IBAction)enableInvert:(id)sender
884 {
885     [self setVideoFilter: "invert" on: [o_invert_ckb state]];
886 }
887
888 - (IBAction)enablePosterize:(id)sender
889 {
890     BOOL b_state = [o_posterize_ckb state];
891
892     [self setVideoFilter: "posterize" on: b_state];
893     [o_posterize_fld setEnabled: b_state];
894     [o_posterize_lbl setEnabled: b_state];
895 }
896
897 - (IBAction)posterizeModifierChanged:(id)sender
898 {
899     [self setVideoFilterProperty: "posterize-level" forFilter: "posterize" integer: [o_extract_fld intValue]];
900 }
901
902 - (IBAction)enableBlur:(id)sender
903 {
904     BOOL b_state = [o_blur_ckb state];
905
906     [self setVideoFilter: "motionblur" on: b_state];
907     [o_blur_sld setEnabled: b_state];
908     [o_blur_lbl setEnabled: b_state];
909 }
910
911 - (IBAction)blurModifierChanged:(id)sender
912 {
913     [self setVideoFilterProperty: "blur-factor" forFilter: "motionblur" integer: [sender intValue]];
914     [sender setToolTip: [NSString stringWithFormat:@"%i", [sender intValue]]];
915 }
916
917 - (IBAction)enableMotionDetect:(id)sender
918 {
919     [self setVideoFilter: "motiondetect" on: [o_motiondetect_ckb state]];
920 }
921
922 - (IBAction)enableWaterEffect:(id)sender
923 {
924     [self setVideoFilter: "ripple" on: [o_watereffect_ckb state]];
925 }
926
927 - (IBAction)enableWaves:(id)sender
928 {
929     [self setVideoFilter: "wave" on: [o_waves_ckb state]];
930 }
931
932 - (IBAction)enablePsychedelic:(id)sender
933 {
934     [self setVideoFilter: "psychedelic" on: [o_psychedelic_ckb state]];
935 }
936
937
938 #pragma mark -
939 #pragma mark Miscellaneous
940 - (IBAction)enableAddText:(id)sender
941 {
942     BOOL b_state = [o_addtext_ckb state];
943
944     [o_addtext_pos_pop setEnabled: b_state];
945     [o_addtext_pos_lbl setEnabled: b_state];
946     [o_addtext_text_lbl setEnabled: b_state];
947     [o_addtext_text_fld setEnabled: b_state];
948     [self setVideoFilter: "marq" on: b_state];
949     [self setVideoFilterProperty: "marq-marquee" forFilter: "marq" string: (char *)[[o_addtext_text_fld stringValue] UTF8String]];
950     [self setVideoFilterProperty: "marq-position" forFilter: "marq" integer: [[o_addtext_pos_pop selectedItem] tag]];
951 }
952
953 - (IBAction)addTextModifierChanged:(id)sender
954 {
955     if (sender == o_addtext_text_fld)
956         [self setVideoFilterProperty: "marq-marquee" forFilter: "marq" string: (char *)[[o_addtext_text_fld stringValue] UTF8String]];
957     else
958         [self setVideoFilterProperty: "marq-position" forFilter: "marq" integer: [[o_addtext_pos_pop selectedItem] tag]];
959 }
960
961 - (IBAction)enableAddLogo:(id)sender
962 {
963     BOOL b_state = [o_addlogo_ckb state];
964
965     [o_addlogo_pos_pop setEnabled: b_state];
966     [o_addlogo_pos_lbl setEnabled: b_state];
967     [o_addlogo_logo_fld setEnabled: b_state];
968     [o_addlogo_logo_lbl setEnabled: b_state];
969     [o_addlogo_transparency_sld setEnabled: b_state];
970     [o_addlogo_transparency_lbl setEnabled: b_state];
971     [self setVideoFilter: "logo" on: b_state];
972 }
973
974 - (IBAction)addLogoModifierChanged:(id)sender
975 {
976     if (sender == o_addlogo_logo_fld)
977         [self setVideoFilterProperty: "logo-file" forFilter: "logo" string: (char *)[[o_addlogo_logo_fld stringValue] UTF8String]];
978     else if (sender == o_addlogo_pos_pop)
979         [self setVideoFilterProperty: "logo-position" forFilter: "logo" integer: [[o_addlogo_pos_pop selectedItem] tag]];
980     else
981     {
982         [self setVideoFilterProperty: "logo-opacity" forFilter: "logo" integer: [o_addlogo_transparency_sld intValue]];
983         [o_addlogo_transparency_sld setToolTip: [NSString stringWithFormat:@"%i", [o_addlogo_transparency_sld intValue]]];
984     }
985 }
986
987 @end