Commit 671f0b24 authored by Olivier Aubert's avatar Olivier Aubert

include/vlc/mediacontrol.h, src/control/mediacontrol_audio_video.c: implement...

include/vlc/mediacontrol.h, src/control/mediacontrol_audio_video.c: implement get_/set_rate and get_/set_fullscreen
parent e1cc961b
......@@ -192,6 +192,21 @@ vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
WINDOWHANDLE visual_id,
mediacontrol_Exception *exception );
/* Rate in percent. 100 is normal rate. */
int mediacontrol_get_rate( mediacontrol_Instance *self,
mediacontrol_Exception *exception );
void mediacontrol_set_rate( mediacontrol_Instance *self,
const int rate,
mediacontrol_Exception *exception );
int mediacontrol_get_fullscreen( mediacontrol_Instance *self,
mediacontrol_Exception *exception );
void mediacontrol_set_fullscreen( mediacontrol_Instance *self,
const int b_fullscreen,
mediacontrol_Exception *exception );
# ifdef __cplusplus
}
# endif
......
......@@ -287,3 +287,93 @@ vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
return (ret == VLC_SUCCESS);
}
int
mediacontrol_get_rate( mediacontrol_Instance *self,
mediacontrol_Exception *exception )
{
int retval;
input_thread_t *p_input = NULL;
p_input = self->p_playlist->p_input;
if( ! p_input )
{
RAISE( mediacontrol_InternalException, "No input" );
return 0;
}
retval = var_GetInteger(p_input, "rate") / 10;
return retval;
}
void
mediacontrol_set_rate( mediacontrol_Instance *self,
const int rate,
mediacontrol_Exception *exception )
{
input_thread_t *p_input = NULL;
p_input = self->p_playlist->p_input;
if( ! p_input )
{
RAISE( mediacontrol_InternalException, "No input" );
return;
}
var_SetInteger(p_input, "rate", rate * 10);
return;
}
int
mediacontrol_get_fullscreen( mediacontrol_Instance *self,
mediacontrol_Exception *exception )
{
vout_thread_t *p_vout = NULL;
vlc_value_t val;
int i_ret;
p_vout = vlc_object_find( self->p_playlist, VLC_OBJECT_VOUT, FIND_CHILD );
if( ! p_vout )
{
RAISE( mediacontrol_InternalException, "no video output" );
return 0;
}
i_ret = var_Get( p_vout, "fullscreen", &val );
vlc_object_release( p_vout );
if( i_ret )
{
RAISE( mediacontrol_InternalException, "Unexpected error while looking up fullscreen value" );
return 0;
}
return val.b_bool == VLC_TRUE ? 1 : 0;
}
void
mediacontrol_set_fullscreen( mediacontrol_Instance *self,
const int b_fullscreen,
mediacontrol_Exception *exception )
{
vout_thread_t *p_vout = NULL;
vlc_value_t val;
int i_ret;
p_vout = vlc_object_find( self->p_playlist, VLC_OBJECT_VOUT, FIND_CHILD );
if( ! p_vout )
{
RAISE( mediacontrol_InternalException, "no video output" );
return;
}
if( b_fullscreen ) val.b_bool = VLC_TRUE;
else val.b_bool = VLC_FALSE;
i_ret = var_Set( p_vout, "fullscreen", val );
vlc_object_release( p_vout );
if( i_ret )
{
RAISE( mediacontrol_InternalException, "Unexpected error while setting fullscreen value" );
return;
}
return;
}
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