[vlc-commits] Add support for font height as a percentage of the video height
Devin Heitmueller
git at videolan.org
Mon Dec 31 14:00:04 CET 2012
vlc | branch: master | Devin Heitmueller <dheitmueller at kernellabs.com> | Thu Dec 27 01:08:22 2012 -0500| [75402b8f25030fff192738b462e985933be0360c] | committer: 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: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=75402b8f25030fff192738b462e985933be0360c
---
modules/codec/cc.c | 1 +
modules/codec/substext.h | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 5366fb4..7fd256d 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -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;
}
diff --git a/modules/codec/substext.h b/modules/codec/substext.h
index df9779c..68e6c61 100644
--- a/modules/codec/substext.h
+++ b/modules/codec/substext.h
@@ -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)
{
More information about the vlc-commits
mailing list