X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmisc%2Fquartztext.c;h=b1dd12ade814bb05b53cab008f14a5dd917ee8c0;hb=c8492ac6282828be24f526870a299aa28718adfb;hp=0590b7e8e69dc7471240f848f4109bc47b9f2363;hpb=7d0e62b8727f27c865587131c5b7ae9445d5ea59;p=vlc diff --git a/modules/misc/quartztext.c b/modules/misc/quartztext.c index 0590b7e8e6..b1dd12ade8 100644 --- a/modules/misc/quartztext.c +++ b/modules/misc/quartztext.c @@ -82,7 +82,7 @@ static void setFontAttibutes( char *psz_fontname, int i_font_size, uint32_t i_fo #define FONTSIZER_TEXT N_("Relative font size") #define FONTSIZER_LONGTEXT N_("This is the relative default size of the " \ "fonts that will be rendered on the video. If absolute font size is set, "\ - "relative size will be overriden." ) + "relative size will be overridden." ) #define COLOR_TEXT N_("Text default color") #define COLOR_LONGTEXT N_("The color of the text that will be rendered on "\ "the video. This must be an hexadecimal (like HTML colors). The first two "\ @@ -232,59 +232,43 @@ static void Destroy( vlc_object_t *p_this ) static int LoadFontsFromAttachments( filter_t *p_filter ) { filter_sys_t *p_sys = p_filter->p_sys; - input_thread_t *p_input; input_attachment_t **pp_attachments; int i_attachments_cnt; - int k; - int rv = VLC_SUCCESS; - p_input = (input_thread_t *)vlc_object_find( p_filter, VLC_OBJECT_INPUT, FIND_PARENT ); - if( ! p_input ) + if( filter_GetInputAttachments( p_filter, &pp_attachments, &i_attachments_cnt ) ) return VLC_EGENERIC; - if( VLC_SUCCESS != input_Control( p_input, INPUT_GET_ATTACHMENTS, &pp_attachments, &i_attachments_cnt )) - { - vlc_object_release(p_input); - return VLC_EGENERIC; - } - p_sys->i_fonts = 0; p_sys->p_fonts = malloc( i_attachments_cnt * sizeof( ATSFontContainerRef ) ); if(! p_sys->p_fonts ) - rv = VLC_ENOMEM; + return VLC_ENOMEM; - for( k = 0; k < i_attachments_cnt; k++ ) + for( int k = 0; k < i_attachments_cnt; k++ ) { input_attachment_t *p_attach = pp_attachments[k]; - if( p_sys->p_fonts ) + if( ( !strcmp( p_attach->psz_mime, "application/x-truetype-font" ) || // TTF + !strcmp( p_attach->psz_mime, "application/x-font-otf" ) ) && // OTF + p_attach->i_data > 0 && p_attach->p_data ) { - if(( !strcmp( p_attach->psz_mime, "application/x-truetype-font" ) || // TTF - !strcmp( p_attach->psz_mime, "application/x-font-otf" ) ) && // OTF - ( p_attach->i_data > 0 ) && - ( p_attach->p_data != NULL ) ) + ATSFontContainerRef container; + + if( noErr == ATSFontActivateFromMemory( p_attach->p_data, + p_attach->i_data, + kATSFontContextLocal, + kATSFontFormatUnspecified, + NULL, + kATSOptionFlagsDefault, + &container )) { - ATSFontContainerRef container; - - if( noErr == ATSFontActivateFromMemory( p_attach->p_data, - p_attach->i_data, - kATSFontContextLocal, - kATSFontFormatUnspecified, - NULL, - kATSOptionFlagsDefault, - &container )) - { - p_sys->p_fonts[ p_sys->i_fonts++ ] = container; - } + p_sys->p_fonts[ p_sys->i_fonts++ ] = container; } } vlc_input_attachment_Delete( p_attach ); } free( pp_attachments ); - vlc_object_release(p_input); - - return rv; + return VLC_SUCCESS; } static char *EliminateCRLF( char *psz_string ) @@ -843,7 +827,7 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, else { /* Only text and karaoke tags are supported */ - xml_ReaderDelete( p_xml, p_xml_reader ); + xml_ReaderDelete( p_xml_reader ); p_xml_reader = NULL; rv = VLC_EGENERIC; } @@ -871,7 +855,7 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, } CFRelease(p_attrString); - xml_ReaderDelete( p_xml, p_xml_reader ); + xml_ReaderDelete( p_xml_reader ); } xml_Delete( p_xml ); } @@ -1045,7 +1029,6 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region, // Create a new subpicture region memset( &fmt, 0, sizeof(video_format_t) ); fmt.i_chroma = VLC_CODEC_YUVA; - fmt.i_aspect = 0; fmt.i_width = fmt.i_visible_width = i_width; fmt.i_height = fmt.i_visible_height = __MIN( i_height, i_textblock_height + VERTICAL_MARGIN * 2); fmt.i_x_offset = fmt.i_y_offset = 0;