[vlc-commits] [Git][videolan/vlc][master] 3 commits: player: use double for a, b positions
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 11 15:51:24 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
11220f7a by Thomas Guillem at 2024-10-11T15:37:49+00:00
player: use double for a, b positions
- - - - -
f0f374be by Thomas Guillem at 2024-10-11T15:37:49+00:00
core: export vlc_player_GetAtoBLoop
- - - - -
82df5e7f by Thomas Guillem at 2024-10-11T15:37:49+00:00
lib: media_player: add AB loop API
- - - - -
6 changed files:
- include/vlc/libvlc_media_player.h
- include/vlc_player.h
- lib/libvlc.sym
- lib/media_player.c
- src/libvlccore.sym
- src/player/player.c
Changes:
=====================================
include/vlc/libvlc_media_player.h
=====================================
@@ -171,6 +171,15 @@ typedef enum libvlc_teletext_key_t {
libvlc_teletext_key_index = 'i' << 16,
} libvlc_teletext_key_t;
+/**
+ * A to B loop state
+ */
+typedef enum libvlc_abloop_t {
+ libvlc_abloop_none,
+ libvlc_abloop_a,
+ libvlc_abloop_b,
+} libvlc_abloop_t;
+
/**
* Opaque equalizer handle.
*
@@ -1307,6 +1316,45 @@ LIBVLC_API double libvlc_media_player_get_position( libvlc_media_player_t *p_mi
LIBVLC_API int libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
double f_pos, bool b_fast );
+/**
+ * Enable A to B loop for the current media
+ *
+ * This function need to be called 2 times with libvlc_abloop_a and
+ * libvlc_abloop_b to setup an A to B loop. It uses and stores the
+ * current time/position when called. The B time must be higher than the
+ * A time.
+ *
+ * \param p_mi the Media Player
+ * \param abloop select which A/B cursor to set
+ * \return 0 on success, -1 on error
+ * \version LibVLC 4.0.0 and later.
+ */
+LIBVLC_API int
+libvlc_media_player_set_abloop( libvlc_media_player_t *p_mi,
+ libvlc_abloop_t abloop );
+
+/**
+ * Get the A to B loop status
+ *
+ * @note If the returned status is VLC_PLAYER_ABLOOP_A, then a_time and a_pos
+ * will be valid. If the returned status is VLC_PLAYER_ABLOOP_B, then all
+ * output parameters are valid. If the returned status is
+ * VLC_PLAYER_ABLOOP_NONE, then all output parameters are invalid.
+ *
+ * @see vlc_player_cbs.on_atobloop_changed
+ *
+ * \param p_mi the Media Player
+ * \param a_time A time (in ms) or -1 (if the media doesn't have valid times)
+ * \param a_pos A position
+ * \param b_time B time (in ms) or -1 (if the media doesn't have valid times)
+ * \param b_pos B position
+ * \return A to B loop status
+ * \version LibVLC 4.0.0 and later.
+ */
+LIBVLC_API libvlc_abloop_t
+libvlc_media_player_get_abloop( libvlc_media_player_t *p_mi,
+ libvlc_time_t *a_time, double *a_pos,
+ libvlc_time_t *b_time, double *b_pos );
/**
* Set movie chapter (if applicable).
*
=====================================
include/vlc_player.h
=====================================
@@ -787,8 +787,8 @@ vlc_player_SetAtoBLoop(vlc_player_t *player, enum vlc_player_abloop abloop);
* @return A to B loop status
*/
VLC_API enum vlc_player_abloop
-vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, float *a_pos,
- vlc_tick_t *b_time, float *b_pos);
+vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, double *a_pos,
+ vlc_tick_t *b_time, double *b_pos);
/**
* Navigate (for DVD/Bluray menus or viewpoint)
=====================================
lib/libvlc.sym
=====================================
@@ -187,6 +187,8 @@ libvlc_media_player_select_track
libvlc_media_player_unselect_track_type
libvlc_media_player_select_tracks
libvlc_media_player_select_tracks_by_ids
+libvlc_media_player_set_abloop
+libvlc_media_player_get_abloop
libvlc_player_program_delete
libvlc_player_programlist_count
libvlc_player_programlist_at
=====================================
lib/media_player.c
=====================================
@@ -1400,6 +1400,42 @@ double libvlc_media_player_get_position( libvlc_media_player_t *p_mi )
return f_position;
}
+int
+libvlc_media_player_set_abloop( libvlc_media_player_t *p_mi,
+ libvlc_abloop_t abloop )
+{
+ vlc_player_t *player = p_mi->player;
+ vlc_player_Lock(player);
+
+ int ret = vlc_player_SetAtoBLoop(player, (int) abloop);
+
+ vlc_player_Unlock(player);
+ return ret;
+}
+
+libvlc_abloop_t
+libvlc_media_player_get_abloop( libvlc_media_player_t *p_mi,
+ libvlc_time_t *a_time, double *a_pos,
+ libvlc_time_t *b_time, double *b_pos )
+{
+ vlc_player_t *player = p_mi->player;
+ vlc_player_Lock(player);
+
+ vlc_tick_t a_ticks, b_ticks;
+ int ret = vlc_player_GetAtoBLoop(player, &a_ticks, a_pos, &b_ticks, b_pos);
+
+ vlc_player_Unlock(player);
+
+ if (a_time != NULL)
+ *a_time = a_ticks == VLC_TICK_INVALID ? -1 :
+ libvlc_time_from_vlc_tick(a_ticks);
+ if (b_time != NULL)
+ *b_time = b_ticks == VLC_TICK_INVALID ? -1 :
+ libvlc_time_from_vlc_tick(b_ticks);
+
+ return ret;
+}
+
void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi,
int chapter )
{
@@ -2421,3 +2457,10 @@ static_assert(libvlc_video_primaries_BT601_525 == (cast_)COLOR_PRIMARIES_BT601_5
libvlc_video_primaries_BT470_M == (cast_)COLOR_PRIMARIES_BT470_M
, "libvlc video color primaries mismatch");
#undef cast_
+
+#define cast_ libvlc_abloop_t
+static_assert(libvlc_abloop_none == (cast_) VLC_PLAYER_ABLOOP_NONE &&
+ libvlc_abloop_a == (cast_) VLC_PLAYER_ABLOOP_A &&
+ libvlc_abloop_b == (cast_) VLC_PLAYER_ABLOOP_B
+ , "libvlc abloop mismatch");
+#undef cast_
=====================================
src/libvlccore.sym
=====================================
@@ -926,6 +926,7 @@ vlc_player_SelectTitleIdx
vlc_player_SelectTracksByStringIds
vlc_player_SetAssociatedSubsFPS
vlc_player_SetAtoBLoop
+vlc_player_GetAtoBLoop
vlc_player_SetCategoryDelay
vlc_player_SetCurrentMedia
vlc_player_SetNextMedia
=====================================
src/player/player.c
=====================================
@@ -1514,8 +1514,8 @@ vlc_player_SetAtoBLoop(vlc_player_t *player, enum vlc_player_abloop abloop)
}
enum vlc_player_abloop
-vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, float *a_pos,
- vlc_tick_t *b_time, float *b_pos)
+vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, double *a_pos,
+ vlc_tick_t *b_time, double *b_pos)
{
struct vlc_player_input *input = vlc_player_get_input_locked(player);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e32174b38709288e07b6e1e6e71994a96e186731...82df5e7f237329cfbeb9ee336a6cf61dc4700469
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e32174b38709288e07b6e1e6e71994a96e186731...82df5e7f237329cfbeb9ee336a6cf61dc4700469
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