[vlc-commits] Render SSA subtitles at the size it is blended.
Laurent Aimar
git at videolan.org
Tue Apr 19 21:35:14 CEST 2011
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Apr 19 21:31:39 2011 +0200| [5546a96be4a5bf29475dd113c1375e8db776bb87] | committer: Laurent Aimar
Render SSA subtitles at the size it is blended.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5546a96be4a5bf29475dd113c1375e8db776bb87
---
modules/codec/libass.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index dfc3488..ec1ed47 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -325,24 +325,23 @@ static int SubpictureValidate( subpicture_t *p_subpic,
vlc_mutex_lock( &libass_lock );
- /* FIXME why this mix of src/dst */
video_format_t fmt = *p_fmt_dst;
fmt.i_chroma = VLC_CODEC_RGBA;
fmt.i_bits_per_pixel = 0;
- fmt.i_width =
- fmt.i_visible_width = p_fmt_src->i_width;
- fmt.i_height =
- fmt.i_visible_height = p_fmt_src->i_height;
- fmt.i_x_offset =
+ fmt.i_visible_width = fmt.i_width;
+ fmt.i_visible_height = fmt.i_height;
+ fmt.i_x_offset = 0;
fmt.i_y_offset = 0;
-
if( b_fmt_src || b_fmt_dst )
{
ass_set_frame_size( p_ass->p_renderer, fmt.i_width, fmt.i_height );
+ const double src_ratio = (double)p_fmt_src->i_width / p_fmt_src->i_height;
+ const double dst_ratio = (double)p_fmt_dst->i_width / p_fmt_dst->i_height;
+ const double factor = dst_ratio / src_ratio;
#if defined( LIBASS_VERSION ) && LIBASS_VERSION >= 0x00907000
- ass_set_aspect_ratio( p_ass->p_renderer, 1.0, 1.0 ); // TODO ?
+ ass_set_aspect_ratio( p_ass->p_renderer, factor, 1 );
#else
- ass_set_aspect_ratio( p_ass->p_renderer, 1.0 ); // TODO ?
+ ass_set_aspect_ratio( p_ass->p_renderer, factor );
#endif
p_ass->fmt = fmt;
}
More information about the vlc-commits
mailing list