Commit b400bf9e authored by Thomas Guillem's avatar 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.
parent b25d1b34
......@@ -318,19 +318,6 @@ enum vlc_player_abloop
VLC_PLAYER_ABLOOP_B,
};
/**
* 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)
*/
......@@ -2450,26 +2437,6 @@ vlc_player_SetAudioDelay(vlc_player_t *player, vlc_tick_t delay,
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
*
......
......@@ -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)
{
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment