Commit 2f6ad030 authored by Clément Stenac's avatar Clément Stenac

* get/set/toggle fullscreen

* Fix a bug in playlist_play

(Refs:#457)
parent de11230f
...@@ -476,6 +476,7 @@ SOURCES_libvlc_common = \ ...@@ -476,6 +476,7 @@ SOURCES_libvlc_common = \
src/control/core.c \ src/control/core.c \
src/control/playlist.c \ src/control/playlist.c \
src/control/input.c \ src/control/input.c \
src/control/video.c \
src/control/mediacontrol_core.c \ src/control/mediacontrol_core.c \
src/control/mediacontrol_util.c \ src/control/mediacontrol_util.c \
src/control/mediacontrol_audio_video.c \ src/control/mediacontrol_audio_video.c \
......
...@@ -229,6 +229,10 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *, libvlc_exception_t *); ...@@ -229,6 +229,10 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *, libvlc_exception_t *);
vlc_int64_t libvlc_input_get_time( libvlc_input_t *, libvlc_exception_t *); vlc_int64_t libvlc_input_get_time( libvlc_input_t *, libvlc_exception_t *);
float libvlc_input_get_position( libvlc_input_t *, libvlc_exception_t *); float libvlc_input_get_position( libvlc_input_t *, libvlc_exception_t *);
void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * );
/** @} */ /** @} */
......
...@@ -37,7 +37,7 @@ void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id, ...@@ -37,7 +37,7 @@ void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id,
libvlc_exception_raise( p_exception, "Empty playlist" ); libvlc_exception_raise( p_exception, "Empty playlist" );
return; return;
} }
if( i_id >= 0 ) if( i_id > 0 )
{ {
/* Always use the current view when using libvlc */ /* Always use the current view when using libvlc */
playlist_view_t *p_view; playlist_view_t *p_view;
......
/*****************************************************************************
* video.c: ibvlc new API video functions
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id: core.c 14187 2006-02-07 16:37:40Z courmisch $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <libvlc_internal.h>
#include <vlc/libvlc.h>
#include <vlc/vout.h>
#include <vlc/intf.h>
static vout_thread_t *GetVout( libvlc_input_t *p_input,
libvlc_exception_t *p_exception )
{
input_thread_t *p_input_thread;
vout_thread_t *p_vout;
if( !p_input )
{
libvlc_exception_raise( p_exception, "Input is NULL" );
return NULL;
}
p_input_thread = (input_thread_t*)vlc_object_get(
p_input->p_instance->p_vlc,
p_input->i_input_id );
if( !p_input_thread )
{
libvlc_exception_raise( p_exception, "Input does not exist" );
return NULL;
}
p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD );
if( !p_vout )
{
libvlc_exception_raise( p_exception, "No active video output" );
return NULL;
}
return p_vout;
}
/**********************************************************************
* Exported functions
**********************************************************************/
void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen,
libvlc_exception_t *p_e )
{
/* We only work on the first vout */
vout_thread_t *p_vout1 = GetVout( p_input, p_e );
vlc_value_t val; int i_ret;
/* GetVout will raise the exception for us */
if( !p_vout1 )
{
fprintf( stderr, "No vout\n");
return;
}
if( b_fullscreen ) val.b_bool = VLC_TRUE;
else val.b_bool = VLC_FALSE;
var_Set( p_vout1, "fullscreen", val );
if( i_ret )
libvlc_exception_raise( p_e,
"Unexpected error while setting fullscreen value" );
}
int libvlc_get_fullscreen( libvlc_input_t *p_input,
libvlc_exception_t *p_e )
{
/* We only work on the first vout */
vout_thread_t *p_vout1 = GetVout( p_input, p_e );
vlc_value_t val; int i_ret;
/* GetVout will raise the exception for us */
if( !p_vout1 )
return 0;
i_ret = var_Get( p_vout1, "fullscreen", &val );
if( i_ret )
libvlc_exception_raise( p_e,
"Unexpected error while looking up fullscreen value" );
return val.b_bool == VLC_TRUE ? 1 : 0;
}
void libvlc_toggle_fullscreen( libvlc_input_t *p_input,
libvlc_exception_t *p_e )
{
/* We only work on the first vout */
vout_thread_t *p_vout1 = GetVout( p_input, p_e );
vlc_value_t val; int i_ret;
/* GetVout will raise the exception for us */
if( !p_vout1 )
return;
i_ret = var_Get( p_vout1, "fullscreen", &val );
if( i_ret )
libvlc_exception_raise( p_e,
"Unexpected error while looking up fullscreen value" );
val.b_bool = !val.b_bool;
i_ret = var_Set( p_vout1, "fullscreen", val );
if( i_ret )
libvlc_exception_raise( p_e,
"Unexpected error while setting fullscreen value" );
}
...@@ -20,7 +20,9 @@ int main(int argc, char **argv) ...@@ -20,7 +20,9 @@ int main(int argc, char **argv)
return 0; return 0;
} }
libvlc_playlist_play( p_instance1, 0,NULL, NULL ); fprintf (stderr, "Playing\n");
libvlc_playlist_play( p_instance1, 0, 0,NULL, NULL );
fprintf (stderr, "Playback started\n");
while( 1 ) while( 1 )
{ {
...@@ -39,10 +41,16 @@ int main(int argc, char **argv) ...@@ -39,10 +41,16 @@ int main(int argc, char **argv)
{ {
b_started = 1; b_started = 1;
} }
fprintf( stderr, "Length %lli - Time %lli\n", libvlc_toggle_fullscreen( p_input, &exception );
if( libvlc_exception_raised( &exception ) )
{
fprintf( stderr, "EX : %s\n", libvlc_exception_get_message( &exception ) );
}
fprintf( stderr, "Length %lli - Time %lli - Full screen %i\n",
libvlc_input_get_length( p_input, NULL ), libvlc_input_get_length( p_input, NULL ),
libvlc_input_get_time( p_input, NULL ) ); libvlc_input_get_time( p_input, NULL ),
libvlc_get_fullscreen( p_input, NULL ) );
libvlc_input_free( p_input ); libvlc_input_free( p_input );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment