This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 55718343aac1f492fd67e2bcb6f31919ea95689a Author: Jun Zhao <[email protected]> AuthorDate: Mon Sep 28 07:00:19 2026 +0800 Commit: Jun Zhao <[email protected]> CommitDate: Mon Sep 28 01:08:27 2026 +0000 avcodec/ass_split: add karaoke callback to ASSCodesCallbacks Parse karaoke override codes (\k, \K, \kf, \ko) during ASS dialogue splitting and dispatch them via a dedicated callback in ASSCodesCallbacks. The duration is passed in centiseconds (1 cs = 10 ms), matching ASS specification conventions. Other subtitle encoders (SRT, TTML, mov_text) leave the callback NULL and continue to ignore karaoke tags without functional regressions. Signed-off-by: Jun Zhao <[email protected]> --- libavcodec/ass_split.c | 7 ++++++- libavcodec/ass_split.h | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index 3f8f5e7cae..5eb96072eb 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -502,7 +502,7 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, buf++; while (*buf == '\\') { char style[2], c[2], sep[2], c_num[2] = "0", tmp[128] = {0}; - unsigned int color = 0xFFFFFFFF; + unsigned int color = 0xFFFFFFFF, dur = 0; int len, size = -1, an = -1, alpha = -1; int x1, y1, x2, y2, t1 = -1, t2 = -1; if (sscanf(buf, "\\%1[bisu]%1[01\\}]%n", style, c, &len) > 1) { @@ -552,6 +552,11 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, } else if (sscanf(buf, "\\org(%d,%d)%1[\\}]%n", &x1, &y1, sep, &len) > 2) { if (callbacks->origin) callbacks->origin(priv, x1, y1); + } else if (sscanf(buf, "\\kf%u%1[\\}]%n", &dur, sep, &len) > 1 || + sscanf(buf, "\\ko%u%1[\\}]%n", &dur, sep, &len) > 1 || + sscanf(buf, "\\%1[kK]%u%1[\\}]%n", c, &dur, sep, &len) > 2) { + if (callbacks->karaoke) + callbacks->karaoke(priv, dur); } else { len = strcspn(buf+1, "\\}") + 2; /* skip unknown code */ } diff --git a/libavcodec/ass_split.h b/libavcodec/ass_split.h index 41191c0f44..0a0c0ced1a 100644 --- a/libavcodec/ass_split.h +++ b/libavcodec/ass_split.h @@ -159,6 +159,14 @@ typedef struct { void (*origin)(void *priv, int x, int y); /** @} */ + /** + * @defgroup ass_karaoke ASS karaoke + * @{ + */ + /* duration is in centiseconds */ + void (*karaoke)(void *priv, unsigned int duration); + /** @} */ + /** * @defgroup ass_end end of Dialogue Event * @{ -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
