]> granicus.if.org Git - libass/commitdiff
Refine list of tags that prevent selective style overrides
authorwm4 <wm4@nowhere>
Fri, 6 Mar 2015 12:14:39 +0000 (13:14 +0100)
committerwm4 <wm4@nowhere>
Fri, 6 Mar 2015 12:14:39 +0000 (13:14 +0100)
Somewhat stolen from:

https://github.com/Cyberbeing/xy-VSFilter/blob/xy_sub_filter_rc3/src/subtitles/RTS.cpp#L2004
(xy-VSFilter started work on this in commit 014da6d9766417d7886eb867c9f2c14038f2a226)

libass/ass_parse.c
libass/ass_parse.h
libass/ass_render.c

index 641d42c3b7b19f41b09a3435a7d0cf268468de04..a639dc5809d1694b60c2e63e2bde02be3075430e 100644 (file)
@@ -1070,9 +1070,9 @@ unsigned get_next_char(ASS_Renderer *render_priv, char **str)
     return chr;
 }
 
-// Return 1 if the event contains tags that will put the renderer into the
-// EVENT_POSITIONED state. Return 0 otherwise.
-int event_is_positioned(char *str)
+// Return 1 if the event contains tags that will apply overrides the selective
+// style override code should not touch. Return 0 otherwise.
+int event_has_hard_overrides(char *str)
 {
     // look for \pos and \move tags inside {...}
     // mirrors get_next_char, but is faster and doesn't change any global state
@@ -1084,7 +1084,10 @@ int event_is_positioned(char *str)
             while (*str && *str != '}') {
                 if (*str == '\\') {
                     char *p = str + 1;
-                    if (mystrcmp(&p, "pos") || mystrcmp(&p, "move"))
+                    if (mystrcmp(&p, "pos") || mystrcmp(&p, "move") ||
+                        mystrcmp(&p, "clip") || mystrcmp(&p, "iclip") ||
+                        mystrcmp(&p, "org") || mystrcmp(&p, "pbo") ||
+                        mystrcmp(&p, "p"))
                         return 1;
                 }
                 str++;
index e9322381cc10231791a8f1b4c8d86f1786030c4a..e8512b2a7d5b53f0a4d1cc4992f6ee76e76ef9a4 100644 (file)
@@ -35,7 +35,7 @@ void apply_transition_effects(ASS_Renderer *render_priv, ASS_Event *event);
 void process_karaoke_effects(ASS_Renderer *render_priv);
 unsigned get_next_char(ASS_Renderer *render_priv, char **str);
 char *parse_tag(ASS_Renderer *render_priv, char *p, char *end, double pwr);
-int event_is_positioned(char *str);
+int event_has_hard_overrides(char *str);
 extern void change_alpha(uint32_t *var, uint32_t new, double pwr);
 extern uint32_t mult_alpha(uint32_t a, uint32_t b);
 
index b03fc3067233b603273357feda418660a652e699..4774dabf51a9c1a9c7c7c50049ea031542df6566 100644 (file)
@@ -756,7 +756,7 @@ static ASS_Style *handle_selective_style_overrides(ASS_Renderer *render_priv,
     // The user style was set with ass_set_selective_style_override().
     ASS_Style *user = &render_priv->user_override_style;
     ASS_Style *new = &render_priv->state.override_style_temp_storage;
-    int explicit = event_is_positioned(render_priv->state.event->Text);
+    int explicit = event_has_hard_overrides(render_priv->state.event->Text);
     int requested = render_priv->settings.selective_style_overrides;
     double scale;