summaryrefslogtreecommitdiffstats
path: root/libass/ass_parse.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2012-03-11 06:04:59 +0100
committerGrigori Goronzy <greg@blackbox>2012-03-11 06:04:59 +0100
commit2ba300123f7e6e5b9bbc69976ca4017993af694b (patch)
treea5b8b83ee77a63c71595ddf0abec6f1811954f7f /libass/ass_parse.c
parent94b4c0d87182cd0bc84cf49cb793a0ab184df502 (diff)
downloadlibass-2ba300123f7e6e5b9bbc69976ca4017993af694b.tar.bz2
libass-2ba300123f7e6e5b9bbc69976ca4017993af694b.tar.xz
Support \rSTYLENAME syntax
This allows to reset to a certain style, instead of the default style for the current line. For some reason, this was completely missing.
Diffstat (limited to 'libass/ass_parse.c')
-rw-r--r--libass/ass_parse.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c
index 92a47b3..d505dd5 100644
--- a/libass/ass_parse.c
+++ b/libass/ass_parse.c
@@ -730,7 +730,18 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
ass_msg(render_priv->library, MSGL_DBG2, "single c/a at %f: %c%c = %X",
pwr, n, cmd, render_priv->state.c[cidx]);
} else if (mystrcmp(&p, "r")) {
- reset_render_context(render_priv);
+ char *start = p;
+ char *style;
+ skip_to('\\');
+ if (p > start) {
+ style = malloc(p - start + 1);
+ strncpy(style, start, p - start);
+ style[p - start] = '\0';
+ reset_render_context(render_priv,
+ render_priv->track->styles + lookup_style(render_priv->track, style));
+ free(style);
+ } else
+ reset_render_context(render_priv, NULL);
} else if (mystrcmp(&p, "be")) {
int val;
if (mystrtoi(&p, &val)) {