summaryrefslogtreecommitdiffstats
path: root/sub/sd.h
diff options
context:
space:
mode:
Diffstat (limited to 'sub/sd.h')
-rw-r--r--sub/sd.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/sub/sd.h b/sub/sd.h
index 38bab3aa7a..0f5b8c7c72 100644
--- a/sub/sd.h
+++ b/sub/sd.h
@@ -9,14 +9,19 @@
#define SUB_GAP_THRESHOLD 0.210
// don't change timings if durations are smaller
#define SUB_GAP_KEEP 0.4
+// slight offset when sub seeking or sub stepping
+#define SUB_SEEK_OFFSET 0.01
+#define SUB_SEEK_WITHOUT_VIDEO_OFFSET 0.1
struct sd {
struct mpv_global *global;
struct mp_log *log;
struct mp_subtitle_opts *opts;
+ struct mp_subtitle_shared_opts *shared_opts;
const struct sd_functions *driver;
void *priv;
+ int order;
struct attachment_list *attachments;
struct mp_codec_params *codec;
@@ -46,11 +51,11 @@ struct sd_functions {
// lavc_conv.c
struct lavc_conv;
-struct lavc_conv *lavc_conv_create(struct mp_log *log, const char *codec_name,
- char *extradata, int extradata_len);
+struct lavc_conv *lavc_conv_create(struct sd *sd);
char *lavc_conv_get_extradata(struct lavc_conv *priv);
char **lavc_conv_decode(struct lavc_conv *priv, struct demux_packet *packet,
double *sub_pts, double *sub_duration);
+bool lavc_conv_is_styled(struct lavc_conv *priv);
void lavc_conv_reset(struct lavc_conv *priv);
void lavc_conv_uninit(struct lavc_conv *priv);
@@ -88,5 +93,24 @@ struct sd_filter_functions {
extern const struct sd_filter_functions sd_filter_sdh;
extern const struct sd_filter_functions sd_filter_regex;
+extern const struct sd_filter_functions sd_filter_jsre;
+
+
+// convenience utils for filters with ass codec
+
+// num commas to skip at an ass-event before the "Text" field (always last)
+// (doesn't change, can be retrieved once on filter init)
+int sd_ass_fmt_offset(const char *event_format);
+
+// the event (pkt->buffer) "Text" content according to the calculated offset.
+// on malformed event: warns and returns (bstr){NULL,0}
+bstr sd_ass_pkt_text(struct sd_filter *ft, struct demux_packet *pkt, int offset);
+
+// convert \0-terminated "Text" (ass) content to plaintext, possibly in-place.
+// result.start is *out, result.len is strlen(in) or smaller.
+// (*out)[result.len] is always set to \0. *out == in is allowed.
+// *out must be a talloc-allocated buffer or NULL, and will be reallocated if needed.
+// *out will not be reallocated if *out == in.
+bstr sd_ass_to_plaintext(char **out, const char *in);
#endif