Commit 75402b8f authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Rafaël Carré

Add support for font height as a percentage of the video height

In order to get consistent EIA-608 caption positioning, we need to be able
to size the fonts based on the size of the video.  Add support for
specifying the font height as a percentage of the video.
Signed-off-by: default avatarRafaël Carré <funman@videolan.org>
parent 2393f442
......@@ -330,6 +330,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
p_spu_sys->align = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT;
p_spu_sys->text = psz_subtitle;
p_spu_sys->html = psz_html;
p_spu_sys->i_font_height_percent = 5;
return p_spu;
}
......
......@@ -5,6 +5,7 @@ struct subpicture_updater_sys_t {
int align;
int x;
int y;
int i_font_height_percent;
bool is_fixed;
int fixed_width;
......@@ -80,6 +81,18 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
r->i_x = sys->x * fmt_dst->i_width / sys->fixed_width;
r->i_y = sys->y * fmt_dst->i_height / sys->fixed_height;
}
if (sys->i_font_height_percent != 0)
{
r->p_style = text_style_New();
if (r->p_style)
{
r->p_style->i_font_size = sys->i_font_height_percent *
subpic->i_original_picture_height / 100;
r->p_style->i_font_color = 0xffffff;
r->p_style->i_font_alpha = 0xff;
}
}
}
static void SubpictureTextDestroy(subpicture_t *subpic)
{
......
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