[vlc-commits] demux: don't clobber psz_name by Content-Type

Rémi Denis-Courmont git at videolan.org
Sat Sep 26 21:23:35 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 25 19:13:35 2020 +0300| [565ed23acd64afa1a58c7230e391f3001ed91c63] | committer: Rémi Denis-Courmont

demux: don't clobber psz_name by Content-Type

As is done for the file extension, match the Content-Type after teh
demux object is initialized. This preserves the correct psz_name
property.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=565ed23acd64afa1a58c7230e391f3001ed91c63
---

 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, '.');



More information about the vlc-commits mailing list