Browse Source

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@videolan.org>
pull/2/head
Grigori Goronzy 15 years ago
committed by Jean-Baptiste Kempf
parent
commit
ab9b56ca95
  1. 14
      modules/codec/libass.c

14
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( !found && 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 );

Loading…
Cancel
Save