summaryrefslogtreecommitdiffstats
path: root/sub/sd_ass.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-29 01:34:11 +0200
committerwm4 <wm4@nowhere>2013-06-29 22:58:14 +0200
commite5c094754157102a964364041d6fb0caf2188809 (patch)
treee6bb02b7408c40651d620ac523fb2ffdf3f17cc7 /sub/sd_ass.c
parent00b0f42c42724346190d350e8801e19d8d7b9a23 (diff)
downloadmpv-e5c094754157102a964364041d6fb0caf2188809.tar.bz2
mpv-e5c094754157102a964364041d6fb0caf2188809.tar.xz
dec_sub: introduce sub_control(), use it for sub_step
This means the direct libass usage can be removed from command.c, and no weird hacks for retrieving the ASS_Track are needed. Also fix a bug when using this feature with ordered chapters.
Diffstat (limited to 'sub/sd_ass.c')
-rw-r--r--sub/sd_ass.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 9c51398f33..c82e1e80bb 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -318,6 +318,20 @@ static void uninit(struct sd *sd)
talloc_free(ctx);
}
+static int control(struct sd *sd, enum sd_ctrl cmd, void *arg)
+{
+ struct sd_ass_priv *ctx = sd->priv;
+ switch (cmd) {
+ case SD_CTRL_SUB_STEP: {
+ double *a = arg;
+ a[0] = ass_step_sub(ctx->ass_track, a[0] * 1000 + .5, a[1]) / 1000.0;
+ return CONTROL_OK;
+ }
+ default:
+ return CONTROL_UNKNOWN;
+ }
+}
+
const struct sd_functions sd_ass = {
.name = "ass",
.accept_packets_in_advance = true,
@@ -327,16 +341,7 @@ const struct sd_functions sd_ass = {
.get_bitmaps = get_bitmaps,
.get_text = get_text,
.fix_events = fix_events,
+ .control = control,
.reset = reset,
.uninit = uninit,
};
-
-struct ass_track *sub_get_ass_track(struct dec_sub *sub)
-{
- struct sd *sd = sub_get_last_sd(sub);
- if (sd && sd->driver == &sd_ass && sd->priv) {
- struct sd_ass_priv *ctx = sd->priv;
- return ctx->ass_track;
- }
- return NULL;
-}