# HG changeset patch # User aurel # Date 1275333057 0 # Node ID ee7beb1a3a6e2670238fc2664a23f1e491aa1897 # Parent 1f607394598a1b3203a4d21cf6c4f8a415612c35 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. diff -r 1f607394598a -r ee7beb1a3a6e libass/ass.c --- a/libass/ass.c Mon May 31 17:12:27 2010 +0000 +++ b/libass/ass.c Mon May 31 19:10:57 2010 +0000 @@ -909,6 +909,20 @@ 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 diff -r 1f607394598a -r ee7beb1a3a6e libass/ass.h --- a/libass/ass.h Mon May 31 17:12:27 2010 +0000 +++ b/libass/ass.h Mon May 31 19:10:57 2010 +0000 @@ -317,6 +317,12 @@ 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 * \param fname file name diff -r 1f607394598a -r ee7beb1a3a6e mplayer.c --- a/mplayer.c Mon May 31 17:12:27 2010 +0000 +++ b/mplayer.c Mon May 31 19:10:57 2010 +0000 @@ -2581,6 +2581,11 @@ 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;