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