[vlc-devel] [PATCH 2/2] demux: avoid one string comparison
RĂ©mi Denis-Courmont
remi at remlab.net
Fri Sep 25 21:17:35 CEST 2020
Track the correct strict flag value. (Note that the strict flag has no
effects if the requested module name is "any".)
---
src/input/demux.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/input/demux.c b/src/input/demux.c
index 0ecf394667..6707b8cc73 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -154,6 +154,7 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
p_demux->p_sys = NULL;
char *modbuf = NULL;
+ bool strict = true;
if (!strcasecmp(module, "any" ) || module[0] == '\0') {
/* Look up demux by content type for hard to detect formats */
@@ -163,6 +164,7 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
module = demux_NameFromMimeType(type);
free(type);
}
+ strict = false;
}
if (strcasecmp(module, "any") == 0 && p_demux->psz_filepath != NULL)
@@ -176,10 +178,9 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
if (likely(asprintf(&modbuf, "ext-%s", ext + 1) >= 0))
module = modbuf;
}
+ strict = false;
}
- bool strict = strcmp(module, p_demux->psz_name) == 0;
-
priv->module = vlc_module_load(p_demux, "demux", module, strict,
demux_Probe, p_demux);
free(modbuf);
--
2.28.0
More information about the vlc-devel
mailing list