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