diff options
author | wm4 <wm4@nowhere> | 2013-06-29 01:34:11 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-29 22:58:14 +0200 |
commit | e5c094754157102a964364041d6fb0caf2188809 (patch) | |
tree | e6bb02b7408c40651d620ac523fb2ffdf3f17cc7 /sub/dec_sub.c | |
parent | 00b0f42c42724346190d350e8801e19d8d7b9a23 (diff) | |
download | mpv-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/dec_sub.c')
-rw-r--r-- | sub/dec_sub.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 1a7180b260..5fb8722296 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -102,7 +102,7 @@ bool sub_is_initialized(struct dec_sub *sub) return !!sub->num_sd; } -struct sd *sub_get_last_sd(struct dec_sub *sub) +static struct sd *sub_get_last_sd(struct dec_sub *sub) { return sub->num_sd ? sub->sd[sub->num_sd - 1] : NULL; } @@ -482,6 +482,18 @@ void sub_reset(struct dec_sub *sub) } } +int sub_control(struct dec_sub *sub, enum sd_ctrl cmd, void *arg) +{ + for (int n = 0; n < sub->num_sd; n++) { + if (sub->sd[n]->driver->control) { + int r = sub->sd[n]->driver->control(sub->sd[n], cmd, arg); + if (r != CONTROL_UNKNOWN) + return r; + } + } + return CONTROL_UNKNOWN; +} + #define MAX_PACKETS 10 #define MAX_BYTES 10000 |