[vlc-devel] [PATCH 1/2] demux: don't clobber psz_name by Content-Type

RĂ©mi Denis-Courmont remi at remlab.net
Fri Sep 25 21:17:34 CEST 2020


As is done for the file extension, match the Content-Type after teh
demux object is initialized. This preserves the correct psz_name
property.
---
 src/input/demux.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/input/demux.c b/src/input/demux.c
index a854037e71..0ecf394667 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -128,16 +128,6 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
     assert(s != NULL);
     priv = vlc_stream_Private(p_demux);
 
-    if (!strcasecmp(module, "any" ) || module[0] == '\0')
-    {   /* Look up demux by mime-type for hard to detect formats */
-        char *type = stream_MimeType( s );
-        if( type != NULL )
-        {
-            module = demux_NameFromMimeType( type );
-            free( type );
-        }
-    }
-
     p_demux->p_input_item = p_input ? input_GetItem(p_input) : NULL;
     p_demux->psz_name = strdup(module);
     if (unlikely(p_demux->psz_name == NULL))
@@ -165,6 +155,16 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_input,
 
     char *modbuf = NULL;
 
+    if (!strcasecmp(module, "any" ) || module[0] == '\0') {
+        /* Look up demux by content type for hard to detect formats */
+        char *type = stream_MimeType(s);
+
+        if (type != NULL) {
+            module = demux_NameFromMimeType(type);
+            free(type);
+        }
+    }
+
     if (strcasecmp(module, "any") == 0 && p_demux->psz_filepath != NULL)
     {
         const char *ext = strrchr(p_demux->psz_filepath, '.');
-- 
2.28.0



More information about the vlc-devel mailing list