[vlc-commits] [Git][videolan/vlc][master] 3 commits: player: update timer documentation
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Oct 5 06:57:19 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
91512de7 by Thomas Guillem at 2024-10-05T06:42:38+00:00
player: update timer documentation
- - - - -
fbe3425a by Thomas Guillem at 2024-10-05T06:42:38+00:00
libvlc: remove stray comment
- - - - -
c9d605b2 by Thomas Guillem at 2024-10-05T06:42:38+00:00
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.
- - - - -
4 changed files:
- include/vlc/libvlc_media_player.h
- include/vlc_player.h
- lib/media_player.c
- lib/media_player_internal.h
Changes:
=====================================
include/vlc/libvlc_media_player.h
=====================================
@@ -2974,8 +2974,9 @@ 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
- * value.system_date_us = INT64_MAX in that case
* \param data opaque pointer set by libvlc_media_player_watch_time()
*/
typedef void (*libvlc_media_player_watch_time_on_seek)(
=====================================
include/vlc_player.h
=====================================
@@ -3387,8 +3387,11 @@ struct vlc_player_timer_cbs
* @warning The player is not locked from this callback. It is forbidden
* to call any player functions from here.
*
+ * @note on_update() can be called when seeking. It corresponds to tracks
+ * updating their points prior to receiving the asynchronous seek event.
+ * The user could discard them manually.
+ *
* @param value point of the seek request or NULL when seeking is finished
- * value.system_date = VLC_TICK_MAX in that case
* @param data opaque pointer set by vlc_player_AddTimer()
*/
void (*on_seek)(const struct vlc_player_timer_point *value, void *data);
=====================================
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);
=====================================
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;
};
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7c717a464bae2afd70200f5f2f8fee70706f3646...c9d605b22b45c882fa363ed7685acda1993cf60c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7c717a464bae2afd70200f5f2f8fee70706f3646...c9d605b22b45c882fa363ed7685acda1993cf60c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list