summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-14 22:14:49 +0200
committerwm4 <wm4@nowhere>2020-05-14 22:14:49 +0200
commitc6369933f1d9cd204b09be95ef7d4ed1351610e2 (patch)
treed7b45307780aef2dafde89795f49d564c7aed313 /sub/dec_sub.c
parent0049ea38be72884fabeee3ce52e2d6796c3abd53 (diff)
downloadmpv-c6369933f1d9cd204b09be95ef7d4ed1351610e2.tar.bz2
mpv-c6369933f1d9cd204b09be95ef7d4ed1351610e2.tar.xz
command: add property to return text subtitles in ASS
See manpage additions. This was requested, sort of. Although what has been requested might be something completely different. So this is speculative. This also changes sub_get_text() to return an allocated copy, because the buffer shit was too damn messy.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 76e96bc16b..aedb836235 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -348,10 +348,10 @@ struct sub_bitmaps *sub_get_bitmaps(struct dec_sub *sub, struct mp_osd_res dim,
return res;
}
-// See sub_get_bitmaps() for locking requirements.
-// It can be called unlocked too, but then only 1 thread must call this function
-// at a time (unless exclusive access is guaranteed).
-char *sub_get_text(struct dec_sub *sub, double pts)
+// This can only be called by the main thread, due to the returned text pointing
+// to a buffer bound to the sub object. The main thread is the designated
+// "outside" owner of the buffer.
+char *sub_get_text(struct dec_sub *sub, double pts, enum sd_text_type type)
{
pthread_mutex_lock(&sub->lock);
char *text = NULL;
@@ -362,7 +362,7 @@ char *sub_get_text(struct dec_sub *sub, double pts)
update_segment(sub);
if (sub->sd->driver->get_text)
- text = sub->sd->driver->get_text(sub->sd, pts);
+ text = sub->sd->driver->get_text(sub->sd, pts, type);
pthread_mutex_unlock(&sub->lock);
return text;
}