summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-24 23:18:11 +0200
committerwm4 <wm4@nowhere>2013-09-24 23:18:11 +0200
commit1ee8d0210d8ad613e462eab10a1a4139b62de367 (patch)
tree4a934fae826e3eb6dada641977600646ebe156ee /sub
parent1dbb73e0fb4dea1c011c1d079df2502c686e00d9 (diff)
downloadmpv-1ee8d0210d8ad613e462eab10a1a4139b62de367.tar.bz2
mpv-1ee8d0210d8ad613e462eab10a1a4139b62de367.tar.xz
sd_ass: minor simplification
There shouldn't be any functional changes. Just reduce the amount of pointless temporary variables.
Diffstat (limited to 'sub')
-rw-r--r--sub/sd_ass.c22
1 files changed, 8 insertions, 14 deletions
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