1 /*****************************************************************************
2 * video.c: ibvlc new API video functions
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
5 * $Id: core.c 14187 2006-02-07 16:37:40Z courmisch $
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include <libvlc_internal.h>
25 #include <vlc/libvlc.h>
30 static vout_thread_t *GetVout( libvlc_input_t *p_input,
31 libvlc_exception_t *p_exception )
33 input_thread_t *p_input_thread;
34 vout_thread_t *p_vout;
38 libvlc_exception_raise( p_exception, "Input is NULL" );
42 p_input_thread = (input_thread_t*)vlc_object_get(
43 p_input->p_instance->p_vlc,
44 p_input->i_input_id );
47 libvlc_exception_raise( p_exception, "Input does not exist" );
51 p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD );
54 libvlc_exception_raise( p_exception, "No active video output" );
59 /**********************************************************************
61 **********************************************************************/
63 void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen,
64 libvlc_exception_t *p_e )
66 /* We only work on the first vout */
67 vout_thread_t *p_vout1 = GetVout( p_input, p_e );
68 vlc_value_t val; int i_ret;
70 /* GetVout will raise the exception for us */
73 fprintf( stderr, "No vout\n");
77 if( b_fullscreen ) val.b_bool = VLC_TRUE;
78 else val.b_bool = VLC_FALSE;
80 var_Set( p_vout1, "fullscreen", val );
82 libvlc_exception_raise( p_e,
83 "Unexpected error while setting fullscreen value" );
86 int libvlc_get_fullscreen( libvlc_input_t *p_input,
87 libvlc_exception_t *p_e )
89 /* We only work on the first vout */
90 vout_thread_t *p_vout1 = GetVout( p_input, p_e );
91 vlc_value_t val; int i_ret;
93 /* GetVout will raise the exception for us */
97 i_ret = var_Get( p_vout1, "fullscreen", &val );
99 libvlc_exception_raise( p_e,
100 "Unexpected error while looking up fullscreen value" );
102 return val.b_bool == VLC_TRUE ? 1 : 0;
105 void libvlc_toggle_fullscreen( libvlc_input_t *p_input,
106 libvlc_exception_t *p_e )
108 /* We only work on the first vout */
109 vout_thread_t *p_vout1 = GetVout( p_input, p_e );
110 vlc_value_t val; int i_ret;
112 /* GetVout will raise the exception for us */
116 i_ret = var_Get( p_vout1, "fullscreen", &val );
118 libvlc_exception_raise( p_e,
119 "Unexpected error while looking up fullscreen value" );
121 val.b_bool = !val.b_bool;
122 i_ret = var_Set( p_vout1, "fullscreen", val );
124 libvlc_exception_raise( p_e,
125 "Unexpected error while setting fullscreen value" );