diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-12-18 19:29:33 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-12-18 19:29:33 +0000 |
commit | 2ed18d7a2a08519f5ac7121c68289d0d4dd17e78 (patch) | |
tree | 6c9e2fb62506973434790fc4f2237f232db8b622 /mpcommon.c | |
parent | 332bb06e4fd5f1458097090b89efd669dbe790bf (diff) | |
download | mpv-2ed18d7a2a08519f5ac7121c68289d0d4dd17e78.tar.bz2 mpv-2ed18d7a2a08519f5ac7121c68289d0d4dd17e78.tar.xz |
Use on-stack subtitle struct for temporary storage for passing subtitles on
for rendering by libass.
This avoids mangling the static subtitle struct that is supposed to contain
the subtitles that will actually be displayed and it also minimally reduces
memory usage by freeing the subtitle lines again as early as possible.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30059 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mpcommon.c')
-rw-r--r-- | mpcommon.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/mpcommon.c b/mpcommon.c index ba5e20db89..81ed9c1113 100644 --- a/mpcommon.c +++ b/mpcommon.c @@ -190,12 +190,13 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd (long long)((endpts-subpts)*1000 + 0.5)); } else { // plaintext subs with libass if (subpts != MP_NOPTS_VALUE) { + subtitle tmp_subs = {0}; if (endpts == MP_NOPTS_VALUE) endpts = subpts + 3; - sub_clear_text(&subs, MP_NOPTS_VALUE); - sub_add_text(&subs, packet, len, endpts); - subs.start = subpts * 100; - subs.end = endpts * 100; - ass_process_subtitle(ass_track, &subs); + sub_add_text(&tmp_subs, packet, len, endpts); + tmp_subs.start = subpts * 100; + tmp_subs.end = endpts * 100; + ass_process_subtitle(ass_track, &tmp_subs); + sub_clear_text(&tmp_subs, MP_NOPTS_VALUE); } } continue; |