summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-01 19:40:09 +0200
committerwm4 <wm4@nowhere>2013-06-01 19:42:00 +0200
commitf7b9b92179333e5bf399cbb6289b66ed3439445c (patch)
tree870c8b95172a50d6cb9678c8cfebc99beb4a17c8 /core/mplayer.c
parent28116b8a799078b3c6b3b559ed4463669c79cf0e (diff)
downloadmpv-f7b9b92179333e5bf399cbb6289b66ed3439445c.tar.bz2
mpv-f7b9b92179333e5bf399cbb6289b66ed3439445c.tar.xz
sub: various minor subtitle related changes
Just pushing some code around.
Diffstat (limited to 'core/mplayer.c')
-rw-r--r--core/mplayer.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index c832aa1fcb..285f19c8ac 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1833,10 +1833,6 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl)
{
struct MPOpts *opts = &mpctx->opts;
struct sh_sub *sh_sub = mpctx->sh_sub;
- struct demux_stream *d_sub = sh_sub ? sh_sub->ds : NULL;
- unsigned char *packet = NULL;
- int len;
- const char *type = sh_sub ? sh_sub->gsh->codec : NULL;
struct track *track = mpctx->current_track[STREAM_SUB];
if (!track)
@@ -1849,12 +1845,16 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl)
double curpts_s = refpts_tl - mpctx->osd->sub_offset;
double refpts_s = refpts_tl - video_offset;
- if (d_sub && sh_sub && sh_sub->active) {
+ if (sh_sub && sh_sub->active) {
+ struct demux_stream *d_sub = sh_sub->ds;
+ const char *type = sh_sub->gsh->codec;
bool non_interleaved = is_non_interleaved(mpctx, track);
- if (non_interleaved)
- ds_get_next_pts(d_sub);
- while (d_sub->first) {
+ while (1) {
+ if (non_interleaved)
+ ds_get_next_pts(d_sub);
+ if (!d_sub->first)
+ break;
double subpts_s = ds_get_next_pts(d_sub);
if (subpts_s == MP_NOPTS_VALUE) {
// Try old method of getting PTS. This is only needed in the
@@ -1882,7 +1882,8 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl)
break;
}
double duration = d_sub->first->duration;
- len = ds_get_packet_sub(d_sub, &packet);
+ unsigned char *packet = NULL;
+ int len = ds_get_packet_sub(d_sub, &packet);
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);
@@ -1893,8 +1894,6 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl)
packet += 2;
}
sub_decode(sh_sub, mpctx->osd, packet, len, subpts_s, duration);
- if (non_interleaved)
- ds_get_next_pts(d_sub);
}
}