VLC 4.0.0-dev
Loading...
Searching...
No Matches
LibVLC media player time watch API
Collaboration diagram for LibVLC media player time watch API:

Data Structures

struct  libvlc_media_player_time_point_t
 Media Player timer point. More...
struct  libvlc_media_player_watch_time_cbs
 struct defining callbacks for libvlc_media_player_watch_time() More...

Typedefs

typedef struct libvlc_media_player_time_point_t libvlc_media_player_time_point_t
 Media Player timer point.

Functions

LIBVLC_API int libvlc_media_player_watch_time (libvlc_media_player_t *p_mi, libvlc_time_t min_period_us, const struct libvlc_media_player_watch_time_cbs *cbs, void *cbs_opaque)
 Watch for times updates.
LIBVLC_API void libvlc_media_player_unwatch_time (libvlc_media_player_t *p_mi)
 Unwatch time updates.
LIBVLC_API int libvlc_media_player_time_point_interpolate (const libvlc_media_player_time_point_t *point, libvlc_time_t system_now_us, libvlc_time_t *out_ts_us, double *out_pos)
 Interpolate a timer value to now.
LIBVLC_API libvlc_time_t libvlc_media_player_time_point_get_next_date (const libvlc_media_player_time_point_t *point, libvlc_time_t system_now_us, libvlc_time_t interpolated_ts_us, libvlc_time_t next_interval_us)
 Get the date of the next interval.

Detailed Description

Typedef Documentation

◆ libvlc_media_player_time_point_t

typedef struct libvlc_media_player_time_point_t libvlc_media_player_time_point_t

Media Player timer point.

Note
ts and system_date values should not be used directly by the user. libvlc_media_player_time_point_interpolate() will read these values and return an interpolated ts.
See also
libvlc_media_player_watch_time_on_update

Function Documentation

◆ libvlc_media_player_time_point_get_next_date()

LIBVLC_API libvlc_time_t libvlc_media_player_time_point_get_next_date ( const libvlc_media_player_time_point_t * point,
libvlc_time_t system_now_us,
libvlc_time_t interpolated_ts_us,
libvlc_time_t next_interval_us )

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 uses the rate of the current point.
Parameters
pointtime update obtained via the libvlc_media_player_watch_time_on_update()
system_now_ussame system date used by libvlc_media_player_time_point_interpolate()
interpolated_ts_usts returned by libvlc_media_player_time_point_interpolate()
next_interval_usnext interval, in us
Returns
the absolute system date, in us, of the next interval, use libvlc_delay() to get a relative delay.
Version
LibVLC 4.0.0 or later

◆ libvlc_media_player_time_point_interpolate()

LIBVLC_API int libvlc_media_player_time_point_interpolate ( const libvlc_media_player_time_point_t * point,
libvlc_time_t system_now_us,
libvlc_time_t * out_ts_us,
double * out_pos )

Interpolate a timer value to now.

Parameters
pointtime update obtained via the libvlc_media_player_watch_time_on_update() callback
system_now_uscurrent system date, in us, returned by libvlc_clock()
out_ts_uspointer where to set the interpolated ts, in us
out_pospointer where to set the interpolated position
Returns
0 in case of success, -1 if the interpolated ts is negative (could happen during the buffering step)
Version
LibVLC 4.0.0 or later

References LIBVLC_API.

◆ libvlc_media_player_unwatch_time()

LIBVLC_API void libvlc_media_player_unwatch_time ( libvlc_media_player_t * p_mi)

Unwatch time updates.

Parameters
p_mithe media player
Version
LibVLC 4.0.0 or later

References LIBVLC_API.

◆ libvlc_media_player_watch_time()

LIBVLC_API int libvlc_media_player_watch_time ( libvlc_media_player_t * p_mi,
libvlc_time_t min_period_us,
const struct libvlc_media_player_watch_time_cbs * cbs,
void * cbs_opaque )

Watch for times updates.

Warning
Only one watcher can be registered at a time. Calling this function a second time (if libvlc_media_player_unwatch_time() was not called in-between) will fail.
Parameters
p_mithe media player
min_period_uscorresponds to the minimum period, in us, between each updates, use it to avoid flood from too many source updates, set it to 0 to receive all updates.
cbscallback to listen to events (can't be NULL). The pointed struct must be kept alive (and not modified) by the caller until libvlc_media_player_unwatch_time() is called.
cbs_opaqueopaque pointer used by the callbacks
Returns
0 on success, -1 on error (allocation error, or if already watching)
Version
LibVLC 4.0.0 or later

References LIBVLC_API.