mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
subparse: Compile the typefind regex with optimization to speed up matching
This commit is contained in:
parent
3dc4987138
commit
2c7cdbc2ca
1 changed files with 4 additions and 4 deletions
|
@ -1238,8 +1238,8 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
||||||
switch (regtype) {
|
switch (regtype) {
|
||||||
case GST_SUB_PARSE_REGEX_MDVDSUB:
|
case GST_SUB_PARSE_REGEX_MDVDSUB:
|
||||||
result =
|
result =
|
||||||
(gpointer) g_regex_new ("^\\{[0-9]+\\}\\{[0-9]+\\}", G_REGEX_RAW, 0,
|
(gpointer) g_regex_new ("^\\{[0-9]+\\}\\{[0-9]+\\}",
|
||||||
&gerr);
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
g_warning ("Compilation of mdvd regex failed: %s", gerr->message);
|
g_warning ("Compilation of mdvd regex failed: %s", gerr->message);
|
||||||
g_error_free (gerr);
|
g_error_free (gerr);
|
||||||
|
@ -1249,7 +1249,7 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
||||||
result = (gpointer) g_regex_new ("^([ 0-9]){0,3}[0-9]\\s*(\x0d)?\x0a"
|
result = (gpointer) g_regex_new ("^([ 0-9]){0,3}[0-9]\\s*(\x0d)?\x0a"
|
||||||
"[ 0-9][0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]"
|
"[ 0-9][0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]"
|
||||||
" +--> +([ 0-9])?[0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]",
|
" +--> +([ 0-9])?[0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]",
|
||||||
G_REGEX_RAW, 0, &gerr);
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
||||||
g_error_free (gerr);
|
g_error_free (gerr);
|
||||||
|
@ -1257,7 +1257,7 @@ gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
||||||
break;
|
break;
|
||||||
case GST_SUB_PARSE_REGEX_DKS:
|
case GST_SUB_PARSE_REGEX_DKS:
|
||||||
result = (gpointer) g_regex_new ("^\\[[0-9]+:[0-9]+:[0-9]+\\].*",
|
result = (gpointer) g_regex_new ("^\\[[0-9]+:[0-9]+:[0-9]+\\].*",
|
||||||
G_REGEX_RAW, 0, &gerr);
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
g_warning ("Compilation of dks regex failed: %s", gerr->message);
|
g_warning ("Compilation of dks regex failed: %s", gerr->message);
|
||||||
g_error_free (gerr);
|
g_error_free (gerr);
|
||||||
|
|
Loading…
Reference in a new issue