From 13a1ce16f9581871cf7ac0d06ece407534a98f89 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 3 Jun 2013 01:28:14 +0200 Subject: sub: pass subtitle packets directly Before this, subtitle packets were returned as data ptr/len pairs, and mplayer.c got the rest (pts and duration) directly from the demuxer data structures. Then mplayer.c reassembled the packet data structure again. Pass packets directly instead. The mplayer.c side stays a bit awkward, because the (now by default unused) DVD path keeps getting in the way. In demux.c there's lots of weird stuff (3 functions that read packets, really?), but we want to keep the code equivalent for now to avoid hitting weird issues and corner cases. --- core/mplayer.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'core') diff --git a/core/mplayer.c b/core/mplayer.c index 353723930c..80ddd43f95 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -1885,18 +1885,15 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl) if (non_interleaved && subpts_s > curpts_s + 1) break; } - double duration = d_sub->first->duration; - unsigned char *packet = NULL; - int len = ds_get_packet_sub(d_sub, &packet); + struct demux_packet pkt; + struct demux_packet *orig = ds_get_packet_sub(d_sub); + if (!orig) + break; + pkt = *orig; + pkt.pts = subpts_s; mp_dbg(MSGT_CPLAYER, MSGL_V, "Sub: c_pts=%5.3f s_pts=%5.3f " - "duration=%5.3f len=%d\n", curpts_s, subpts_s, duration, - len); - struct demux_packet pkt = { - .buffer = packet, - .len = len, - .pts = subpts_s, - .duration = duration, - }; + "duration=%5.3f len=%d\n", curpts_s, pkt.pts, pkt.duration, + pkt.len); sub_decode(dec_sub, &pkt); } } -- cgit v1.2.3