Commit ccc672c7 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

Fix rendering of TEXT subtitles.

parent c122052b
...@@ -507,8 +507,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -507,8 +507,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
} }
/* Load the text rendering module */ /* Load the text rendering module */
if( !p_spu->p_text && p_region && if( !p_spu->p_text && p_region )
( p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') ) )
{ {
char *psz_modulename = NULL; char *psz_modulename = NULL;
...@@ -529,7 +528,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -529,7 +528,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
if( psz_modulename && *psz_modulename ) if( psz_modulename && *psz_modulename )
{ {
p_spu->p_text->p_module = p_spu->p_text->p_module =
module_Need( p_spu->p_text, "text renderer", psz_modulename, VLC_TRUE ); module_Need( p_spu->p_text, "text renderer",
psz_modulename, VLC_TRUE );
} }
if( !p_spu->p_text->p_module ) if( !p_spu->p_text->p_module )
{ {
...@@ -541,17 +541,22 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -541,17 +541,22 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
if( p_spu->p_text ) if( p_spu->p_text )
{ {
if( p_subpic->i_original_picture_height > 0 && subpicture_region_t *p_text_region = p_subpic->p_region;
p_subpic->i_original_picture_width > 0 )
/* Only overwrite the size fields if the region is still in pre-rendered
* TEXT format. We have to traverse the subregion list because if more
* than one subregion is present, the text region isn't guarentteed to
* be the first in the list, and only text regions use this flag.
* All of this effort assists with the rescaling of text that has been
* rendered at native resolution, rather than video resolution.
*/
while( p_text_region &&
( p_text_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') ) )
{ {
p_spu->p_text->fmt_out.video.i_width = p_text_region = p_text_region->p_next;
p_spu->p_text->fmt_out.video.i_visible_width =
p_subpic->i_original_picture_width;
p_spu->p_text->fmt_out.video.i_height =
p_spu->p_text->fmt_out.video.i_visible_height =
p_subpic->i_original_picture_height;
} }
else
if( p_text_region )
{ {
p_spu->p_text->fmt_out.video.i_width = p_spu->p_text->fmt_out.video.i_width =
p_spu->p_text->fmt_out.video.i_visible_width = p_spu->p_text->fmt_out.video.i_visible_width =
...@@ -653,7 +658,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -653,7 +658,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
} }
/* Scale SPU if necessary */ /* Scale SPU if necessary */
if( p_region->p_cache ) if( p_region->p_cache &&
( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') ) )
{ {
if( (i_scale_width * p_region->fmt.i_width / 1000 != if( (i_scale_width * p_region->fmt.i_width / 1000 !=
p_region->p_cache->fmt.i_width) || p_region->p_cache->fmt.i_width) ||
...@@ -668,7 +674,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -668,7 +674,7 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
if( ( ( i_scale_width != 1000 ) || ( i_scale_height != 1000 ) ) && if( ( ( i_scale_width != 1000 ) || ( i_scale_height != 1000 ) ) &&
p_spu->p_scale && !p_region->p_cache && p_spu->p_scale && !p_region->p_cache &&
( VLC_FOURCC('R','G','B','A') != p_region->fmt.i_chroma /* FIXME */ ) ) ( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') ) )
{ {
picture_t *p_pic; picture_t *p_pic;
...@@ -708,8 +714,10 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -708,8 +714,10 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
free( p_pic ); free( p_pic );
} }
} }
if( ( ( i_scale_width != 1000 ) || ( i_scale_height != 1000 ) ) && if( ( ( i_scale_width != 1000 ) || ( i_scale_height != 1000 ) ) &&
p_spu->p_scale && p_region->p_cache ) p_spu->p_scale && p_region->p_cache &&
( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') ) )
{ {
p_region = p_region->p_cache; p_region = p_region->p_cache;
} }
...@@ -798,14 +806,6 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -798,14 +806,6 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
} }
} }
/* Update the output picture size */
p_spu->p_blend->fmt_out.video.i_width =
p_spu->p_blend->fmt_out.video.i_visible_width =
p_fmt->i_width;
p_spu->p_blend->fmt_out.video.i_height =
p_spu->p_blend->fmt_out.video.i_visible_height =
p_fmt->i_height;
if( p_subpic->b_fade ) if( p_subpic->b_fade )
{ {
mtime_t i_fade_start = ( p_subpic->i_stop + mtime_t i_fade_start = ( p_subpic->i_stop +
...@@ -821,10 +821,20 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, ...@@ -821,10 +821,20 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
i_x_offset = __MAX( i_x_offset, 0 ); i_x_offset = __MAX( i_x_offset, 0 );
i_y_offset = __MAX( i_y_offset, 0 ); i_y_offset = __MAX( i_y_offset, 0 );
p_spu->p_blend->pf_video_blend( p_spu->p_blend, p_pic_dst, if( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') )
p_pic_src, &p_region->picture, i_x_offset, i_y_offset, {
i_fade_alpha * p_subpic->i_alpha / 255 ); /* Update the output picture size */
p_spu->p_blend->fmt_out.video.i_width =
p_spu->p_blend->fmt_out.video.i_visible_width =
p_fmt->i_width;
p_spu->p_blend->fmt_out.video.i_height =
p_spu->p_blend->fmt_out.video.i_visible_height =
p_fmt->i_height;
p_spu->p_blend->pf_video_blend( p_spu->p_blend, p_pic_dst,
p_pic_src, &p_region->picture, i_x_offset, i_y_offset,
i_fade_alpha * p_subpic->i_alpha / 255 );
}
p_region = p_region->p_next; p_region = p_region->p_next;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment