diff options
author | ritsuka <[email protected]> | 2015-01-31 07:53:18 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-01-31 07:53:18 +0000 |
commit | a4416e99f06e31e1da8767d071e882f32c5a4e67 (patch) | |
tree | 9ebfa8b311c53a7b44d34715d8d2d318f4ba4f2a | |
parent | f30872bdcb2f5a97eddfbb3ea9e06d952cf29042 (diff) |
Add support for open type font attachments.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6839 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/common.h | 2 | ||||
-rw-r--r-- | libhb/muxavformat.c | 12 | ||||
-rw-r--r-- | libhb/rendersub.c | 3 | ||||
-rw-r--r-- | libhb/stream.c | 19 |
4 files changed, 25 insertions, 11 deletions
diff --git a/libhb/common.h b/libhb/common.h index 4a55a6f8a..76d48ed6e 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -855,7 +855,7 @@ struct hb_subtitle_s */ struct hb_attachment_s { - enum attachtype { FONT_TTF_ATTACH, HB_ART_ATTACH } type; + enum attachtype { FONT_TTF_ATTACH, FONT_OTF_ATTACH, HB_ART_ATTACH } type; char * name; char * data; int size; diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c index ae0eff711..67797da74 100644 --- a/libhb/muxavformat.c +++ b/libhb/muxavformat.c @@ -780,7 +780,7 @@ static int avformatInit( hb_mux_object_t * m ) { hb_attachment_t * attachment = hb_list_item( list_attachment, i ); - if (attachment->type == FONT_TTF_ATTACH && + if ((attachment->type == FONT_TTF_ATTACH || attachment->type == FONT_OTF_ATTACH) && attachment->size > 0) { AVStream *st = avformat_new_stream(m->oc, NULL); @@ -792,7 +792,15 @@ static int avformatInit( hb_mux_object_t * m ) avcodec_get_context_defaults3(st->codec, NULL); st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; - st->codec->codec_id = AV_CODEC_ID_TTF; + if (attachment->type == FONT_TTF_ATTACH) + { + st->codec->codec_id = AV_CODEC_ID_TTF; + } + else if (attachment->type == FONT_OTF_ATTACH) + { + st->codec->codec_id = MKBETAG( 0 ,'O','T','F'); + av_dict_set(&st->metadata, "mimetype", "application/vnd.ms-opentype", 0); + } priv_size = attachment->size; priv_data = av_malloc(priv_size); diff --git a/libhb/rendersub.c b/libhb/rendersub.c index 6dabf39a7..5bd84d2cc 100644 --- a/libhb/rendersub.c +++ b/libhb/rendersub.c @@ -472,7 +472,8 @@ static int ssa_init( hb_filter_object_t * filter, { hb_attachment_t * attachment = hb_list_item( list_attachment, i ); - if ( attachment->type == FONT_TTF_ATTACH ) + if ( attachment->type == FONT_TTF_ATTACH || + attachment->type == FONT_OTF_ATTACH ) { ass_add_font( pv->ssa, diff --git a/libhb/stream.c b/libhb/stream.c index 77bc03fc4..d9adcd5b2 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -5315,16 +5315,21 @@ static void add_ffmpeg_attachment( hb_title_t *title, hb_stream_t *stream, int i default: { int len = name ? strlen( name ) : 0; - if( len >= 4 && - ( !strcmp( name + len - 4, ".ttc" ) || - !strcmp( name + len - 4, ".TTC" ) || - !strcmp( name + len - 4, ".ttf" ) || - !strcmp( name + len - 4, ".TTF" ) ) ) + if( len >= 4 ) { // Some attachments don't have the right mime type. // So also trigger on file name extension. - type = FONT_TTF_ATTACH; - break; + if( !strcasecmp( name + len - 4, ".ttc" ) || + !strcasecmp( name + len - 4, ".ttf" ) ) + { + type = FONT_TTF_ATTACH; + break; + } + else if( !strcasecmp( name + len - 4, ".otf" ) ) + { + type = FONT_OTF_ATTACH; + break; + } } // Ignore unrecognized attachment type return; |