1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 09:02:38 +00:00

backport ass_flush_events() from upstream libass and make use of it

This fixes subtitles duplication when seeking back in ass stream formated
with the "standard" format FFmpeg uses.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31293 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
aurel 2010-05-31 19:10:57 +00:00
parent c071c9e805
commit e123aecb48
3 changed files with 25 additions and 0 deletions

View File

@ -909,6 +909,20 @@ void ass_process_chunk(ASS_Track *track, char *data, int size,
free(str);
}
/**
* \brief Flush buffered events.
* \param track track
*/
void ass_flush_events(ASS_Track *track)
{
if (track->events) {
int eid;
for (eid = 0; eid < track->n_events; eid++)
ass_free_event(track, eid);
track->n_events = 0;
}
}
#ifdef CONFIG_ICONV
/** \brief recode buffer to utf-8
* constraint: codepage != 0

View File

@ -316,6 +316,12 @@ void ass_process_codec_private(ASS_Track *track, char *data, int size);
void ass_process_chunk(ASS_Track *track, char *data, int size,
long long timecode, long long duration);
/**
* \brief Flush buffered events.
* \param track track
*/
void ass_flush_events(ASS_Track *track);
/**
* \brief Read subtitles from file.
* \param library library handle

View File

@ -2581,6 +2581,11 @@ static int seek(MPContext *mpctx, double amount, int style)
vobsub_seek(vo_vobsub, mpctx->sh_video->pts);
}
#ifdef CONFIG_ASS
if (ass_enabled && mpctx->d_sub->sh && ((sh_sub_t *)mpctx->d_sub->sh)->ass_track)
ass_flush_events(((sh_sub_t *)mpctx->d_sub->sh)->ass_track);
#endif
edl_seek_reset(mpctx);
c_total = 0;