[vlc-commits] input/demux + misc/image: fix mime-type matching

Filip Roséen git at videolan.org
Wed Mar 22 08:23:51 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Mar 22 04:38:35 2017 +0100| [13943f078a7da3d50a0ac8c4efc961fd9d6d2bfe] | committer: Rémi Denis-Courmont

input/demux + misc/image: fix mime-type matching

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

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 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 9a14b4a..006b426 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 ad07fd7..313d213 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 );



More information about the vlc-commits mailing list