diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-07-22 20:23:13 +0300 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2021-08-05 21:32:22 +0300 |
commit | ab689a33a86d806726ee551fb25994fd0918a2a2 (patch) | |
tree | 4f4c8381209c44788e80215495990a021cc71402 /sub/sd.h | |
parent | 24357cb7b5a1a8ca4407c2e6d9316f07a7a5ef0d (diff) | |
download | mpv-ab689a33a86d806726ee551fb25994fd0918a2a2.tar.bz2 mpv-ab689a33a86d806726ee551fb25994fd0918a2a2.tar.xz |
sub: add filter text utils, use from filter-regex (no-op)
Add two stand-alone function to help with the text-extraction task
which ass filters need. Makes it easier to add new filters without
cargo-culting this functionality.
Currently, on malformed event (which shouldn't happen), a warning is
printed when a filter tries to extract the text, so if few filters
are enabled, we'll get multiple warnings (like before) - not critical.
The regex filter now uses these utils, the SDH filter not yet.
Diffstat (limited to 'sub/sd.h')
-rw-r--r-- | sub/sd.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -89,4 +89,15 @@ struct sd_filter_functions { extern const struct sd_filter_functions sd_filter_sdh; extern const struct sd_filter_functions sd_filter_regex; + +// 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); + #endif |