]> git.sesse.net Git - vlc/blob - src/libvlc.c
VLC_VariableSet: assume unsafe variable settings. Fixes #1371.
[vlc] / src / libvlc.c
1 /*****************************************************************************
2  * libvlc.c: Implementation of the old libvlc API
3  *****************************************************************************
4  * Copyright (C) 1998-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Vincent Seguin <seguin@via.ecp.fr>
8  *          Samuel Hocevar <sam@zoy.org>
9  *          Gildas Bazin <gbazin@videolan.org>
10  *          Derk-Jan Hartman <hartman at videolan dot org>
11  *          RĂ©mi Denis-Courmont <rem # videolan : org>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  *****************************************************************************/
27
28 /*****************************************************************************
29  * Pretend we are a builtin module
30  *****************************************************************************/
31 #define MODULE_NAME main
32 #define MODULE_PATH main
33 #define __BUILTIN__
34
35 /*****************************************************************************
36  * Preamble
37  *****************************************************************************/
38 #ifdef HAVE_CONFIG_H
39 # include "config.h"
40 #endif
41
42 #include <vlc/vlc.h>
43
44 #include "control/libvlc_internal.h"
45 #include "libvlc.h"
46
47 #include <vlc_playlist.h>
48
49 #include <vlc_aout.h>
50 #include <vlc_vout.h>
51
52 /*****************************************************************************
53  * VLC_Version: return the libvlc version.
54  *****************************************************************************
55  * This function returns full version string (numeric version and codename).
56  *****************************************************************************/
57 char const * VLC_Version( void )
58 {
59     return VERSION_MESSAGE;
60 }
61
62 /*****************************************************************************
63  * VLC_CompileBy, VLC_CompileHost, VLC_CompileDomain,
64  * VLC_Compiler, VLC_Changeset
65  *****************************************************************************/
66 #define DECLARE_VLC_VERSION( func, var )                                    \
67 char const * VLC_##func ( void )                                            \
68 {                                                                           \
69     return VLC_##var ;                                                      \
70 }
71
72 DECLARE_VLC_VERSION( CompileBy, COMPILE_BY );
73 DECLARE_VLC_VERSION( CompileHost, COMPILE_HOST );
74 DECLARE_VLC_VERSION( CompileDomain, COMPILE_DOMAIN );
75 DECLARE_VLC_VERSION( Compiler, COMPILER );
76
77 extern const char psz_vlc_changeset[];
78 const char* VLC_Changeset( void )
79 {
80     return psz_vlc_changeset;
81 }
82
83 /*****************************************************************************
84  * VLC_Error: strerror() equivalent
85  *****************************************************************************
86  * This function returns full version string (numeric version and codename).
87  *****************************************************************************/
88 char const * VLC_Error( int i_err )
89 {
90     return vlc_error( i_err );
91 }
92
93 /*****************************************************************************
94  * VLC_Create: allocate a libvlc instance and intialize global libvlc stuff if needed
95  *****************************************************************************
96  * This function allocates a libvlc instance and returns a negative value
97  * in case of failure. Also, the thread system is initialized.
98  *****************************************************************************/
99 int VLC_Create( void )
100 {
101     libvlc_int_t *p_object = libvlc_InternalCreate();
102     if( p_object ) return p_object->i_object_id;
103     return VLC_ENOOBJ;
104 }
105
106 #define LIBVLC_FUNC \
107     libvlc_int_t * p_libvlc = vlc_current_object( i_object ); \
108     if( !p_libvlc ) return VLC_ENOOBJ;
109 #define LIBVLC_FUNC_END \
110     if( i_object ) vlc_object_release( p_libvlc );
111
112
113 /*****************************************************************************
114  * VLC_Init: initialize a libvlc instance
115  *****************************************************************************
116  * This function initializes a previously allocated libvlc instance:
117  *  - CPU detection
118  *  - gettext initialization
119  *  - message queue, module bank and playlist initialization
120  *  - configuration and commandline parsing
121  *****************************************************************************/
122 int VLC_Init( int i_object, int i_argc, const char *ppsz_argv[] )
123 {
124     int i_ret;
125     LIBVLC_FUNC;
126     i_ret = libvlc_InternalInit( p_libvlc, i_argc, ppsz_argv );
127     LIBVLC_FUNC_END;
128     return i_ret;
129 }
130
131 /*****************************************************************************
132  * VLC_AddIntf: add an interface
133  *****************************************************************************
134  * This function opens an interface plugin and runs it. If b_block is set
135  * to 0, VLC_AddIntf will return immediately and let the interface run in a
136  * separate thread. If b_block is set to 1, VLC_AddIntf will continue until
137  * user requests to quit. If b_play is set to 1, VLC_AddIntf will start playing
138  * the playlist when it is completely initialised.
139  *****************************************************************************/
140 int VLC_AddIntf( int i_object, char const *psz_module,
141                  bool b_block, bool b_play )
142 {
143     int i_ret;
144     LIBVLC_FUNC;
145     i_ret = libvlc_InternalAddIntf( p_libvlc, psz_module, b_block, b_play,
146                                     0, NULL );
147     LIBVLC_FUNC_END;
148     return i_ret;
149 }
150
151
152 /*****************************************************************************
153  * VLC_Die: ask vlc to die.
154  *****************************************************************************
155  * This function sets p_libvlc->b_die to true, but does not do any other
156  * task. It is your duty to call VLC_CleanUp and VLC_Destroy afterwards.
157  *****************************************************************************/
158 int VLC_Die( int i_object )
159 {
160     LIBVLC_FUNC;
161     vlc_object_kill( p_libvlc );
162     LIBVLC_FUNC_END;
163     return VLC_SUCCESS;
164 }
165
166 /*****************************************************************************
167  * VLC_CleanUp: CleanUp all the intf, playlist, vout, aout
168  *****************************************************************************/
169 int VLC_CleanUp( int i_object )
170 {
171     int i_ret;
172     LIBVLC_FUNC;
173     i_ret = libvlc_InternalCleanup( p_libvlc );
174     LIBVLC_FUNC_END;
175     return i_ret;
176 }
177
178 /*****************************************************************************
179  * VLC_Destroy: Destroy everything.
180  *****************************************************************************
181  * This function requests the running threads to finish, waits for their
182  * termination, and destroys their structure.
183  *****************************************************************************/
184 int VLC_Destroy( int i_object )
185 {
186     LIBVLC_FUNC;
187     return libvlc_InternalDestroy( p_libvlc, i_object ? true : false );
188 }
189
190 /*****************************************************************************
191  * VLC_VariableSet: set a "safe" vlc variable
192  *****************************************************************************/
193 int VLC_VariableSet( int i_object, char const *psz_var, vlc_value_t value )
194 {
195     int i_ret;
196     LIBVLC_FUNC;
197
198     /* FIXME: Temporary hack for Mozilla, if variable starts with conf:: then
199      * we handle it as a configuration variable. Don't tell Gildas :) -- sam */
200     if( !strncmp( psz_var, "conf::", 6 ) )
201     {
202         module_config_t *p_item;
203         char const *psz_newvar = psz_var + 6;
204
205         p_item = config_FindConfig( VLC_OBJECT(p_libvlc), psz_newvar );
206
207         if( p_item )
208         {
209             /* VLC_VariableSet is only used from the browser plugins, so we
210              *  can pretty much assume that the input is _not_ trusted. */
211             if( !p_item->b_safe )
212                 return VLC_EGENERIC;
213
214             switch( p_item->i_type )
215             {
216                 case CONFIG_ITEM_BOOL:
217                     config_PutInt( p_libvlc, psz_newvar, value.b_bool );
218                     break;
219                 case CONFIG_ITEM_INTEGER:
220                     config_PutInt( p_libvlc, psz_newvar, value.i_int );
221                     break;
222                 case CONFIG_ITEM_FLOAT:
223                     config_PutFloat( p_libvlc, psz_newvar, value.f_float );
224                     break;
225                 default:
226                     config_PutPsz( p_libvlc, psz_newvar, value.psz_string );
227                     break;
228             }
229             if( i_object ) vlc_object_release( p_libvlc );
230             return VLC_SUCCESS;
231         }
232     }
233
234     i_ret = var_Set( p_libvlc, psz_var, value );
235
236     LIBVLC_FUNC_END;
237     return i_ret;
238 }
239
240 /*****************************************************************************
241  * VLC_VariableGet: get a vlc variable
242  *****************************************************************************/
243 int VLC_VariableGet( int i_object, char const *psz_var, vlc_value_t *p_value )
244 {
245     int i_ret;
246     LIBVLC_FUNC;
247     i_ret = var_Get( p_libvlc , psz_var, p_value );
248     LIBVLC_FUNC_END;
249     return i_ret;
250 }
251
252 /*****************************************************************************
253  * VLC_VariableType: get a vlc variable type
254  *****************************************************************************/
255 int VLC_VariableType( int i_object, char const *psz_var, int *pi_type )
256 {
257     int i_type;
258     LIBVLC_FUNC;
259     /* FIXME: Temporary hack for Mozilla, if variable starts with conf:: then
260      * we handle it as a configuration variable. Don't tell Gildas :) -- sam */
261     if( !strncmp( psz_var, "conf::", 6 ) )
262     {
263         module_config_t *p_item;
264         char const *psz_newvar = psz_var + 6;
265
266         p_item = config_FindConfig( VLC_OBJECT(p_libvlc), psz_newvar );
267
268         if( p_item )
269         {
270             switch( p_item->i_type )
271             {
272                 case CONFIG_ITEM_BOOL:
273                     i_type = VLC_VAR_BOOL;
274                     break;
275                 case CONFIG_ITEM_INTEGER:
276                     i_type = VLC_VAR_INTEGER;
277                     break;
278                 case CONFIG_ITEM_FLOAT:
279                     i_type = VLC_VAR_FLOAT;
280                     break;
281                 default:
282                     i_type = VLC_VAR_STRING;
283                     break;
284             }
285         }
286         else
287             i_type = 0;
288     }
289     else
290         i_type = VLC_VAR_TYPE & var_Type( p_libvlc , psz_var );
291
292     LIBVLC_FUNC_END;
293
294     if( i_type > 0 )
295     {
296         *pi_type = i_type;
297         return VLC_SUCCESS;
298     }
299     return VLC_ENOVAR;
300 }
301
302 #define LIBVLC_PLAYLIST_FUNC \
303     libvlc_int_t *p_libvlc = vlc_current_object( i_object );\
304     if( !p_libvlc ) return VLC_ENOOBJ; \
305     playlist_t *p_playlist = pl_Yield( p_libvlc ); \
306     if( !p_playlist ) return VLC_ENOOBJ
307
308 #define LIBVLC_PLAYLIST_FUNC_END \
309     pl_Release( p_libvlc ); \
310     if( i_object ) vlc_object_release( p_libvlc );
311
312 /*****************************************************************************
313  * VLC_AddTarget: adds a target for playing.
314  *****************************************************************************
315  * This function adds psz_target to the playlist
316  *****************************************************************************/
317
318 int VLC_AddTarget( int i_object, char const *psz_target,
319                    char const **ppsz_options, int i_options,
320                    int i_mode, int i_pos )
321 {
322     int i_err;
323     LIBVLC_PLAYLIST_FUNC;
324     i_err = playlist_AddExt( p_playlist, psz_target,
325                              NULL,  i_mode, i_pos, -1,
326                              ppsz_options, i_options, true, false );
327     LIBVLC_PLAYLIST_FUNC_END;
328     return i_err;
329 }
330
331 /*****************************************************************************
332  * VLC_Play: play the playlist
333  *****************************************************************************/
334 int VLC_Play( int i_object )
335 {
336     LIBVLC_PLAYLIST_FUNC;
337     playlist_Play( p_playlist );
338     LIBVLC_PLAYLIST_FUNC_END;
339     return VLC_SUCCESS;
340 }
341
342 /*****************************************************************************
343  * VLC_Pause: toggle pause
344  *****************************************************************************/
345 int VLC_Pause( int i_object )
346 {
347     LIBVLC_PLAYLIST_FUNC;
348     playlist_Pause( p_playlist );
349     LIBVLC_PLAYLIST_FUNC_END;
350     return VLC_SUCCESS;
351 }
352
353 /*****************************************************************************
354  * VLC_Stop: stop playback
355  *****************************************************************************/
356 int VLC_Stop( int i_object )
357 {
358     LIBVLC_PLAYLIST_FUNC;
359     playlist_Stop( p_playlist );
360     LIBVLC_PLAYLIST_FUNC_END;
361     return VLC_SUCCESS;
362 }
363
364 /*****************************************************************************
365  * VLC_IsPlaying: Query for Playlist Status
366  *****************************************************************************/
367 bool VLC_IsPlaying( int i_object )
368 {
369     bool   b_playing;
370
371     LIBVLC_PLAYLIST_FUNC;
372     if( p_playlist->p_input )
373     {
374         vlc_value_t  val;
375         var_Get( p_playlist->p_input, "state", &val );
376         b_playing = ( val.i_int == PLAYING_S );
377     }
378     else
379     {
380         b_playing = playlist_IsPlaying( p_playlist );
381     }
382     LIBVLC_PLAYLIST_FUNC_END;
383     return b_playing;
384 }
385
386 /**
387  * Get the current position in a input
388  *
389  * Return the current position as a float
390  * \note For some inputs, this will be unknown.
391  *
392  * \param i_object a vlc object id
393  * \return a float in the range of 0.0 - 1.0
394  */
395 float VLC_PositionGet( int i_object )
396 {
397     input_thread_t *p_input;
398     vlc_value_t val;
399     LIBVLC_FUNC;
400
401     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
402
403     if( !p_input )
404     {
405         if( i_object ) vlc_object_release( p_libvlc );
406         return VLC_ENOOBJ;
407     }
408
409     var_Get( p_input, "position", &val );
410     vlc_object_release( p_input );
411
412     LIBVLC_FUNC_END;
413     return val.f_float;
414 }
415
416 /**
417  * Set the current position in a input
418  *
419  * Set the current position in a input and then return
420  * the current position as a float.
421  * \note For some inputs, this will be unknown.
422  *
423  * \param i_object a vlc object id
424  * \param i_position a float in the range of 0.0 - 1.0
425  * \return a float in the range of 0.0 - 1.0
426  */
427 float VLC_PositionSet( int i_object, float i_position )
428 {
429     input_thread_t *p_input;
430     vlc_value_t val;
431     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
432
433     /* Check that the handle is valid */
434     if( !p_libvlc )
435     {
436         return VLC_ENOOBJ;
437     }
438
439     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
440
441     if( !p_input )
442     {
443         if( i_object ) vlc_object_release( p_libvlc );
444         return VLC_ENOOBJ;
445     }
446
447     val.f_float = i_position;
448     var_Set( p_input, "position", val );
449     var_Get( p_input, "position", &val );
450     vlc_object_release( p_input );
451
452     if( i_object ) vlc_object_release( p_libvlc );
453     return val.f_float;
454 }
455
456 /**
457  * Get the current position in a input
458  *
459  * Return the current position in seconds from the start.
460  * \note For some inputs, this will be unknown.
461  *
462  * \param i_object a vlc object id
463  * \return the offset from 0:00 in seconds
464  */
465 int VLC_TimeGet( int i_object )
466 {
467     input_thread_t *p_input;
468     vlc_value_t val;
469     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
470
471     /* Check that the handle is valid */
472     if( !p_libvlc )
473     {
474         return VLC_ENOOBJ;
475     }
476
477     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
478
479     if( !p_input )
480     {
481         if( i_object ) vlc_object_release( p_libvlc );
482         return VLC_ENOOBJ;
483     }
484
485     var_Get( p_input, "time", &val );
486     vlc_object_release( p_input );
487
488     if( i_object ) vlc_object_release( p_libvlc );
489     return val.i_time  / 1000000;
490 }
491
492 /**
493  * Seek to a position in the current input
494  *
495  * Seek i_seconds in the current input. If b_relative is set,
496  * then the seek will be relative to the current position, otherwise
497  * it will seek to i_seconds from the beginning of the input.
498  * \note For some inputs, this will be unknown.
499  *
500  * \param i_object a vlc object id
501  * \param i_seconds seconds from current position or from beginning of input
502  * \param b_relative seek relative from current position
503  * \return VLC_SUCCESS on success
504  */
505 int VLC_TimeSet( int i_object, int i_seconds, bool b_relative )
506 {
507     input_thread_t *p_input;
508     vlc_value_t val;
509     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
510
511     /* Check that the handle is valid */
512     if( !p_libvlc )
513     {
514         return VLC_ENOOBJ;
515     }
516
517     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
518
519     if( !p_input )
520     {
521         if( i_object ) vlc_object_release( p_libvlc );
522         return VLC_ENOOBJ;
523     }
524
525     if( b_relative )
526     {
527         val.i_time = i_seconds;
528         val.i_time = val.i_time * 1000000L;
529         var_Set( p_input, "time-offset", val );
530     }
531     else
532     {
533         val.i_time = i_seconds;
534         val.i_time = val.i_time * 1000000L;
535         var_Set( p_input, "time", val );
536     }
537     vlc_object_release( p_input );
538
539     if( i_object ) vlc_object_release( p_libvlc );
540     return VLC_SUCCESS;
541 }
542
543 /**
544  * Get the total length of a input
545  *
546  * Return the total length in seconds from the current input.
547  * \note For some inputs, this will be unknown.
548  *
549  * \param i_object a vlc object id
550  * \return the length in seconds
551  */
552 int VLC_LengthGet( int i_object )
553 {
554     input_thread_t *p_input;
555     vlc_value_t val;
556     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
557
558     /* Check that the handle is valid */
559     if( !p_libvlc )
560     {
561         return VLC_ENOOBJ;
562     }
563
564     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
565
566     if( !p_input )
567     {
568         if( i_object ) vlc_object_release( p_libvlc );
569         return VLC_ENOOBJ;
570     }
571
572     var_Get( p_input, "length", &val );
573     vlc_object_release( p_input );
574
575     if( i_object ) vlc_object_release( p_libvlc );
576     return val.i_time  / 1000000L;
577 }
578
579 /**
580  * Play the input faster than realtime
581  *
582  * 2x, 4x, 8x faster than realtime
583  * \note For some inputs, this will be impossible.
584  *
585  * \param i_object a vlc object id
586  * \return the current speedrate
587  */
588 float VLC_SpeedFaster( int i_object )
589 {
590     input_thread_t *p_input;
591     vlc_value_t val;
592     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
593
594     /* Check that the handle is valid */
595     if( !p_libvlc )
596     {
597         return VLC_ENOOBJ;
598     }
599
600     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
601
602     if( !p_input )
603     {
604         if( i_object ) vlc_object_release( p_libvlc );
605         return VLC_ENOOBJ;
606     }
607
608     val.b_bool = true;
609     var_Set( p_input, "rate-faster", val );
610     var_Get( p_input, "rate", &val );
611     vlc_object_release( p_input );
612
613     if( i_object ) vlc_object_release( p_libvlc );
614     return val.f_float / INPUT_RATE_DEFAULT;
615 }
616
617 /**
618  * Play the input slower than realtime
619  *
620  * 1/2x, 1/4x, 1/8x slower than realtime
621  * \note For some inputs, this will be impossible.
622  *
623  * \param i_object a vlc object id
624  * \return the current speedrate
625  */
626 float VLC_SpeedSlower( int i_object )
627 {
628     input_thread_t *p_input;
629     vlc_value_t val;
630     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
631
632     /* Check that the handle is valid */
633     if( !p_libvlc )
634     {
635         return VLC_ENOOBJ;
636     }
637
638     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
639
640     if( !p_input )
641     {
642         if( i_object ) vlc_object_release( p_libvlc );
643         return VLC_ENOOBJ;
644     }
645
646     val.b_bool = true;
647     var_Set( p_input, "rate-slower", val );
648     var_Get( p_input, "rate", &val );
649     vlc_object_release( p_input );
650
651     if( i_object ) vlc_object_release( p_libvlc );
652     return val.f_float / INPUT_RATE_DEFAULT;
653 }
654
655 /**
656  * Return the current playlist item
657  *
658  * Returns the index of the playlistitem that is currently selected for play.
659  * This is valid even if nothing is currently playing.
660  *
661  * \param i_object a vlc object id
662  * \return the current index
663  */
664 int VLC_PlaylistIndex( int i_object )
665 {
666     (void)i_object;
667     printf( "This function is deprecated and should not be used anymore" );
668     return -1;
669 }
670
671 /**
672  * Total number of items in the playlist
673  *
674  * \param i_object a vlc object id
675  * \return amount of playlist items
676  */
677 int VLC_PlaylistNumberOfItems( int i_object )
678 {
679     int i_size;
680     LIBVLC_PLAYLIST_FUNC;
681     i_size = p_playlist->items.i_size;
682     LIBVLC_PLAYLIST_FUNC_END;
683     return i_size;
684 }
685
686 /**
687  * Go to next playlist item
688  * \param i_object a vlc object id
689  * \return VLC_SUCCESS on success
690  */
691 int VLC_PlaylistNext( int i_object )
692 {
693     LIBVLC_PLAYLIST_FUNC;
694     playlist_Next( p_playlist );
695     LIBVLC_PLAYLIST_FUNC_END;
696     return VLC_SUCCESS;
697 }
698
699 /**
700  * Go to previous playlist item
701  * \param i_object a vlc object id
702  * \return VLC_SUCCESS on success
703  */
704 int VLC_PlaylistPrev( int i_object )
705 {
706     LIBVLC_PLAYLIST_FUNC;
707     playlist_Prev( p_playlist );
708     LIBVLC_PLAYLIST_FUNC_END;
709     return VLC_SUCCESS;
710 }
711
712 /**
713  * Empty the playlist
714  */
715 int VLC_PlaylistClear( int i_object )
716 {
717     LIBVLC_PLAYLIST_FUNC;
718     playlist_Clear( p_playlist, true );
719     LIBVLC_PLAYLIST_FUNC_END;
720     return VLC_SUCCESS;
721 }
722
723 /**
724  * Change the volume
725  *
726  * \param i_object a vlc object id
727  * \param i_volume something in a range from 0-200
728  * \return the new volume (range 0-200 %)
729  */
730 int VLC_VolumeSet( int i_object, int i_volume )
731 {
732     audio_volume_t i_vol = 0;
733     LIBVLC_FUNC;
734
735     if( i_volume >= 0 && i_volume <= 200 )
736     {
737         i_vol = i_volume * AOUT_VOLUME_MAX / 200;
738         aout_VolumeSet( p_libvlc, i_vol );
739     }
740     LIBVLC_FUNC_END;
741     return i_vol * 200 / AOUT_VOLUME_MAX;
742 }
743
744 /**
745  * Get the current volume
746  *
747  * Retrieve the current volume.
748  *
749  * \param i_object a vlc object id
750  * \return the current volume (range 0-200 %)
751  */
752 int VLC_VolumeGet( int i_object )
753 {
754     audio_volume_t i_volume;
755     LIBVLC_FUNC;
756     aout_VolumeGet( p_libvlc, &i_volume );
757     LIBVLC_FUNC_END;
758     return i_volume*200/AOUT_VOLUME_MAX;
759 }
760
761 /**
762  * Mute/Unmute the volume
763  *
764  * \param i_object a vlc object id
765  * \return VLC_SUCCESS on success
766  */
767 int VLC_VolumeMute( int i_object )
768 {
769     LIBVLC_FUNC;
770     aout_VolumeMute( p_libvlc, NULL );
771     LIBVLC_FUNC_END;
772     return VLC_SUCCESS;
773 }
774
775 /*****************************************************************************
776  * VLC_FullScreen: toggle fullscreen mode
777  *****************************************************************************/
778 int VLC_FullScreen( int i_object )
779 {
780     vout_thread_t *p_vout;
781     LIBVLC_FUNC;
782     p_vout = vlc_object_find( p_libvlc, VLC_OBJECT_VOUT, FIND_CHILD );
783
784     if( !p_vout )
785     {
786         if( i_object ) vlc_object_release( p_libvlc );
787         return VLC_ENOOBJ;
788     }
789
790     p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
791     vlc_object_release( p_vout );
792     LIBVLC_FUNC_END;
793     return VLC_SUCCESS;
794 }