[asterisk-commits] rizzo: branch group/video_console r90671 - /team/group/video_console/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 3 15:27:50 CST 2007


Author: rizzo
Date: Mon Dec  3 15:27:49 2007
New Revision: 90671

URL: http://svn.digium.com/view/asterisk?view=rev&rev=90671
Log:
fix handling of window resize when reducing size.

Modified:
    team/group/video_console/channels/console_video.c

Modified: team/group/video_console/channels/console_video.c
URL: http://svn.digium.com/view/asterisk/team/group/video_console/channels/console_video.c?view=diff&rev=90671&r1=90670&r2=90671
==============================================================================
--- team/group/video_console/channels/console_video.c (original)
+++ team/group/video_console/channels/console_video.c Mon Dec  3 15:27:49 2007
@@ -2935,12 +2935,11 @@
 /*
  * Parse a geometry string, accepting also common names for the formats.
  * Trick: if we have a leading > or < and a numeric geometry,
- * we return the larger or smaller one.
+ * return the larger or smaller one.
  * E.g. <352x288 gives the smaller one, 320x240
  */
 static int video_geom(struct fbuf_t *b, const char *s)
 {
-	int mode = 0;
 	int w = 0, h = 0;
 
 	static struct {
@@ -2953,26 +2952,25 @@
 		{"sqcif",	128, 96 },
 		{NULL,		0, 0 },
 	};
-	if (s[0] == '<')
-		mode = -1;
-	else if (s[0] == '>')
-		mode = 1;
-	if (mode)
+	if (*s == '<' || *s == '>')
 		sscanf(s+1,"%dx%d", &w, &h);
 	for (fp = formats; fp->s; fp++) {
-		if (mode > 0 && fp->w <= w) {	/* look for a larger one */
-			if (fp > formats)	/* back one step if possible */
-				fp--;
-			break;
-		} else if (mode < 0 && fp->w < w) { /* look for a smaller one */
-			if (fp->w == 0)		/* back one if reached the end */
-				fp--;
-			break;
-		} else if (mode == 0 && !strcasecmp(s, fp->s)) { /* look for a string match */
+		if (*s == '>') {	/* look for a larger one */
+			if (fp->w <= w) {
+				if (fp > formats)
+					fp--; /* back one step if possible */
+				break;
+			}
+		} else if (*s == '<') {	/* look for a smaller one */
+			if (fp->w < w)
+				break;
+		} else if (!strcasecmp(s, fp->s)) { /* look for a string */
 			break;
 		}
 	}
-	if (fp) {
+	if (*s == '<' && fp->s == NULL)	/* smallest */
+		fp--;
+	if (fp->s) {
 		b->w = fp->w;
 		b->h = fp->h;
 	} else if (sscanf(s, "%dx%d", &b->w, &b->h) != 2) {




More information about the asterisk-commits mailing list