[vlc-commits] player: remove subtitle sync API
Thomas Guillem
git at videolan.org
Thu Jun 20 08:59:21 CEST 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jun 18 11:06:28 2019 +0200| [b400bf9e850a26ce737d9f78623b95cb1a1d29f3] | committer: Thomas Guillem
player: remove subtitle sync API
It was only used by hotkeys that has now its own implementation.
This API is too confusing and hard to mantain, specially with the dual track
support comming.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b400bf9e850a26ce737d9f78623b95cb1a1d29f3
---
include/vlc_player.h | 33 -------------------
src/input/player.c | 90 ----------------------------------------------------
src/libvlccore.sym | 1 -
3 files changed, 124 deletions(-)
diff --git a/include/vlc_player.h b/include/vlc_player.h
index 4058146005..403f405d52 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -319,19 +319,6 @@ enum vlc_player_abloop
};
/**
- * Subtitle synchronisation
- *
- * @see vlc_player_SetSubtitleSync()
- */
-enum vlc_player_subtitle_sync
-{
- VLC_PLAYER_SUBTITLE_SYNC_RESET,
- VLC_PLAYER_SUBTITLE_SYNC_MARK_AUDIO,
- VLC_PLAYER_SUBTITLE_SYNC_MARK_SUBTITLE,
- VLC_PLAYER_SUBTITLE_SYNC_APPLY,
-};
-
-/**
* Player lock type (normal or reentrant)
*/
enum vlc_player_lock_type
@@ -2451,26 +2438,6 @@ VLC_API vlc_tick_t
vlc_player_GetSubtitleDelay(vlc_player_t *player);
/**
- * Set subtitle synchronisation
- *
- * This function can be used to synchronise subtitles with the audio.
- *
- * Call this function with VLC_PLAYER_SUBTITLE_SYNC_MARK_AUDIO when your hear a
- * voice you want to synchronise with subtitles. Then, call this function with
- * VLC_PLAYER_SUBTITLE_SYNC_MARK_SUBTITLE when the subtitle corresponding to
- * the voice is displayed. Finally call this function with
- * VLC_PLAYER_SUBTITLE_SYNC_APPLY to apply the subtitle delay. Calling this
- * function with VLC_PLAYER_SUBTITLE_SYNC_RESET will reset the subtitle
- * synchronisation and set a subtitle delay of 0.
- *
- * @param player locked player instance
- * @param sync synchronisation action
- */
-VLC_API void
-vlc_player_SetSubtitleSync(vlc_player_t *player,
- enum vlc_player_subtitle_sync sync);
-
-/**
* Set the subtitle delay for the current media
*
* @note A successful call will trigger the
diff --git a/src/input/player.c b/src/input/player.c
index 54a39bed87..cdb170f167 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -117,12 +117,6 @@ struct vlc_player_input
vlc_tick_t audio_delay;
vlc_tick_t subtitle_delay;
- struct
- {
- vlc_tick_t audio_time;
- vlc_tick_t subtitle_time;
- } subsync;
-
vlc_player_program_vector program_vector;
vlc_player_track_vector video_track_vector;
vlc_player_track_vector audio_track_vector;
@@ -671,9 +665,6 @@ vlc_player_input_New(vlc_player_t *player, input_item_t *item)
input->audio_delay = input->subtitle_delay = 0;
- input->subsync.audio_time =
- input->subsync.subtitle_time = VLC_TICK_INVALID;
-
vlc_vector_init(&input->program_vector);
vlc_vector_init(&input->video_track_vector);
vlc_vector_init(&input->audio_track_vector);
@@ -2940,87 +2931,6 @@ vlc_player_GetSubtitleTextScale(vlc_player_t *player)
return var_GetInteger(player, "sub-text-scale");
}
-static void
-vlc_player_SubtitleSyncMarkAudio(vlc_player_t *player)
-{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
- if (!input)
- return;
- input->subsync.audio_time = vlc_tick_now();
- vlc_player_vout_OSDMessage(player, _("Sub sync: bookmarked audio time"));
-}
-
-static void
-vlc_player_SubtitleSyncMarkSubtitle(vlc_player_t *player)
-{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
- if (!input)
- return;
- input->subsync.subtitle_time = vlc_tick_now();
- vlc_player_vout_OSDMessage(player, _("Sub sync: bookmarked subtitle time"));
-}
-
-static void
-vlc_player_SubtitleSyncApply(vlc_player_t *player)
-{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
- if (!input)
- return;
- if (input->subsync.audio_time == VLC_TICK_INVALID ||
- input->subsync.subtitle_time == VLC_TICK_INVALID)
- {
- vlc_player_vout_OSDMessage(player, _("Sub sync: set bookmarks first!"));
- return;
- }
- vlc_tick_t delay =
- input->subsync.audio_time - input->subsync.subtitle_time;
- input->subsync.audio_time = VLC_TICK_INVALID;
- input->subsync.subtitle_time = VLC_TICK_INVALID;
- vlc_player_SetSubtitleDelayInternal(player, delay,
- VLC_PLAYER_WHENCE_RELATIVE);
-
- long long delay_ms = MS_FROM_VLC_TICK(delay);
- long long totdelay_ms = MS_FROM_VLC_TICK(input->subtitle_delay + delay);
- vlc_player_vout_OSDMessage(player, _("Sub sync: corrected %"PRId64
- " ms (total delay = %"PRId64" ms)"),
- delay_ms, totdelay_ms);
-}
-
-static void
-vlc_player_SubtitleSyncReset(vlc_player_t *player)
-{
- struct vlc_player_input *input = vlc_player_get_input_locked(player);
- if (!input)
- return;
- vlc_player_SetSubtitleDelayInternal(player, 0, VLC_PLAYER_WHENCE_ABSOLUTE);
- input->subsync.audio_time = VLC_TICK_INVALID;
- input->subsync.subtitle_time = VLC_TICK_INVALID;
- vlc_player_vout_OSDMessage(player, _("Sub sync: delay reset"));
-}
-
-void
-vlc_player_SetSubtitleSync(vlc_player_t *player,
- enum vlc_player_subtitle_sync sync)
-{
- switch (sync)
- {
- case VLC_PLAYER_SUBTITLE_SYNC_RESET:
- vlc_player_SubtitleSyncReset(player);
- break;
- case VLC_PLAYER_SUBTITLE_SYNC_MARK_AUDIO:
- vlc_player_SubtitleSyncMarkAudio(player);
- break;
- case VLC_PLAYER_SUBTITLE_SYNC_MARK_SUBTITLE:
- vlc_player_SubtitleSyncMarkSubtitle(player);
- break;
- case VLC_PLAYER_SUBTITLE_SYNC_APPLY:
- vlc_player_SubtitleSyncApply(player);
- break;
- default:
- vlc_assert_unreachable();
- }
-}
-
vlc_tick_t
vlc_player_GetSubtitleDelay(vlc_player_t *player)
{
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index d6a524e248..8cca2bbc01 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -855,7 +855,6 @@ vlc_player_SetRecordingEnabled
vlc_player_SetRenderer
vlc_player_SetStartPaused
vlc_player_SetSubtitleDelay
-vlc_player_SetSubtitleSync
vlc_player_SetSubtitleTextScale
vlc_player_SetTeletextEnabled
vlc_player_SetTeletextTransparency
More information about the vlc-commits
mailing list