summaryrefslogtreecommitdiffstats
path: root/libass/ass_parse.c
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2022-10-21 00:29:19 +0200
committerOneric <oneric@oneric.stub>2022-10-22 03:42:27 +0200
commitf6e1987c08e25d88b6dfa12dafaffc42f5499011 (patch)
tree39f9a80b0da5ffec6b9b99dba3dc93e23bfd6cab /libass/ass_parse.c
parent536f6dddd901f7ce9562ce39c83b4fb8775c0bf2 (diff)
downloadlibass-f6e1987c08e25d88b6dfa12dafaffc42f5499011.tar.bz2
libass-f6e1987c08e25d88b6dfa12dafaffc42f5499011.tar.xz
refactor: move and static'fy some internal functions
Although declared and defined in ass_utils.{h,c}, those functions are only used in one other file and aren't useful at other places.
Diffstat (limited to 'libass/ass_parse.c')
-rw-r--r--libass/ass_parse.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c
index b7ff24b..db25879 100644
--- a/libass/ass_parse.c
+++ b/libass/ass_parse.c
@@ -222,6 +222,50 @@ static bool parse_vector_clip(ASS_Renderer *render_priv,
return true;
}
+static int32_t parse_alpha_tag(char *str)
+{
+ int32_t alpha = 0;
+
+ while (*str == '&' || *str == 'H')
+ ++str;
+
+ mystrtoi32(&str, 16, &alpha);
+ return alpha;
+}
+
+static uint32_t parse_color_tag(char *str)
+{
+ int32_t color = 0;
+
+ while (*str == '&' || *str == 'H')
+ ++str;
+
+ mystrtoi32(&str, 16, &color);
+ return ass_bswap32((uint32_t) color);
+}
+
+/**
+ * \brief find style by name as in \r
+ * \param track track
+ * \param name style name
+ * \param len style name length
+ * \return style in track->styles
+ * Returns NULL if no style has the given name.
+ */
+static ASS_Style *lookup_style_strict(ASS_Track *track, char *name, size_t len)
+{
+ int i;
+ for (i = track->n_styles - 1; i >= 0; --i) {
+ if (strncmp(track->styles[i].Name, name, len) == 0 &&
+ track->styles[i].Name[len] == '\0')
+ return track->styles + i;
+ }
+ ass_msg(track->library, MSGL_WARN,
+ "[%p]: Warning: no style named '%.*s' found",
+ track, (int) len, name);
+ return NULL;
+}
+
/**
* \brief Parse style override tags.
* \param p string to parse