]> git.sesse.net Git - vlc/blob - modules/gui/macosx/controls.m
ALL: OS X OpenGL provider
[vlc] / modules / gui / macosx / controls.m
1 /*****************************************************************************
2  * controls.m: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8  *          Christophe Massiot <massiot@via.ecp.fr>
9  *          Derk-Jan Hartman <hartman at videolan dot org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 /*****************************************************************************
27  * Preamble
28  *****************************************************************************/
29 #include <stdlib.h>                                      /* malloc(), free() */
30 #include <sys/param.h>                                    /* for MAXPATHLEN */
31 #include <string.h>
32
33 #include "intf.h"
34 #include "vout.h"
35 #include "open.h"
36 #include "controls.h"
37 #include <osd.h>
38
39 /*****************************************************************************
40  * VLCControls implementation 
41  *****************************************************************************/
42 @implementation VLCControls
43
44 - (IBAction)play:(id)sender
45 {
46     vlc_value_t val;
47     intf_thread_t * p_intf = VLCIntf;
48     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
49                                         FIND_ANYWHERE );
50     if( p_playlist )
51     {
52         vlc_mutex_lock( &p_playlist->object_lock );
53         if( p_playlist->i_size <= 0 )
54         {
55             vlc_mutex_unlock( &p_playlist->object_lock );
56             vlc_object_release( p_playlist );
57             [o_open openFileGeneric: nil];
58         }
59         else
60         {
61             vlc_mutex_unlock( &p_playlist->object_lock );
62             vlc_object_release( p_playlist );
63         }
64
65     }
66     val.i_int = config_GetInt( p_intf, "key-play-pause" );
67     var_Set( p_intf->p_vlc, "key-pressed", val );
68 }
69
70 - (IBAction)stop:(id)sender
71 {
72     vlc_value_t val;
73     intf_thread_t * p_intf = VLCIntf;
74     val.i_int = config_GetInt( p_intf, "key-stop" );
75     var_Set( p_intf->p_vlc, "key-pressed", val );
76 }
77
78 - (IBAction)faster:(id)sender
79 {
80     vlc_value_t val;
81     intf_thread_t * p_intf = VLCIntf;
82     val.i_int = config_GetInt( p_intf, "key-faster" );
83     var_Set( p_intf->p_vlc, "key-pressed", val );
84 }
85
86 - (IBAction)slower:(id)sender
87 {
88     vlc_value_t val;
89     intf_thread_t * p_intf = VLCIntf;
90     val.i_int = config_GetInt( p_intf, "key-slower" );
91     var_Set( p_intf->p_vlc, "key-pressed", val );
92 }
93
94 - (IBAction)prev:(id)sender
95 {
96     vlc_value_t val;
97     intf_thread_t * p_intf = VLCIntf;
98     val.i_int = config_GetInt( p_intf, "key-prev" );
99     var_Set( p_intf->p_vlc, "key-pressed", val );
100 }
101
102 - (IBAction)next:(id)sender
103 {
104     vlc_value_t val;
105     intf_thread_t * p_intf = VLCIntf;
106     val.i_int = config_GetInt( p_intf, "key-next" );
107     var_Set( p_intf->p_vlc, "key-pressed", val );
108 }
109
110 - (IBAction)random:(id)sender
111 {
112     vlc_value_t val;
113     intf_thread_t * p_intf = VLCIntf;
114     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
115                                                        FIND_ANYWHERE );
116     if( p_playlist == NULL )
117     {
118         return;
119     }
120
121     var_Get( p_playlist, "random", &val );
122     val.b_bool = !val.b_bool;
123     var_Set( p_playlist, "random", val );
124     if( val.b_bool )
125     {
126         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random On" ) );
127     }
128     else
129     {
130         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random Off" ) );
131     }    
132
133     p_intf->p_sys->b_playlist_update = VLC_TRUE;
134     p_intf->p_sys->b_intf_update = VLC_TRUE;
135     vlc_object_release( p_playlist );
136 }
137
138 - (IBAction)repeat:(id)sender
139 {
140     vlc_value_t val;
141     intf_thread_t * p_intf = VLCIntf;
142     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
143                                                        FIND_ANYWHERE );
144     if( p_playlist == NULL )
145     {
146         return;
147     }
148
149     var_Get( p_playlist, "repeat", &val );
150     if (!val.b_bool)
151     {   
152         var_Set( p_playlist, "loop", val );
153     } 
154     val.b_bool = !val.b_bool;
155     var_Set( p_playlist, "repeat", val );
156     if( val.b_bool )
157     {
158         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
159     }
160     else
161     {
162         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
163     }
164
165     p_intf->p_sys->b_playlist_update = VLC_TRUE;    
166     p_intf->p_sys->b_intf_update = VLC_TRUE;
167     vlc_object_release( p_playlist );
168 }
169
170 - (IBAction)loop:(id)sender
171 {
172     vlc_value_t val;
173     intf_thread_t * p_intf = VLCIntf;
174     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
175                                                        FIND_ANYWHERE );
176     if( p_playlist == NULL )
177     {
178         return;
179     }
180
181     var_Get( p_playlist, "loop", &val );
182     if (!val.b_bool)
183     {
184         var_Set( p_playlist, "repeat", val );
185     }
186     val.b_bool = !val.b_bool;
187     var_Set( p_playlist, "loop", val );
188     if( val.b_bool )
189     {
190         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
191     }
192     else
193     {
194         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
195     }    
196
197     p_intf->p_sys->b_playlist_update = VLC_TRUE;
198     p_intf->p_sys->b_intf_update = VLC_TRUE;
199     vlc_object_release( p_playlist );
200 }
201
202 - (IBAction)forward:(id)sender
203 {
204     vlc_value_t val;
205     intf_thread_t * p_intf = VLCIntf;
206     val.i_int = config_GetInt( p_intf, "key-jump+10sec" );
207     var_Set( p_intf->p_vlc, "key-pressed", val );
208 }
209
210 - (IBAction)backward:(id)sender
211 {
212     vlc_value_t val;
213     intf_thread_t * p_intf = VLCIntf;
214     val.i_int = config_GetInt( p_intf, "key-jump-10sec" );
215     var_Set( p_intf->p_vlc, "key-pressed", val );
216 }
217
218
219 - (IBAction)volumeUp:(id)sender
220 {
221     vlc_value_t val;
222     intf_thread_t * p_intf = VLCIntf;
223     val.i_int = config_GetInt( p_intf, "key-vol-up" );
224     var_Set( p_intf->p_vlc, "key-pressed", val );
225     [self updateVolumeSlider];
226 }
227
228 - (IBAction)volumeDown:(id)sender
229 {
230     vlc_value_t val;
231     intf_thread_t * p_intf = VLCIntf;
232     val.i_int = config_GetInt( p_intf, "key-vol-down" );
233     var_Set( p_intf->p_vlc, "key-pressed", val );
234     [self updateVolumeSlider];
235 }
236
237 - (IBAction)mute:(id)sender
238 {
239     vlc_value_t val;
240     intf_thread_t * p_intf = VLCIntf;
241     val.i_int = config_GetInt( p_intf, "key-vol-mute" );
242     var_Set( p_intf->p_vlc, "key-pressed", val );
243     [self updateVolumeSlider];
244 }
245
246 - (IBAction)volumeSliderUpdated:(id)sender
247 {
248     intf_thread_t * p_intf = VLCIntf;
249     audio_volume_t i_volume = (audio_volume_t)[sender intValue];
250
251     aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP );
252 }
253
254 - (void)updateVolumeSlider
255 {
256     intf_thread_t * p_intf = VLCIntf;
257     audio_volume_t i_volume;
258
259     aout_VolumeGet( p_intf, &i_volume );
260
261     [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
262 }
263
264 - (IBAction)windowAction:(id)sender
265 {
266     id o_window = [NSApp keyWindow];
267     NSString *o_title = [sender title];
268     NSArray *o_windows = [NSApp orderedWindows];
269     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
270     vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT,
271                                               FIND_ANYWHERE );
272
273     if( p_vout != NULL )
274     {
275         while ((o_window = [o_enumerator nextObject]))
276         {
277             if( [[o_window className] isEqualToString: @"VLCWindow"] )
278             {
279                 if( [o_title isEqualToString: _NS("Half Size") ] )
280                     [o_window scaleWindowWithFactor: 0.5];
281                 else if( [o_title isEqualToString: _NS("Normal Size") ] )
282                     [o_window scaleWindowWithFactor: 1.0];
283                 else if( [o_title isEqualToString: _NS("Double Size") ] )
284                     [o_window scaleWindowWithFactor: 2.0];
285                 else if( [o_title isEqualToString: _NS("Float on Top") ] )
286                     [o_window toggleFloatOnTop];
287                 else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
288                 {
289                     if( ![o_window isZoomed] )
290                         [o_window performZoom:self];
291                 }
292                 else
293                 {
294                     vlc_value_t val;
295                     var_Get( p_vout, "fullscreen", &val );
296                     var_Set( p_vout, "fullscreen", (vlc_value_t)!val.b_bool );
297                 }
298                 break;
299             }
300         }
301         vlc_object_release( (vlc_object_t *)p_vout );
302     }
303 }
304
305 - (void)setupVarMenuItem:(NSMenuItem *)o_mi
306                     target:(vlc_object_t *)p_object
307                     var:(const char *)psz_variable
308                     selector:(SEL)pf_callback
309 {
310     vlc_value_t val, text;
311     int i_type = var_Type( p_object, psz_variable );
312
313     switch( i_type & VLC_VAR_TYPE )
314     {
315     case VLC_VAR_VOID:
316     case VLC_VAR_BOOL:
317     case VLC_VAR_VARIABLE:
318     case VLC_VAR_STRING:
319     case VLC_VAR_INTEGER:
320         break;
321     default:
322         /* Variable doesn't exist or isn't handled */
323         return;
324     }
325     
326     /* Make sure we want to display the variable */
327     if( i_type & VLC_VAR_HASCHOICE )
328     {
329         var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
330         if( val.i_int == 0 ) return;
331         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
332             return;
333     }
334     
335     /* Get the descriptive name of the variable */
336     var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL );
337     [o_mi setTitle: [[VLCMain sharedInstance] localizedString: text.psz_string ?
338                                         text.psz_string : strdup( psz_variable ) ]];
339
340     var_Get( p_object, psz_variable, &val );
341     if( i_type & VLC_VAR_HASCHOICE )
342     {
343         NSMenu *o_menu = [o_mi submenu];
344
345         [self setupVarMenu: o_menu forMenuItem: o_mi target:p_object
346                         var:psz_variable selector:pf_callback];
347         
348         if( text.psz_string ) free( text.psz_string );
349         return;
350     }
351
352     VLCMenuExt *o_data;
353     switch( i_type & VLC_VAR_TYPE )
354     {
355     case VLC_VAR_VOID:
356         o_data = [[VLCMenuExt alloc] initWithVar: psz_variable Object: p_object->i_object_id
357                 Value: val ofType: i_type];
358         [o_mi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
359         break;
360
361     case VLC_VAR_BOOL:
362         o_data = [[VLCMenuExt alloc] initWithVar: psz_variable Object: p_object->i_object_id
363                 Value: val ofType: i_type];
364         [o_mi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
365         if( !( i_type & VLC_VAR_ISCOMMAND ) )
366             [o_mi setState: val.b_bool ? TRUE : FALSE ];
367         break;
368
369     default:
370         if( text.psz_string ) free( text.psz_string );
371         return;
372     }
373
374     if( ( i_type & VLC_VAR_TYPE ) == VLC_VAR_STRING ) free( val.psz_string );
375     if( text.psz_string ) free( text.psz_string );
376 }
377
378
379 - (void)setupVarMenu:(NSMenu *)o_menu
380                     forMenuItem: (NSMenuItem *)o_parent
381                     target:(vlc_object_t *)p_object
382                     var:(const char *)psz_variable
383                     selector:(SEL)pf_callback
384 {
385     vlc_value_t val, val_list, text_list;
386     int i_type, i, i_nb_items;
387
388     /* remove previous items */
389     i_nb_items = [o_menu numberOfItems];
390     for( i = 0; i < i_nb_items; i++ )
391     {
392         [o_menu removeItemAtIndex: 0];
393     }
394
395     /* Check the type of the object variable */
396     i_type = var_Type( p_object, psz_variable );
397
398     /* Make sure we want to display the variable */
399     if( i_type & VLC_VAR_HASCHOICE )
400     {
401         var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
402         if( val.i_int == 0 ) return;
403         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
404             return;
405     }
406     else
407     {
408         return;
409     }
410
411     switch( i_type & VLC_VAR_TYPE )
412     {
413     case VLC_VAR_VOID:
414     case VLC_VAR_BOOL:
415     case VLC_VAR_VARIABLE:
416     case VLC_VAR_STRING:
417     case VLC_VAR_INTEGER:
418         break;
419     default:
420         /* Variable doesn't exist or isn't handled */
421         return;
422     }
423
424     if( var_Get( p_object, psz_variable, &val ) < 0 )
425     {
426         return;
427     }
428
429     if( var_Change( p_object, psz_variable, VLC_VAR_GETLIST,
430                     &val_list, &text_list ) < 0 )
431     {
432         if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
433         return;
434     }
435
436     /* make (un)sensitive */
437     [o_parent setEnabled: ( val_list.p_list->i_count > 1 )];
438
439     for( i = 0; i < val_list.p_list->i_count; i++ )
440     {
441         vlc_value_t another_val;
442         NSMenuItem * o_lmi;
443         NSString *o_title = @"";
444         VLCMenuExt *o_data;
445
446         switch( i_type & VLC_VAR_TYPE )
447         {
448         case VLC_VAR_STRING:
449             another_val.psz_string =
450                 strdup(val_list.p_list->p_values[i].psz_string);
451
452             o_title = [[VLCMain sharedInstance] localizedString: text_list.p_list->p_values[i].psz_string ?
453                 text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ];
454
455             o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""];
456             o_data = [[VLCMenuExt alloc] initWithVar: strdup(psz_variable) Object: p_object->i_object_id
457                     Value: another_val ofType: i_type];
458             [o_lmi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
459             [o_lmi setTarget: self];
460             
461             if( !strcmp( val.psz_string, val_list.p_list->p_values[i].psz_string ) && !( i_type & VLC_VAR_ISCOMMAND ) )
462                 [o_lmi setState: TRUE ];
463
464             break;
465
466         case VLC_VAR_INTEGER:
467
468              o_title = text_list.p_list->p_values[i].psz_string ?
469                                  [[VLCMain sharedInstance] localizedString: strdup( text_list.p_list->p_values[i].psz_string )] :
470                                  [NSString stringWithFormat: @"%d",
471                                  val_list.p_list->p_values[i].i_int];
472
473             o_lmi = [[o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""] retain ];
474             o_data = [[VLCMenuExt alloc] initWithVar: strdup(psz_variable) Object: p_object->i_object_id
475                     Value: val_list.p_list->p_values[i] ofType: i_type];
476             [o_lmi setRepresentedObject: [NSValue valueWithPointer:[ o_data retain]]];
477             [o_lmi setTarget: self];
478
479             if( val_list.p_list->p_values[i].i_int == val.i_int && !( i_type & VLC_VAR_ISCOMMAND ) )
480                 [o_lmi setState: TRUE ];
481             break;
482
483         default:
484           break;
485         }
486     }
487     
488     /* clean up everything */
489     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
490     var_Change( p_object, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list );
491 }
492
493 - (IBAction)toggleVar:(id)sender
494 {
495     NSMenuItem *o_mi = (NSMenuItem *)sender;
496     VLCMenuExt *o_data = [[o_mi representedObject] pointerValue];
497     [NSThread detachNewThreadSelector: @selector(toggleVarThread:)
498         toTarget: self withObject: o_data];
499
500     return;
501 }
502
503 - (int)toggleVarThread: (id)_o_data
504 {
505     vlc_object_t *p_object;
506     NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
507     VLCMenuExt *o_data = (VLCMenuExt *)_o_data;
508
509     vlc_thread_set_priority( VLCIntf , VLC_THREAD_PRIORITY_LOW );
510
511     p_object = (vlc_object_t *)vlc_object_get( VLCIntf,
512                                     [o_data objectID] );
513
514     if( p_object != NULL )
515     {
516         var_Set( p_object, strdup([o_data name]), [o_data value] );
517         vlc_object_release( p_object );
518         [o_pool release];
519         return VLC_TRUE;
520     }
521     [o_pool release];
522     return VLC_EGENERIC;
523 }
524
525 @end
526
527 @implementation VLCControls (NSMenuValidation)
528  
529 - (BOOL)validateMenuItem:(NSMenuItem *)o_mi
530 {
531     BOOL bEnabled = TRUE;
532     vlc_value_t val;
533     intf_thread_t * p_intf = VLCIntf;
534     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
535                                                        FIND_ANYWHERE );
536
537     if( p_playlist != NULL )
538     {
539         vlc_mutex_lock( &p_playlist->object_lock );
540     }
541
542 #define p_input p_playlist->p_input
543
544     if( [[o_mi title] isEqualToString: _NS("Faster")] ||
545         [[o_mi title] isEqualToString: _NS("Slower")] )
546     {
547         if( p_playlist != NULL && p_input != NULL )
548         {
549             bEnabled = p_input->input.b_can_pace_control;
550         }
551         else
552         {
553             bEnabled = FALSE;
554         }
555     }
556     else if( [[o_mi title] isEqualToString: _NS("Stop")] )
557     {
558         if( p_playlist == NULL || p_input == NULL )
559         {
560             bEnabled = FALSE;
561         }
562     }
563     else if( [[o_mi title] isEqualToString: _NS("Previous")] ||
564              [[o_mi title] isEqualToString: _NS("Next")] )
565     {
566         if( p_playlist == NULL )
567         {
568             bEnabled = FALSE;
569         }
570         else
571         {
572             bEnabled = p_playlist->i_size > 1;
573         }
574     }
575     else if( [[o_mi title] isEqualToString: _NS("Random")] )
576     {
577         int i_state;
578         var_Get( p_playlist, "random", &val );
579         i_state = val.b_bool ? NSOnState : NSOffState;
580         [o_mi setState: i_state];
581     }
582     else if( [[o_mi title] isEqualToString: _NS("Repeat One")] )
583     {
584         int i_state;
585         var_Get( p_playlist, "repeat", &val );
586         i_state = val.b_bool ? NSOnState : NSOffState;
587         [o_mi setState: i_state];
588     }
589     else if( [[o_mi title] isEqualToString: _NS("Repeat All")] )
590     {
591         int i_state;
592         var_Get( p_playlist, "loop", &val );
593         i_state = val.b_bool ? NSOnState : NSOffState;
594         [o_mi setState: i_state];
595     }
596     else if( [[o_mi title] isEqualToString: _NS("Step Forward")] ||
597              [[o_mi title] isEqualToString: _NS("Step Backward")] )
598     {
599         bEnabled = FALSE;
600         if( p_playlist != NULL && p_input != NULL )
601         {
602             var_Get( p_input, "seekable", &val);
603             if( val.b_bool )
604             {
605                 bEnabled = TRUE;
606             }
607         }
608     }
609     else if( [[o_mi title] isEqualToString: _NS("Mute")] ) 
610     {
611         [o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
612     }
613     else if( [[o_mi title] isEqualToString: _NS("Fullscreen")] ||
614                 [[o_mi title] isEqualToString: _NS("Half Size")] ||
615                 [[o_mi title] isEqualToString: _NS("Normal Size")] ||
616                 [[o_mi title] isEqualToString: _NS("Double Size")] ||
617                 [[o_mi title] isEqualToString: _NS("Fit to Screen")] ||
618                 [[o_mi title] isEqualToString: _NS("Float on Top")] )
619     {
620         id o_window;
621         NSArray *o_windows = [NSApp orderedWindows];
622         NSEnumerator *o_enumerator = [o_windows objectEnumerator];
623         bEnabled = FALSE;
624         
625         vout_thread_t   *p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
626                                               FIND_ANYWHERE );
627         if( p_vout != NULL )
628         {
629             if ( [[o_mi title] isEqualToString: _NS("Float on Top")] )
630             {
631                 var_Get( p_vout, "video-on-top", &val );
632                 [o_mi setState: val.b_bool ?  NSOnState : NSOffState];
633             }
634
635             while ((o_window = [o_enumerator nextObject]))
636             {
637                 if( [[o_window className] isEqualToString: @"VLCWindow"] )
638                 {
639                     bEnabled = TRUE;
640                     break;
641                 }
642             }
643             vlc_object_release( (vlc_object_t *)p_vout );
644         }
645     }
646
647     if( p_playlist != NULL )
648     {
649         vlc_mutex_unlock( &p_playlist->object_lock );
650         vlc_object_release( p_playlist );
651     }
652
653     return( bEnabled );
654 }
655
656 @end
657
658 /*****************************************************************************
659  * VLCMenuExt implementation 
660  *****************************************************************************
661  * Object connected to a playlistitem which remembers the data belonging to
662  * the variable of the autogenerated menu
663  *****************************************************************************/
664 @implementation VLCMenuExt
665
666 - (id)initWithVar: (const char *)_psz_name Object: (int)i_id
667         Value: (vlc_value_t)val ofType: (int)_i_type
668 {
669     self = [super init];
670
671     if( self != nil )
672     {
673         psz_name = strdup( _psz_name );
674         i_object_id = i_id;
675         value = val;
676         i_type = _i_type;
677     }
678
679     return( self );
680 }
681
682 - (void)dealloc
683 {
684     free( psz_name );
685 }
686
687 - (char *)name
688 {
689     return psz_name;
690 }
691
692 - (int)objectID
693 {
694     return i_object_id;
695 }
696
697 - (vlc_value_t)value
698 {
699     return value;
700 }
701
702 - (int)type
703 {
704     return i_type;
705 }
706
707 @end