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