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