[MPlayer-cvslog] r28820 - in trunk/libass: ass.c ass_render.c ass_types.h ass_utils.c ass_utils.h

greg subversion at mplayerhq.hu
Thu Mar 5 21:36:48 CET 2009


Author: greg
Date: Thu Mar  5 21:36:48 2009
New Revision: 28820

Log:
Support ScaledBorderAndShadow property.

Modified:
   trunk/libass/ass.c
   trunk/libass/ass_render.c
   trunk/libass/ass_types.h
   trunk/libass/ass_utils.c
   trunk/libass/ass_utils.h

Modified: trunk/libass/ass.c
==============================================================================
--- trunk/libass/ass.c	Thu Mar  5 21:36:44 2009	(r28819)
+++ trunk/libass/ass.c	Thu Mar  5 21:36:48 2009	(r28820)
@@ -520,6 +520,8 @@ static int process_info_line(ass_track_t
 		track->Timer = atof(str + 6);
 	} else if (!strncmp(str,"WrapStyle:", 10)) {
 		track->WrapStyle = atoi(str + 10);
+	} else if (!strncmp(str, "ScaledBorderAndShadow:", 22)) {
+		track->ScaledBorderAndShadow = parse_bool(str + 22);
 	}
 	return 0;
 }

Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	Thu Mar  5 21:36:44 2009	(r28819)
+++ trunk/libass/ass_render.c	Thu Mar  5 21:36:48 2009	(r28820)
@@ -2233,7 +2233,10 @@ static int ass_start_frame(ass_renderer_
 	
 	frame_context.font_scale = global_settings->font_size_coeff *
 	                           frame_context.orig_height / frame_context.track->PlayResY;
-	frame_context.border_scale = ((double)frame_context.orig_height) / frame_context.track->PlayResY;
+	if (frame_context.track->ScaledBorderAndShadow)
+		frame_context.border_scale = ((double)frame_context.orig_height) / frame_context.track->PlayResY;
+	else
+		frame_context.border_scale = 1.;
 
 	frame_context.font_scale_x = 1.;
 

Modified: trunk/libass/ass_types.h
==============================================================================
--- trunk/libass/ass_types.h	Thu Mar  5 21:36:44 2009	(r28819)
+++ trunk/libass/ass_types.h	Thu Mar  5 21:36:48 2009	(r28820)
@@ -105,6 +105,7 @@ typedef struct ass_track_s {
 	int PlayResY;
 	double Timer;
 	int WrapStyle;
+	char ScaledBorderAndShadow;
 
 	
 	int default_style; // index of default style

Modified: trunk/libass/ass_utils.c
==============================================================================
--- trunk/libass/ass_utils.c	Thu Mar  5 21:36:44 2009	(r28819)
+++ trunk/libass/ass_utils.c	Thu Mar  5 21:36:48 2009	(r28820)
@@ -96,6 +96,17 @@ int strtocolor(char** q, uint32_t* res)
 	return result;
 }
 
+// Return a boolean value for a string
+char parse_bool(char* str) {
+	while (*str == ' ' || *str == '\t')
+		str++;
+	if (!strncasecmp(str, "yes", 3))
+		return 1;
+	else if (strtol(str, NULL, 10) > 0)
+		return 1;
+	return 0;
+}
+
 #if 0
 static void sprint_tag(uint32_t tag, char* dst)
 {

Modified: trunk/libass/ass_utils.h
==============================================================================
--- trunk/libass/ass_utils.h	Thu Mar  5 21:36:44 2009	(r28819)
+++ trunk/libass/ass_utils.h	Thu Mar  5 21:36:48 2009	(r28820)
@@ -30,6 +30,7 @@ int mystrtoll(char** p, long long* res);
 int mystrtou32(char** p, int base, uint32_t* res);
 int mystrtod(char** p, double* res);
 int strtocolor(char** q, uint32_t* res);
+char parse_bool(char* str);
 
 static inline int d6_to_int(int x) {
 	return (x + 32) >> 6;



More information about the MPlayer-cvslog mailing list