[vlc-commits] libass: match font attachments based on extension
    Grigori Goronzy 
    git at videolan.org
       
    Mon Aug 22 15:04:12 CEST 2011
    
    
  
vlc | branch: master | Grigori Goronzy <greg at blackbox> | Mon Aug 22 01:40:54 2011 +0200| [991ede5d7cee99367f85ca97d9894009d0c309ad] | committer: Jean-Baptiste Kempf
libass: match font attachments based on extension
Sometimes fonts are muxed with the wrong MIME type, but we should
still be able to use them. Especially OpenType font collections are
affected by this. Match attachments by extensions .ttf, .otf and .ttc
in addition to MIME type to fix these issues.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=991ede5d7cee99367f85ca97d9894009d0c309ad
---
 modules/codec/libass.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index 829e1fe..f7adf71 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -187,7 +187,21 @@ static int Create( vlc_object_t *p_this )
     {
         input_attachment_t *p_attach = pp_attachments[k];
 
+        bool found = false;
+
+        /* Check mimetype*/
         if( !strcasecmp( p_attach->psz_mime, "application/x-truetype-font" ) )
+            found = true;
+        /* Then extension */
+        else if( strlen( p_attach->psz_name ) > 4 )
+        {
+            char *ext = p_attach->psz_name + strlen( p_attach->psz_name ) - 4;
+
+            if( !strcasecmp( ext, ".ttf" ) || !strcasecmp( ext, ".otf" ) || !strcasecmp( ext, ".ttc" ) )
+                found = true;
+        }
+
+        if( found )
         {
             msg_Dbg( p_dec, "adding embedded font %s", p_attach->psz_name );
 
    
    
More information about the vlc-commits
mailing list