]> git.sesse.net Git - vlc/blob - src/libvlc.c
We also need to check the non "conf::" case. Oops.
[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     /* EXPLICIT HACK (this is the legacy API anyway):
234      * VLC_VariableSet is only used from the browser plugins, so we
235      *  can pretty much assume that the input is _not_ trusted. */
236     module_config_t *p_item;
237     p_item = config_FindConfig( VLC_OBJECT(p_libvlc), psz_var );
238     if( !p_item )
239         return VLC_ENOVAR;
240     if( !p_item->b_safe )
241         return VLC_EGENERIC;
242
243     i_ret = var_Set( p_libvlc, psz_var, value );
244
245     LIBVLC_FUNC_END;
246     return i_ret;
247 }
248
249 /*****************************************************************************
250  * VLC_VariableGet: get a vlc variable
251  *****************************************************************************/
252 int VLC_VariableGet( int i_object, char const *psz_var, vlc_value_t *p_value )
253 {
254     int i_ret;
255     LIBVLC_FUNC;
256     i_ret = var_Get( p_libvlc , psz_var, p_value );
257     LIBVLC_FUNC_END;
258     return i_ret;
259 }
260
261 /*****************************************************************************
262  * VLC_VariableType: get a vlc variable type
263  *****************************************************************************/
264 int VLC_VariableType( int i_object, char const *psz_var, int *pi_type )
265 {
266     int i_type;
267     LIBVLC_FUNC;
268     /* FIXME: Temporary hack for Mozilla, if variable starts with conf:: then
269      * we handle it as a configuration variable. Don't tell Gildas :) -- sam */
270     if( !strncmp( psz_var, "conf::", 6 ) )
271     {
272         module_config_t *p_item;
273         char const *psz_newvar = psz_var + 6;
274
275         p_item = config_FindConfig( VLC_OBJECT(p_libvlc), psz_newvar );
276
277         if( p_item )
278         {
279             switch( p_item->i_type )
280             {
281                 case CONFIG_ITEM_BOOL:
282                     i_type = VLC_VAR_BOOL;
283                     break;
284                 case CONFIG_ITEM_INTEGER:
285                     i_type = VLC_VAR_INTEGER;
286                     break;
287                 case CONFIG_ITEM_FLOAT:
288                     i_type = VLC_VAR_FLOAT;
289                     break;
290                 default:
291                     i_type = VLC_VAR_STRING;
292                     break;
293             }
294         }
295         else
296             i_type = 0;
297     }
298     else
299         i_type = VLC_VAR_TYPE & var_Type( p_libvlc , psz_var );
300
301     LIBVLC_FUNC_END;
302
303     if( i_type > 0 )
304     {
305         *pi_type = i_type;
306         return VLC_SUCCESS;
307     }
308     return VLC_ENOVAR;
309 }
310
311 #define LIBVLC_PLAYLIST_FUNC \
312     libvlc_int_t *p_libvlc = vlc_current_object( i_object );\
313     if( !p_libvlc ) return VLC_ENOOBJ; \
314     playlist_t *p_playlist = pl_Yield( p_libvlc ); \
315     if( !p_playlist ) return VLC_ENOOBJ
316
317 #define LIBVLC_PLAYLIST_FUNC_END \
318     pl_Release( p_libvlc ); \
319     if( i_object ) vlc_object_release( p_libvlc );
320
321 /*****************************************************************************
322  * VLC_AddTarget: adds a target for playing.
323  *****************************************************************************
324  * This function adds psz_target to the playlist
325  *****************************************************************************/
326
327 int VLC_AddTarget( int i_object, char const *psz_target,
328                    char const **ppsz_options, int i_options,
329                    int i_mode, int i_pos )
330 {
331     int i_err;
332     LIBVLC_PLAYLIST_FUNC;
333     i_err = playlist_AddExt( p_playlist, psz_target,
334                              NULL,  i_mode, i_pos, -1,
335                              ppsz_options, i_options, true, false );
336     LIBVLC_PLAYLIST_FUNC_END;
337     return i_err;
338 }
339
340 /*****************************************************************************
341  * VLC_Play: play the playlist
342  *****************************************************************************/
343 int VLC_Play( int i_object )
344 {
345     LIBVLC_PLAYLIST_FUNC;
346     playlist_Play( p_playlist );
347     LIBVLC_PLAYLIST_FUNC_END;
348     return VLC_SUCCESS;
349 }
350
351 /*****************************************************************************
352  * VLC_Pause: toggle pause
353  *****************************************************************************/
354 int VLC_Pause( int i_object )
355 {
356     LIBVLC_PLAYLIST_FUNC;
357     playlist_Pause( p_playlist );
358     LIBVLC_PLAYLIST_FUNC_END;
359     return VLC_SUCCESS;
360 }
361
362 /*****************************************************************************
363  * VLC_Stop: stop playback
364  *****************************************************************************/
365 int VLC_Stop( int i_object )
366 {
367     LIBVLC_PLAYLIST_FUNC;
368     playlist_Stop( p_playlist );
369     LIBVLC_PLAYLIST_FUNC_END;
370     return VLC_SUCCESS;
371 }
372
373 /*****************************************************************************
374  * VLC_IsPlaying: Query for Playlist Status
375  *****************************************************************************/
376 bool VLC_IsPlaying( int i_object )
377 {
378     bool   b_playing;
379
380     LIBVLC_PLAYLIST_FUNC;
381     if( p_playlist->p_input )
382     {
383         vlc_value_t  val;
384         var_Get( p_playlist->p_input, "state", &val );
385         b_playing = ( val.i_int == PLAYING_S );
386     }
387     else
388     {
389         b_playing = playlist_IsPlaying( p_playlist );
390     }
391     LIBVLC_PLAYLIST_FUNC_END;
392     return b_playing;
393 }
394
395 /**
396  * Get the current position in a input
397  *
398  * Return the current position as a float
399  * \note For some inputs, this will be unknown.
400  *
401  * \param i_object a vlc object id
402  * \return a float in the range of 0.0 - 1.0
403  */
404 float VLC_PositionGet( int i_object )
405 {
406     input_thread_t *p_input;
407     vlc_value_t val;
408     LIBVLC_FUNC;
409
410     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
411
412     if( !p_input )
413     {
414         if( i_object ) vlc_object_release( p_libvlc );
415         return VLC_ENOOBJ;
416     }
417
418     var_Get( p_input, "position", &val );
419     vlc_object_release( p_input );
420
421     LIBVLC_FUNC_END;
422     return val.f_float;
423 }
424
425 /**
426  * Set the current position in a input
427  *
428  * Set the current position in a input and then return
429  * the current position as a float.
430  * \note For some inputs, this will be unknown.
431  *
432  * \param i_object a vlc object id
433  * \param i_position a float in the range of 0.0 - 1.0
434  * \return a float in the range of 0.0 - 1.0
435  */
436 float VLC_PositionSet( int i_object, float i_position )
437 {
438     input_thread_t *p_input;
439     vlc_value_t val;
440     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
441
442     /* Check that the handle is valid */
443     if( !p_libvlc )
444     {
445         return VLC_ENOOBJ;
446     }
447
448     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
449
450     if( !p_input )
451     {
452         if( i_object ) vlc_object_release( p_libvlc );
453         return VLC_ENOOBJ;
454     }
455
456     val.f_float = i_position;
457     var_Set( p_input, "position", val );
458     var_Get( p_input, "position", &val );
459     vlc_object_release( p_input );
460
461     if( i_object ) vlc_object_release( p_libvlc );
462     return val.f_float;
463 }
464
465 /**
466  * Get the current position in a input
467  *
468  * Return the current position in seconds from the start.
469  * \note For some inputs, this will be unknown.
470  *
471  * \param i_object a vlc object id
472  * \return the offset from 0:00 in seconds
473  */
474 int VLC_TimeGet( int i_object )
475 {
476     input_thread_t *p_input;
477     vlc_value_t val;
478     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
479
480     /* Check that the handle is valid */
481     if( !p_libvlc )
482     {
483         return VLC_ENOOBJ;
484     }
485
486     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
487
488     if( !p_input )
489     {
490         if( i_object ) vlc_object_release( p_libvlc );
491         return VLC_ENOOBJ;
492     }
493
494     var_Get( p_input, "time", &val );
495     vlc_object_release( p_input );
496
497     if( i_object ) vlc_object_release( p_libvlc );
498     return val.i_time  / 1000000;
499 }
500
501 /**
502  * Seek to a position in the current input
503  *
504  * Seek i_seconds in the current input. If b_relative is set,
505  * then the seek will be relative to the current position, otherwise
506  * it will seek to i_seconds from the beginning of the input.
507  * \note For some inputs, this will be unknown.
508  *
509  * \param i_object a vlc object id
510  * \param i_seconds seconds from current position or from beginning of input
511  * \param b_relative seek relative from current position
512  * \return VLC_SUCCESS on success
513  */
514 int VLC_TimeSet( int i_object, int i_seconds, bool b_relative )
515 {
516     input_thread_t *p_input;
517     vlc_value_t val;
518     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
519
520     /* Check that the handle is valid */
521     if( !p_libvlc )
522     {
523         return VLC_ENOOBJ;
524     }
525
526     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
527
528     if( !p_input )
529     {
530         if( i_object ) vlc_object_release( p_libvlc );
531         return VLC_ENOOBJ;
532     }
533
534     if( b_relative )
535     {
536         val.i_time = i_seconds;
537         val.i_time = val.i_time * 1000000L;
538         var_Set( p_input, "time-offset", val );
539     }
540     else
541     {
542         val.i_time = i_seconds;
543         val.i_time = val.i_time * 1000000L;
544         var_Set( p_input, "time", val );
545     }
546     vlc_object_release( p_input );
547
548     if( i_object ) vlc_object_release( p_libvlc );
549     return VLC_SUCCESS;
550 }
551
552 /**
553  * Get the total length of a input
554  *
555  * Return the total length in seconds from the current input.
556  * \note For some inputs, this will be unknown.
557  *
558  * \param i_object a vlc object id
559  * \return the length in seconds
560  */
561 int VLC_LengthGet( int i_object )
562 {
563     input_thread_t *p_input;
564     vlc_value_t val;
565     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
566
567     /* Check that the handle is valid */
568     if( !p_libvlc )
569     {
570         return VLC_ENOOBJ;
571     }
572
573     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
574
575     if( !p_input )
576     {
577         if( i_object ) vlc_object_release( p_libvlc );
578         return VLC_ENOOBJ;
579     }
580
581     var_Get( p_input, "length", &val );
582     vlc_object_release( p_input );
583
584     if( i_object ) vlc_object_release( p_libvlc );
585     return val.i_time  / 1000000L;
586 }
587
588 /**
589  * Play the input faster than realtime
590  *
591  * 2x, 4x, 8x faster than realtime
592  * \note For some inputs, this will be impossible.
593  *
594  * \param i_object a vlc object id
595  * \return the current speedrate
596  */
597 float VLC_SpeedFaster( int i_object )
598 {
599     input_thread_t *p_input;
600     vlc_value_t val;
601     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
602
603     /* Check that the handle is valid */
604     if( !p_libvlc )
605     {
606         return VLC_ENOOBJ;
607     }
608
609     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
610
611     if( !p_input )
612     {
613         if( i_object ) vlc_object_release( p_libvlc );
614         return VLC_ENOOBJ;
615     }
616
617     val.b_bool = true;
618     var_Set( p_input, "rate-faster", val );
619     var_Get( p_input, "rate", &val );
620     vlc_object_release( p_input );
621
622     if( i_object ) vlc_object_release( p_libvlc );
623     return val.f_float / INPUT_RATE_DEFAULT;
624 }
625
626 /**
627  * Play the input slower than realtime
628  *
629  * 1/2x, 1/4x, 1/8x slower than realtime
630  * \note For some inputs, this will be impossible.
631  *
632  * \param i_object a vlc object id
633  * \return the current speedrate
634  */
635 float VLC_SpeedSlower( int i_object )
636 {
637     input_thread_t *p_input;
638     vlc_value_t val;
639     libvlc_int_t *p_libvlc = vlc_current_object( i_object );
640
641     /* Check that the handle is valid */
642     if( !p_libvlc )
643     {
644         return VLC_ENOOBJ;
645     }
646
647     p_input = vlc_object_find( p_libvlc, VLC_OBJECT_INPUT, FIND_CHILD );
648
649     if( !p_input )
650     {
651         if( i_object ) vlc_object_release( p_libvlc );
652         return VLC_ENOOBJ;
653     }
654
655     val.b_bool = true;
656     var_Set( p_input, "rate-slower", val );
657     var_Get( p_input, "rate", &val );
658     vlc_object_release( p_input );
659
660     if( i_object ) vlc_object_release( p_libvlc );
661     return val.f_float / INPUT_RATE_DEFAULT;
662 }
663
664 /**
665  * Return the current playlist item
666  *
667  * Returns the index of the playlistitem that is currently selected for play.
668  * This is valid even if nothing is currently playing.
669  *
670  * \param i_object a vlc object id
671  * \return the current index
672  */
673 int VLC_PlaylistIndex( int i_object )
674 {
675     (void)i_object;
676     printf( "This function is deprecated and should not be used anymore" );
677     return -1;
678 }
679
680 /**
681  * Total number of items in the playlist
682  *
683  * \param i_object a vlc object id
684  * \return amount of playlist items
685  */
686 int VLC_PlaylistNumberOfItems( int i_object )
687 {
688     int i_size;
689     LIBVLC_PLAYLIST_FUNC;
690     i_size = p_playlist->items.i_size;
691     LIBVLC_PLAYLIST_FUNC_END;
692     return i_size;
693 }
694
695 /**
696  * Go to next playlist item
697  * \param i_object a vlc object id
698  * \return VLC_SUCCESS on success
699  */
700 int VLC_PlaylistNext( int i_object )
701 {
702     LIBVLC_PLAYLIST_FUNC;
703     playlist_Next( p_playlist );
704     LIBVLC_PLAYLIST_FUNC_END;
705     return VLC_SUCCESS;
706 }
707
708 /**
709  * Go to previous playlist item
710  * \param i_object a vlc object id
711  * \return VLC_SUCCESS on success
712  */
713 int VLC_PlaylistPrev( int i_object )
714 {
715     LIBVLC_PLAYLIST_FUNC;
716     playlist_Prev( p_playlist );
717     LIBVLC_PLAYLIST_FUNC_END;
718     return VLC_SUCCESS;
719 }
720
721 /**
722  * Empty the playlist
723  */
724 int VLC_PlaylistClear( int i_object )
725 {
726     LIBVLC_PLAYLIST_FUNC;
727     playlist_Clear( p_playlist, true );
728     LIBVLC_PLAYLIST_FUNC_END;
729     return VLC_SUCCESS;
730 }
731
732 /**
733  * Change the volume
734  *
735  * \param i_object a vlc object id
736  * \param i_volume something in a range from 0-200
737  * \return the new volume (range 0-200 %)
738  */
739 int VLC_VolumeSet( int i_object, int i_volume )
740 {
741     audio_volume_t i_vol = 0;
742     LIBVLC_FUNC;
743
744     if( i_volume >= 0 && i_volume <= 200 )
745     {
746         i_vol = i_volume * AOUT_VOLUME_MAX / 200;
747         aout_VolumeSet( p_libvlc, i_vol );
748     }
749     LIBVLC_FUNC_END;
750     return i_vol * 200 / AOUT_VOLUME_MAX;
751 }
752
753 /**
754  * Get the current volume
755  *
756  * Retrieve the current volume.
757  *
758  * \param i_object a vlc object id
759  * \return the current volume (range 0-200 %)
760  */
761 int VLC_VolumeGet( int i_object )
762 {
763     audio_volume_t i_volume;
764     LIBVLC_FUNC;
765     aout_VolumeGet( p_libvlc, &i_volume );
766     LIBVLC_FUNC_END;
767     return i_volume*200/AOUT_VOLUME_MAX;
768 }
769
770 /**
771  * Mute/Unmute the volume
772  *
773  * \param i_object a vlc object id
774  * \return VLC_SUCCESS on success
775  */
776 int VLC_VolumeMute( int i_object )
777 {
778     LIBVLC_FUNC;
779     aout_VolumeMute( p_libvlc, NULL );
780     LIBVLC_FUNC_END;
781     return VLC_SUCCESS;
782 }
783
784 /*****************************************************************************
785  * VLC_FullScreen: toggle fullscreen mode
786  *****************************************************************************/
787 int VLC_FullScreen( int i_object )
788 {
789     vout_thread_t *p_vout;
790     LIBVLC_FUNC;
791     p_vout = vlc_object_find( p_libvlc, VLC_OBJECT_VOUT, FIND_CHILD );
792
793     if( !p_vout )
794     {
795         if( i_object ) vlc_object_release( p_libvlc );
796         return VLC_ENOOBJ;
797     }
798
799     p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
800     vlc_object_release( p_vout );
801     LIBVLC_FUNC_END;
802     return VLC_SUCCESS;
803 }