[MPlayer-dev-eng] [PATCH] support for changing font size during playback
compn
tempn at twmi.rr.com
Sun Feb 27 02:29:31 CET 2005
i found this patch in incoming/ and thought i'd post it here.
http://mplayerhq.hu/MPlayer/incoming/MPlayer%20Addon%20-%20Dynamicly%20TTF%20Fonts/
i repeat, this is NOT my patch, here is his message/patch:
Hello,
My name is Korneliusz , i'm write patch (addon) to MPlayer 1.0pre6a with
--disable-gui option. This patch add dynamiclly scalling truetype fonts on
playing movie .
F1 - decrase subtitle font size
F2 - increase subtitle font
F3 - decrase osd font size
F4 - increase osd font
F5 - decrase font blur
F6 - increase font blur
F7 - decrase font outline
F8 - increase font outline
:) i will be very happy if you add this patch to next relase MPlayer
Regrads
Korneliusz Jarzebski
korneliusz at dna.ltd.pl
diff -urN MPlayer-1.0pre6a-orginal/input/input.c MPlayer-1.0pre6a-fixed/input/input.c
--- MPlayer-1.0pre6a-orginal/input/input.c2004-12-02 14:37:16.000000000 +0000
+++ MPlayer-1.0pre6a-fixed/input/input.c2005-02-12 20:37:32.000000000 +0000
@@ -67,6 +67,10 @@
{ MP_CMD_PLAY_ALT_SRC_STEP, "alt_src_step",1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } },
{ MP_CMD_SUB_DELAY, "sub_delay",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_SUB_STEP, "sub_step",1, { { MP_CMD_ARG_INT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+ { MP_CMD_SUB_SIZE, "sub_size",1, { { MP_CMD_ARG_FLOAT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+ { MP_CMD_SUB_OSD_SIZE, "sub_osd_size",1, { { MP_CMD_ARG_FLOAT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+ { MP_CMD_SUB_BLUR, "sub_blur",1, { { MP_CMD_ARG_FLOAT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+ { MP_CMD_SUB_OUTLINE, "sub_outline",1, { { MP_CMD_ARG_FLOAT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_OSD, "osd",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
{ MP_CMD_OSD_SHOW_TEXT, "osd_show_text", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
{ MP_CMD_VOLUME, "volume", 1, { { MP_CMD_ARG_INT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
@@ -338,6 +342,16 @@
{ { 'r', 0 }, "gui_preferences" },
{ { 'c', 0 }, "gui_skinbrowser" },
#endif
+#ifdef HAVE_FREETYPE
+ { { KEY_F+1, 0 }, "sub_size -0.2" },
+ { { KEY_F+2, 0 }, "sub_size +0.2" },
+ { { KEY_F+3, 0 }, "sub_osd_size -0.2" },
+ { { KEY_F+4, 0 }, "sub_osd_size +0.2" },
+ { { KEY_F+5, 0 }, "sub_blur -0.2" },
+ { { KEY_F+6, 0 }, "sub_blur +0.2" },
+ { { KEY_F+7, 0 }, "sub_outline -0.2" },
+ { { KEY_F+8, 0 }, "sub_outline +0.2" },
+#endif
#ifdef HAVE_JOYSTICK
{ { JOY_AXIS0_PLUS, 0 }, "seek 10" },
{ { JOY_AXIS0_MINUS, 0 }, "seek -10" },
diff -urN MPlayer-1.0pre6a-orginal/input/input.h MPlayer-1.0pre6a-fixed/input/input.h
--- MPlayer-1.0pre6a-orginal/input/input.h2004-12-02 14:37:16.000000000 +0000
+++ MPlayer-1.0pre6a-fixed/input/input.h2005-02-12 20:38:11.000000000 +0000
@@ -63,6 +63,11 @@
#define MP_CMD_SPEED_SET 59
#define MP_CMD_RUN 60
+#define MP_CMD_SUB_SIZE 4000
+#define MP_CMD_SUB_BLUR 4001
+#define MP_CMD_SUB_OUTLINE 4002
+#define MP_CMD_SUB_OSD_SIZE 4003
+
#define MP_CMD_GUI_EVENTS 5000
#define MP_CMD_GUI_LOADFILE 5001
#define MP_CMD_GUI_LOADSUBTITLE 5002
diff -urN MPlayer-1.0pre6a-orginal/libvo/font_load_ft.c MPlayer-1.0pre6a-fixed/libvo/font_load_ft.c
--- MPlayer-1.0pre6a-orginal/libvo/font_load_ft.c2004-10-28 01:15:52.000000000 +0000
+++ MPlayer-1.0pre6a-fixed/libvo/font_load_ft.c2005-02-12 20:39:10.000000000 +0000
@@ -41,10 +41,10 @@
char *get_path(char *filename);
char *subtitle_font_encoding = NULL;
-float text_font_scale_factor = 5.0;
-float osd_font_scale_factor = 6.0;
-float subtitle_font_radius = 2.0;
-float subtitle_font_thickness = 2.0;
+float text_font_scale_factor = 2.4;
+float osd_font_scale_factor = 2.4;
+float subtitle_font_radius = 2.4;
+float subtitle_font_thickness = 2.4;
// 0 = no autoscale
// 1 = video height
// 2 = video width
diff -urN MPlayer-1.0pre6a-orginal/mplayer.c MPlayer-1.0pre6a-fixed/mplayer.c
--- MPlayer-1.0pre6a-orginal/mplayer.c2004-12-21 12:25:58.000000000 +0000
+++ MPlayer-1.0pre6a-fixed/mplayer.c2005-02-12 20:43:00.000000000 +0000
@@ -972,6 +972,10 @@
int osd_show_sub_pos = 0;
int osd_show_sub_visibility = 0;
int osd_show_sub_alignment = 0;
+int osd_show_sub_size = 0;
+int osd_show_sub_blur = 0;
+int osd_show_sub_outline = 0;
+int osd_show_osd_size = 0;
int osd_show_vobsub_changed = 0;
int osd_show_sub_changed = 0;
int osd_show_percentage = 0;
@@ -3302,6 +3306,75 @@
}
#endif
} break;
+ case MP_CMD_SUB_SIZE:
+ {
+#ifdef HAVE_FREETYPE
+ if (sh_video) {
+ float v = cmd->args[0].v.f;
+ text_font_scale_factor += v;
+ if (text_font_scale_factor > 5) text_font_scale_factor = 5;
+ if (text_font_scale_factor < 1) text_font_scale_factor = 1;
+ force_load_font = 1;
+#ifdef USE_OSD
+ vo_osd_changed(OSDTYPE_SUBTITLE);
+ osd_show_sub_size = 4;
+#endif
+ }
+#endif
+ } break;
+ case MP_CMD_SUB_OSD_SIZE:
+ {
+#ifdef HAVE_FREETYPE
+ if (sh_video) {
+ float v = cmd->args[0].v.f;
+ osd_font_scale_factor += v;
+ if (osd_font_scale_factor > 5) osd_font_scale_factor = 5;
+ if (osd_font_scale_factor < 1) osd_font_scale_factor = 1;
+ force_load_font = 1;
+#ifdef USE_OSD
+ float vol;
+ vo_osd_progbar_type=OSD_VOLUME;
+ mixer_getbothvolume(&mixer, &vol);
+ vo_osd_progbar_value=(vol*256.0)/100.0;
+ vo_osd_changed(OSDTYPE_PROGBAR);
+ osd_show_osd_size = 4;
+#endif
+ }
+#endif
+ } break;
+ case MP_CMD_SUB_BLUR:
+ {
+#ifdef HAVE_FREETYPE
+ if (sh_video) {
+ float v = cmd->args[0].v.f;
+ if (subtitle_font_radius < 5 && subtitle_font_radius > 1) subtitle_font_radius += v;
+ subtitle_font_radius += v;
+ if (subtitle_font_radius > 5) subtitle_font_radius = 5;
+ if (subtitle_font_radius < 1) subtitle_font_radius = 1;
+ force_load_font = 1;
+#ifdef USE_OSD
+ vo_osd_changed(OSDTYPE_SUBTITLE);
+ osd_show_sub_blur = 4;
+#endif
+ }
+#endif
+ } break;
+ case MP_CMD_SUB_OUTLINE:
+ {
+#ifdef HAVE_FREETYPE
+ if (sh_video) {
+ float v = cmd->args[0].v.f;
+ subtitle_font_thickness += v;
+ if (subtitle_font_thickness > 5) subtitle_font_thickness = 5;
+ if (subtitle_font_thickness < 1) subtitle_font_thickness = 1;
+ force_load_font = 1;
+#ifdef USE_OSD
+ vo_osd_changed(OSDTYPE_SUBTITLE);
+ osd_show_sub_outline = 4;
+#endif
+ }
+#endif
+ } break;
case MP_CMD_SUB_ALIGNMENT:
{
#ifdef USE_SUB
@@ -3928,6 +4001,24 @@
snprintf(osd_text_tmp, 63, "Sub position: %d/100", sub_pos);
osd_show_sub_pos--;
} else
+#ifdef HAVE_FREETYPE
+ if (osd_show_osd_size) {
+ snprintf(osd_text_tmp, 63, "OSD Font size : %0.1f", osd_font_scale_factor);
+ osd_show_osd_size--;
+ } else
+ if (osd_show_sub_size) {
+ snprintf(osd_text_tmp, 63, "Font size : %0.1f", text_font_scale_factor);
+ osd_show_sub_size--;
+ } else
+ if (osd_show_sub_blur) {
+ snprintf(osd_text_tmp, 63, "Font blur : %0.1f", subtitle_font_radius);
+ osd_show_sub_blur--;
+ } else
+ if (osd_show_sub_outline) {
+ snprintf(osd_text_tmp, 63, "Font outline : %0.1f", subtitle_font_thickness);
+ osd_show_sub_outline--;
+ } else
+#endif
if (osd_show_sub_alignment) {
snprintf(osd_text_tmp, 63, "Sub alignment: %s",
(sub_alignment == 2 ? "bottom" :
More information about the MPlayer-dev-eng
mailing list