From 1ee8d0210d8ad613e462eab10a1a4139b62de367 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Sep 2013 23:18:11 +0200 Subject: sd_ass: minor simplification There shouldn't be any functional changes. Just reduce the amount of pointless temporary variables. --- sub/sd_ass.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'sub/sd_ass.c') diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 9b56eb5046..7de0ab6c43 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -88,36 +88,30 @@ static int init(struct sd *sd) static void decode(struct sd *sd, struct demux_packet *packet) { - void *data = packet->buffer; - int data_len = packet->len; - double pts = packet->pts; - double duration = packet->duration; - unsigned char *text = data; struct sd_ass_priv *ctx = sd->priv; ASS_Track *track = ctx->ass_track; + long long ipts = packet->pts * 1000 + 0.5; + long long iduration = packet->duration * 1000 + 0.5; if (strcmp(sd->codec, "ass") == 0) { - ass_process_chunk(track, data, data_len, - (long long)(pts*1000 + 0.5), - (long long)(duration*1000 + 0.5)); + ass_process_chunk(track, packet->buffer, packet->len, ipts, iduration); return; } else if (strcmp(sd->codec, "ssa") == 0) { // broken ffmpeg ASS packet format ctx->flush_on_seek = true; - ass_process_data(track, data, data_len); + ass_process_data(track, packet->buffer, packet->len); return; } // plaintext subs - if (pts == MP_NOPTS_VALUE) { + if (packet->pts == MP_NOPTS_VALUE) { mp_msg(MSGT_SUBREADER, MSGL_WARN, "Subtitle without pts, ignored\n"); return; } - long long ipts = pts * 1000 + 0.5; - long long iduration = duration * 1000 + 0.5; - if (duration <= 0) { + if (packet->duration <= 0) { mp_msg(MSGT_SUBREADER, MSGL_WARN, "Subtitle without duration or " - "duration set to 0 at pts %f, ignored\n", pts); + "duration set to 0 at pts %f, ignored\n", packet->pts); return; } + unsigned char *text = packet->buffer; if (!sd->no_remove_duplicates) { for (int i = 0; i < track->n_events; i++) { if (track->events[i].Start == ipts -- cgit v1.2.3