summaryrefslogtreecommitdiffstats
path: root/libass/ass_parse.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-29 21:31:23 +0200
committerwm4 <wm4@nowhere>2012-09-29 21:31:23 +0200
commit31db1346d43e54e07bd563d8c9e6ffbdd195b84c (patch)
tree70e0ba0165796a585a1159a5feb618a6583ead73 /libass/ass_parse.c
parent6d2b7f238ec20a88d7ced4a513c6262a0b39d9ff (diff)
downloadlibass-31db1346d43e54e07bd563d8c9e6ffbdd195b84c.tar.bz2
libass-31db1346d43e54e07bd563d8c9e6ffbdd195b84c.tar.xz
Terminate drawings immediately on a \p0 tag
The parsing code allowed override tags after \p0 to affect the drawing. This is incorrect. Finish the drawing object as soon as \p0 is encountered instead. This requires moving the code executing the style overrides from get_next_char() in ass_parse.c to the main render loop in ass_renderer.c, because we have to re-enter the rendering loop inside of a tag. The old code was simply executing all tags until a new character could be returned to the renderer loop, mutating up the state (RenderContext fields) for the drawing after the drawing was closed, but before it was rendered. This fixes libass issue #47.
Diffstat (limited to 'libass/ass_parse.c')
-rw-r--r--libass/ass_parse.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c
index da75d29..3966a43 100644
--- a/libass/ass_parse.c
+++ b/libass/ass_parse.c
@@ -253,7 +253,7 @@ static char *parse_vector_clip(ASS_Renderer *render_priv, char *p)
* \param p string to parse
* \param pwr multiplier for some tag effects (comes from \t tags)
*/
-static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
+char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
{
skip_to('\\');
skip('\\');
@@ -999,7 +999,7 @@ void process_karaoke_effects(ASS_Renderer *render_priv)
/**
- * \brief Get next ucs4 char from string, parsing and executing style overrides
+ * \brief Get next ucs4 char from string, parsing UTF-8 and escapes
* \param str string pointer
* \return ucs4 code of the next char
* On return str points to the unparsed part of the string
@@ -1008,24 +1008,6 @@ unsigned get_next_char(ASS_Renderer *render_priv, char **str)
{
char *p = *str;
unsigned chr;
- if (*p == '{') { // '\0' goes here
- p++;
- while (1) {
- p = parse_tag(render_priv, p, 1.);
- if (*p == '}') { // end of tag
- p++;
- if (*p == '{') {
- p++;
- continue;
- } else
- break;
- } else if (*p != '\\')
- ass_msg(render_priv->library, MSGL_V,
- "Unable to parse: '%.30s'", p);
- if (*p == 0)
- break;
- }
- }
if (*p == '\t') {
++p;
*str = p;