summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-16 20:51:48 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-01-18 14:58:09 +0200
commit8e7dae173d07533e1de46fad7bb2f834febe27cf (patch)
tree1e16938db643ba43a83d55524626812957c75e0a /mplayer.c
parente990fb2ffeaa786339895c8f3b3f104ef536bf39 (diff)
downloadmpv-8e7dae173d07533e1de46fad7bb2f834febe27cf.tar.bz2
mpv-8e7dae173d07533e1de46fad7bb2f834febe27cf.tar.xz
subtitles/demux: store duration instead of endpts in demux packets
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mplayer.c b/mplayer.c
index ecdc4e11af..c09fa7ada9 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1927,11 +1927,11 @@ void update_subtitles(struct MPContext *mpctx, double refpts,
if (d_sub->non_interleaved && subpts > curpts + 1)
break;
}
- double endpts = d_sub->first->endpts + sub_offset;
+ double duration = d_sub->first->duration;
len = ds_get_packet_sub(d_sub, &packet);
if (is_av_sub(type)) {
#ifdef CONFIG_FFMPEG
- decode_avsub(sh_sub, packet, len, subpts, endpts);
+ decode_avsub(sh_sub, packet, len, subpts, duration);
#endif
continue;
}
@@ -1957,14 +1957,11 @@ void update_subtitles(struct MPContext *mpctx, double refpts,
continue;
}
if (sh_sub && sh_sub->active) {
- double duration = -1;
- if (endpts != MP_NOPTS_VALUE)
- duration = endpts - subpts;
sub_decode(sh_sub, mpctx->osd, packet, len, subpts, duration);
continue;
}
if (subpts != MP_NOPTS_VALUE) {
- if (endpts == MP_NOPTS_VALUE)
+ if (duration < 0)
sub_clear_text(&subs, MP_NOPTS_VALUE);
if (type == 'a') { // ssa/ass subs without libass => convert to plaintext
int i;
@@ -1977,6 +1974,9 @@ void update_subtitles(struct MPContext *mpctx, double refpts,
len -= p - packet;
packet = p;
}
+ double endpts = MP_NOPTS_VALUE;
+ if (subpts != MP_NOPTS_VALUE && duration >= 0)
+ endpts = subpts + duration;
sub_add_text(&subs, packet, len, endpts);
set_osd_subtitle(mpctx, &subs);
}