[vlc-devel] [PATCH 3/3] input/demux + misc/image: fix mime-type matching

Filip Roséen filip at atch.se
Wed Mar 22 04:38:35 CET 2017


These changes make sure that we query the source-stream's mime-type in
src/input/demux.c and src/misc/image.c, and not the full content-type.

The previous implementation would fail to identify the relevant
demuxer, and image chroma, if the stream's content-type contained
parameters following the mime-type.

fixes: #18144
---
 src/input/demux.c | 8 ++++----
 src/misc/image.c  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/input/demux.c b/src/input/demux.c
index 9a14b4af63..006b426436 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -58,7 +58,7 @@ static demux_mapping* demux_lookup( char const* key,
     return bsearch( key, data, size, sizeof( *data ), demux_mapping_cmp );
 }
 
-static const char *demux_NameFromContentType(const char *mime)
+static const char *demux_NameFromMimeType(const char *mime)
 {
     static demux_mapping types[] =
     {   /* Must be sorted in ascending ASCII order */
@@ -196,11 +196,11 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
     demux_t *p_demux = &priv->demux;
 
     if( s != NULL && (!strcasecmp( psz_demux, "any" ) || !psz_demux[0]) )
-    {   /* Look up demux by Content-Type for hard to detect formats */
-        char *type = stream_ContentType( s );
+    {   /* Look up demux by mime-type for hard to detect formats */
+        char *type = stream_MimeType( s );
         if( type != NULL )
         {
-            psz_demux = demux_NameFromContentType( type );
+            psz_demux = demux_NameFromMimeType( type );
             free( type );
         }
     }
diff --git a/src/misc/image.c b/src/misc/image.c
index ad07fd7f40..313d21386e 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -293,7 +293,7 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
 
     if( !p_fmt_in->i_chroma )
     {
-        char *psz_mime = stream_ContentType( p_stream );
+        char *psz_mime = stream_MimeType( p_stream );
         if( psz_mime != NULL )
         {
             p_fmt_in->i_chroma = image_Mime2Fourcc( psz_mime );
-- 
2.12.0


More information about the vlc-devel mailing list