[asterisk-commits] rizzo: trunk r94741 - in /trunk/channels: console_video.c console_video.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 23 08:51:00 CST 2007


Author: rizzo
Date: Sun Dec 23 08:51:00 2007
New Revision: 94741

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94741
Log:
support sdl_videodriver to send output to x11/aalib/console


Modified:
    trunk/channels/console_video.c
    trunk/channels/console_video.h

Modified: trunk/channels/console_video.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/console_video.c?view=diff&rev=94741&r1=94740&r2=94741
==============================================================================
--- trunk/channels/console_video.c (original)
+++ trunk/channels/console_video.c Sun Dec 23 08:51:00 2007
@@ -341,6 +341,8 @@
 	SDL_Surface             *screen;	/* the main window */
 	char			keypad_file[256];	/* image for the keypad */
 	char                    keypad_font[256];       /* font for the keypad */
+
+	char			sdl_videodriver[256];
 	struct display_window	win[WIN_MAX];
 };
 
@@ -2679,10 +2681,23 @@
 {
 	struct video_desc *env = arg;
 	int count = 0;
+	char save_display[128] = "";
 
 	env->screen = NULL;
 	bzero(env->win, sizeof(env->win));
 
+	/* if sdl_videodriver is set, override the environment. Also,
+	 * if it contains 'console' override DISPLAY around the call to SDL_Init
+	 * so we use the console as opposed to the x11 version of aalib
+	 */
+	if (!ast_strlen_zero(env->sdl_videodriver)) { /* override */
+		const char *s = getenv("DISPLAY");
+		setenv("SDL_VIDEODRIVER", env->sdl_videodriver, 1);
+		if (s && !strcasecmp(env->sdl_videodriver, "aalib-console")) {
+			ast_copy_string(save_display, s, sizeof(save_display));
+			unsetenv("DISPLAY");
+		}
+	}
 	if (SDL_Init(SDL_INIT_VIDEO)) {
 		ast_log(LOG_WARNING, "Could not initialize SDL - %s\n",
 			SDL_GetError());
@@ -2696,6 +2711,9 @@
 		if (!env->gui_ok)
 			ast_log(LOG_WARNING, "cannot init console gui\n");
 	}
+	if (!ast_strlen_zero(save_display))
+		setenv("DISPLAY", save_display, 1);
+
 	if (video_open(&env->out)) {
 		ast_log(LOG_WARNING, "cannot open local video source\n");
 	} else {
@@ -3301,6 +3319,7 @@
 	CV_STR("keypad", env->keypad_file);
 	CV_F("region", keypad_cfg_read(&env->gui, val));
 	CV_STR("keypad_font", env->keypad_font);
+	CV_STR("sdl_videodriver", env->sdl_videodriver);
 	CV_UINT("fps", env->out.fps);
 	CV_UINT("bitrate", env->out.bitrate);
 	CV_UINT("qmin", env->out.qmin);

Modified: trunk/channels/console_video.h
URL: http://svn.digium.com/view/asterisk/trunk/channels/console_video.h?view=diff&rev=94741&r1=94740&r2=94741
==============================================================================
--- trunk/channels/console_video.h (original)
+++ trunk/channels/console_video.h Sun Dec 23 08:51:00 2007
@@ -37,6 +37,7 @@
         "console {videodevice|videocodec|sendvideo"     \
         "|video_size|bitrate|fps|qmin"                  \
         "|keypad|keypad_mask|keypad_entry"              \
+	"|sdl_videodriver"				\
         "|device"					\
 	"}"
 




More information about the asterisk-commits mailing list