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