[MPlayer-cvslog] r25842 - in trunk: command.c input/input.c input/input.h

eugeni subversion at mplayerhq.hu
Wed Jan 23 22:18:32 CET 2008


Author: eugeni
Date: Wed Jan 23 22:18:32 2008
New Revision: 25842

Log:
Add ass_use_margins command and property to shift subtitles to margins and back
on the fly.


Modified:
   trunk/command.c
   trunk/input/input.c
   trunk/input/input.h

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	(original)
+++ trunk/command.c	Wed Jan 23 22:18:32 2008
@@ -1742,6 +1742,27 @@ static int mp_property_sub_visibility(m_
     }
 }
 
+#ifdef USE_ASS
+/// Use margins for libass subtitles (RW)
+static int mp_property_ass_use_margins(m_option_t * prop, int action,
+				      void *arg, MPContext * mpctx)
+{
+    if (!mpctx->sh_video)
+	return M_PROPERTY_UNAVAILABLE;
+
+    switch (action) {
+    case M_PROPERTY_SET:
+	if (!arg)
+	    return M_PROPERTY_ERROR;
+    case M_PROPERTY_STEP_UP:
+    case M_PROPERTY_STEP_DOWN:
+	ass_force_reload = 1;
+    default:
+	return m_property_flag(prop, action, arg, &ass_use_margins);
+    }
+}
+#endif
+
 /// Show only forced subtitles (RW)
 static int mp_property_sub_forced_only(m_option_t * prop, int action,
 				       void *arg, MPContext * mpctx)
@@ -2049,6 +2070,10 @@ static const m_option_t mp_properties[] 
     { "sub_scale", mp_property_sub_scale, CONF_TYPE_FLOAT,
      M_OPT_RANGE, 0, 100, NULL },
 #endif
+#ifdef USE_ASS
+    { "ass_use_margins", mp_property_ass_use_margins, CONF_TYPE_FLAG,
+     M_OPT_RANGE, 0, 1, NULL },
+#endif
 
 #ifdef USE_TV
     { "tv_brightness", mp_property_tv_color, CONF_TYPE_INT,
@@ -2177,6 +2202,9 @@ static struct {
 #ifdef HAVE_FREETYPE
     { "sub_scale", MP_CMD_SUB_SCALE, 0, 0, -1, MSGTR_SubScale},
 #endif
+#ifdef USE_ASS
+    { "ass_use_margins", MP_CMD_ASS_USE_MARGINS, 1, 0, -1, NULL },
+#endif
 #ifdef USE_TV
     { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness },
     { "tv_hue", MP_CMD_TV_SET_HUE, 0, OSD_HUE, -1, MSGTR_Hue },

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	(original)
+++ trunk/input/input.c	Wed Jan 23 22:18:32 2008
@@ -98,6 +98,9 @@ static const mp_cmd_t mp_cmds[] = {
   { MP_CMD_SUB_FILE, "sub_file", 0, { { MP_CMD_ARG_INT,{-2} }, {-1,{0}} } },
   { MP_CMD_SUB_LOG, "sub_log", 0, { {-1,{0}} } },
   { MP_CMD_SUB_SCALE, "sub_scale",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+#ifdef USE_ASS
+  { MP_CMD_ASS_USE_MARGINS, "ass_use_margins", 0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
+#endif
   { MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } },
   { MP_CMD_GET_TIME_POS, "get_time_pos", 0, { {-1,{0}} } },
   { MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } },

Modified: trunk/input/input.h
==============================================================================
--- trunk/input/input.h	(original)
+++ trunk/input/input.h	Wed Jan 23 22:18:32 2008
@@ -107,6 +107,7 @@
 #define MP_CMD_SUB_VOB 103
 #define MP_CMD_SUB_DEMUX 104
 #define MP_CMD_SWITCH_ANGLE 105
+#define MP_CMD_ASS_USE_MARGINS 106
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001



More information about the MPlayer-cvslog mailing list