Browse Source

libvlc: player: watch: prevent normal update while seeking

The behavior is different from the CORE, but I don't see any use case for
receiving points prior to the seek request while seeking. It is possible
from the core, but no UI is doing it for now.
pull/170/head
Thomas Guillem 2 years ago
committed by Steve Lhomme
parent
commit
c9d605b22b
  1. 2
      include/vlc/libvlc_media_player.h
  2. 8
      lib/media_player.c
  3. 1
      lib/media_player_internal.h

2
include/vlc/libvlc_media_player.h

@ -2974,6 +2974,8 @@ typedef void (*libvlc_media_player_watch_time_on_paused)(
*
* \warning It is forbidden to call any Media Player functions from here.
*
* \note It is not possible to receive points via on_update() while seeking.
*
* \param value point of the seek request or NULL when seeking is finished
* \param data opaque pointer set by libvlc_media_player_watch_time()
*/

8
lib/media_player.c

@ -2262,6 +2262,9 @@ static void player_timer_on_update(const struct vlc_player_timer_point *point,
{
libvlc_media_player_t *p_mi = data;
if (p_mi->timer.seeking)
return;
const libvlc_media_player_time_point_t libpoint = PLAYER_TIME_CORE_TO_LIB(point);
p_mi->timer.on_update(&libpoint, p_mi->timer.cbs_data);
@ -2289,9 +2292,13 @@ static void player_timer_on_seek(const struct vlc_player_timer_point *point,
{
const libvlc_media_player_time_point_t libpoint = PLAYER_TIME_CORE_TO_LIB(point);
p_mi->timer.on_seek(&libpoint, p_mi->timer.cbs_data);
p_mi->timer.seeking = true;
}
else
{
p_mi->timer.on_seek(NULL, p_mi->timer.cbs_data);
p_mi->timer.seeking = false;
}
}
int
@ -2325,6 +2332,7 @@ libvlc_media_player_watch_time(libvlc_media_player_t *p_mi,
p_mi->timer.on_paused = on_paused;
p_mi->timer.on_seek = on_seek;
p_mi->timer.cbs_data = cbs_data;
p_mi->timer.seeking = false;
p_mi->timer.id = vlc_player_AddTimer(player, VLC_TICK_FROM_US(min_period_us),
&player_timer_cbs, p_mi);

1
lib/media_player_internal.h

@ -53,6 +53,7 @@ struct libvlc_media_player_t
libvlc_media_player_watch_time_on_paused on_paused;
libvlc_media_player_watch_time_on_seek on_seek;
void *cbs_data;
bool seeking;
} timer;
};

Loading…
Cancel
Save