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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 27 05:38:37 CST 2007


Author: rizzo
Date: Tue Nov 27 05:38:37 2007
New Revision: 89626

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89626
Log:
make this more tolerant to the absence of SDL_ttf

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

Modified: team/group/video_console/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/group/video_console/channels/chan_oss.c?view=diff&rev=89626&r1=89625&r2=89626
==============================================================================
--- team/group/video_console/channels/chan_oss.c (original)
+++ team/group/video_console/channels/chan_oss.c Tue Nov 27 05:38:37 2007
@@ -816,7 +816,7 @@
 	/* print received messages on gui */
 	/* XXX move x,y in the video_desc structure,
 	 * add w,h for the output screen, add checks for boundary */
-	if ( (env->sdl_ok) && (gui_output(env, text, 30, 20)) )
+	if (env->sdl_ok && !gui_output(env, text))
 		return 0;
 
 	/* print on gui failed, go to console */

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=89626&r1=89625&r2=89626
==============================================================================
--- team/group/video_console/channels/console_video.c (original)
+++ team/group/video_console/channels/console_video.c Tue Nov 27 05:38:37 2007
@@ -2272,8 +2272,12 @@
 }
 
 /* Print given text on the gui */
-static int gui_output(struct video_desc *env, const char *text, int x, int y)
-{
+static int gui_output(struct video_desc *env, const char *text)
+{
+#ifndef HAVE_SDL_TTF
+	return 1;	/* error, not supported */
+#else
+	int x = 30, y = 20;	/* XXX change */
 	SDL_Surface *output = NULL;
 	SDL_Color color = {0, 0, 0};	/* text color */
 	SDL_Rect dest = {env->win[WIN_KEYPAD].rect.x + x, y};
@@ -2281,26 +2285,18 @@
 	/* clean surface each rewrite */
 	SDL_BlitSurface(env->keypad, NULL, env->screen, &env->win[WIN_KEYPAD].rect);
 
-#ifdef HAVE_SDL_TTF
 	output = TTF_RenderText_Solid(env->font, text, color);
-#endif
 	if (output == NULL) {
 		ast_log(LOG_WARNING, "Cannot render text on gui - %s\n", TTF_GetError());
-		return 0;
+		return 1;
 	}
 
 	SDL_BlitSurface(output, NULL, env->screen, &dest);
 	
-#if 0
-	if (SDL_Flip(env->screen) < 0) {
-		ast_log(LOG_WARNING, "Error updating gui screen\n");
-		return 0;
-	}
-#endif
-
 	SDL_UpdateRects(env->keypad, 1, &env->win[WIN_KEYPAD].rect);
 	SDL_FreeSurface(output);
-	return 1;
+	return 0;	/* success */
+#endif
 }
 
 static void keypad_write_message(struct video_desc *env)




More information about the asterisk-commits mailing list