VLC 4.0.0-dev
Collaboration diagram for Player timer:

Data Structures

struct  vlc_player_timer_point
 Player timer point. More...
 
struct  vlc_player_timer_smpte_timecode
 Player smpte timecode. More...
 
struct  vlc_player_timer_cbs
 Player timer callbacks. More...
 
struct  vlc_player_timer_smpte_cbs
 Player smpte timer callbacks. More...
 

Typedefs

typedef struct vlc_player_timer_id vlc_player_timer_id
 Player timer opaque structure. More...
 

Functions

vlc_player_timer_idvlc_player_AddTimer (vlc_player_t *player, vlc_tick_t min_period, const struct vlc_player_timer_cbs *cbs, void *cbs_data)
 Add a timer in order to get times updates. More...
 
vlc_player_timer_idvlc_player_AddSmpteTimer (vlc_player_t *player, const struct vlc_player_timer_smpte_cbs *cbs, void *cbs_data)
 Add a smpte timer in order to get accurate video frame updates. More...
 
void vlc_player_RemoveTimer (vlc_player_t *player, vlc_player_timer_id *timer)
 Remove a player timer. More...
 
int vlc_player_timer_point_Interpolate (const struct vlc_player_timer_point *point, vlc_tick_t system_now, vlc_tick_t *out_ts, double *out_pos)
 Interpolate the last timer value to now. More...
 
vlc_tick_t vlc_player_timer_point_GetNextIntervalDate (const struct vlc_player_timer_point *point, vlc_tick_t system_now, vlc_tick_t interpolated_ts, vlc_tick_t next_interval)
 Get the date of the next interval. More...
 

Detailed Description

Typedef Documentation

◆ vlc_player_timer_id

Player timer opaque structure.

Function Documentation

◆ vlc_player_AddSmpteTimer()

vlc_player_timer_id * vlc_player_AddSmpteTimer ( vlc_player_t player,
const struct vlc_player_timer_smpte_cbs cbs,
void *  cbs_data 
)

Add a smpte timer in order to get accurate video frame updates.

Parameters
playerplayer instance (locked or not)
cbspointer to a vlc_player_timer_smpte_cbs structure, the structure must be valid during the lifetime of the player
cbs_dataopaque pointer used by the callbacks
Returns
a valid vlc_player_timer_id or NULL in case of memory allocation error

References vlc_player_timer_id::cbs, vlc_player_timer_id::data, vlc_player_timer_id::last_update_date, vlc_player_timer::lock, vlc_player_timer_id::node, vlc_player_timer_cbs::on_update, vlc_player_timer_id::period, vlc_player_timer_id::smpte_cbs, vlc_player_t::timer, vlc_list_append(), vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_TICK_INVALID.

◆ vlc_player_AddTimer()

vlc_player_timer_id * vlc_player_AddTimer ( vlc_player_t player,
vlc_tick_t  min_period,
const struct vlc_player_timer_cbs cbs,
void *  cbs_data 
)

Add a timer in order to get times updates.

Parameters
playerplayer instance (locked or not)
min_periodcorresponds to the minimum period between each updates, use it to avoid flood from too many source updates, set it to VLC_TICK_INVALID to receive all updates.
cbspointer to a vlc_player_timer_cbs structure, the structure must be valid during the lifetime of the player
cbs_dataopaque pointer used by the callbacks
Returns
a valid vlc_player_timer_id or NULL in case of memory allocation error

References vlc_player_timer_id::cbs, vlc_player_timer_id::data, vlc_player_timer_id::last_update_date, vlc_player_timer::lock, vlc_player_timer_id::node, vlc_player_timer_cbs::on_update, vlc_player_timer_id::period, vlc_player_t::timer, vlc_list_append(), vlc_mutex_lock(), vlc_mutex_unlock(), VLC_TICK_0, and VLC_TICK_INVALID.

◆ vlc_player_RemoveTimer()

void vlc_player_RemoveTimer ( vlc_player_t player,
vlc_player_timer_id timer 
)

Remove a player timer.

Parameters
playerplayer instance (locked or not)
timertimer created by vlc_player_AddTimer()

References vlc_player_timer::lock, vlc_player_timer_id::node, vlc_player_t::timer, vlc_list_remove(), vlc_mutex_lock(), and vlc_mutex_unlock().

◆ vlc_player_timer_point_GetNextIntervalDate()

vlc_tick_t vlc_player_timer_point_GetNextIntervalDate ( const struct vlc_player_timer_point point,
vlc_tick_t  system_now,
vlc_tick_t  interpolated_ts,
vlc_tick_t  next_interval 
)

Get the date of the next interval.

Can be used to setup an UI timer in order to update some widgets at specific interval. A next_interval of VLC_TICK_FROM_SEC(1) can be used to update a time widget when the media reaches a new second.

Note
The media time doesn't necessarily correspond to the system time, that is why this function is needed and use the rate of the current point.
Parameters
pointtime update obtained via the vlc_player_timer_cbs.on_update()
system_nowcurrent system date
interpolated_tsts returned by vlc_player_timer_point_Interpolate() with the same system now
next_intervalnext interval
Returns
the absolute system date of the next interval

References vlc_player_timer_point::rate, and VLC_TICK_INVALID.

◆ vlc_player_timer_point_Interpolate()

int vlc_player_timer_point_Interpolate ( const struct vlc_player_timer_point point,
vlc_tick_t  system_now,
vlc_tick_t out_ts,
double *  out_pos 
)

Interpolate the last timer value to now.

Parameters
pointtime update obtained via the vlc_player_timer_cbs.on_update() callback
system_nowcurrent system date
out_tspointer where to set the interpolated ts, subtract this time with VLC_TICK_0 to get the original value.
out_pospointer where to set the interpolated position
Returns
VLC_SUCCESS in case of success, an error in the interpolated ts is negative (could happen during the buffering step)

References vlc_player_timer_point::length, vlc_player_timer_point::position, vlc_player_timer_point::rate, vlc_player_timer_point::system_date, vlc_player_timer_point::ts, unlikely, VLC_EGENERIC, VLC_SUCCESS, VLC_TICK_0, VLC_TICK_INVALID, and VLC_TICK_MAX.

Referenced by vlc_player_GetTimerPoint().