mirror of https://code.videolan.org/videolan/vlc
added in libvlc:
- simple screenshot function - an helper function to check if the input item is playing
This commit is contained in:
parent
80ba0c2698
commit
54b0c48d2f
|
@ -268,6 +268,8 @@ void libvlc_input_free( libvlc_input_t * );
|
|||
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 *);
|
||||
float libvlc_input_get_position( libvlc_input_t *, libvlc_exception_t *);
|
||||
vlc_bool_t libvlc_input_will_play( libvlc_input_t *, libvlc_exception_t *);
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
@ -301,6 +303,10 @@ void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
|
|||
*/
|
||||
int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
|
||||
|
||||
|
||||
void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,3 +112,32 @@ float libvlc_input_get_position( libvlc_input_t *p_input,
|
|||
|
||||
return val.f_float;
|
||||
}
|
||||
|
||||
vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input,
|
||||
libvlc_exception_t *p_exception)
|
||||
{
|
||||
|
||||
input_thread_t *p_input_thread;
|
||||
vlc_value_t val;
|
||||
|
||||
if( !p_input )
|
||||
{
|
||||
libvlc_exception_raise( p_exception, "Input is NULL" );
|
||||
return VLC_FALSE;
|
||||
}
|
||||
|
||||
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 VLC_FALSE;
|
||||
}
|
||||
|
||||
if ( !p_input_thread->b_die && !p_input_thread->b_dead )
|
||||
return VLC_TRUE;
|
||||
|
||||
return VLC_FALSE;
|
||||
}
|
||||
|
|
|
@ -123,3 +123,38 @@ void libvlc_toggle_fullscreen( libvlc_input_t *p_input,
|
|||
libvlc_exception_raise( p_e,
|
||||
"Unexpected error while setting fullscreen value" );
|
||||
}
|
||||
|
||||
void
|
||||
libvlc_video_take_snapshot( libvlc_input_t *p_input, char *filepath,
|
||||
libvlc_exception_t *p_e )
|
||||
{
|
||||
vout_thread_t *p_vout = GetVout( p_input, p_e );
|
||||
input_thread_t *p_input_thread;
|
||||
|
||||
char path[256];
|
||||
|
||||
/* GetVout will raise the exception for us */
|
||||
if( !p_vout )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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_e, "Input does not exist" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
snprintf( path, 255, "%s", filepath );
|
||||
var_SetString( p_vout, "snapshot-path", path );
|
||||
var_SetString( p_vout, "snapshot-format", "png" );
|
||||
|
||||
vout_Control( p_vout, VOUT_SNAPSHOT );
|
||||
vlc_object_release( p_vout );
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue