move reading info from the keypad to a separate function.

Remove an unused keypad field and some debugging messages.
Adjust formatting on config file parsing


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2007-12-23 14:34:17 +00:00
parent 2f592c52bd
commit c5e36e822e

View File

@@ -340,7 +340,6 @@ struct video_desc {
int gui_ok;
SDL_Surface *screen; /* the main window */
char keypad_file[256]; /* image for the keypad */
char keypad_mask[256]; /* background for the keypad */
char keypad_font[256]; /* font for the keypad */
struct display_window win[WIN_MAX];
};
@@ -2221,7 +2220,6 @@ to implement keypad functionalities or to drag the capture device.
Configuration options control the appeareance of the gui:
keypad = /tmp/phone.jpg ; the keypad on the screen
keypad_mask = /tmp/phone.png ; the grayscale mask
keypad_font = /tmp/font.ttf ; the font to use for output
*
@@ -2891,36 +2889,19 @@ void console_video_start(struct video_desc *env, struct ast_channel *owner)
}
static int keypad_cfg_read(struct gui_info *gui, const char *val);
/* [re]set the main sdl window, useful in case of resize */
static void sdl_setup(struct video_desc *env)
static void keypad_setup(struct video_desc *env)
{
int dpy_fmt = SDL_IYUV_OVERLAY; /* YV12 causes flicker in SDL */
int depth, maxw, maxh;
const SDL_VideoInfo *info = SDL_GetVideoInfo();
/* We want at least 16bpp to support YUV overlays.
* E.g with SDL_VIDEODRIVER = aalib the default is 8
*/
depth = info->vfmt->BitsPerPixel;
if (depth < 16)
depth = 16;
/*
* initialize the SDL environment. We have one large window
* with local and remote video, and a keypad.
* At the moment we arrange them statically, as follows:
* - on the left, the remote video;
* - on the center, the keypad
* - on the right, the local video
*/
/* Fetch the keypad now, we need it to know its size */
if (!env->gui.keypad)
env->gui.keypad = get_keypad(env->keypad_file);
if (env->gui.keypad) {
int fd = -1;
void *p = NULL;
off_t l = 0;
if (env->gui.keypad)
return;
env->gui.keypad = get_keypad(env->keypad_file);
if (!env->gui.keypad)
return;
env->out.keypad_dpy.w = env->gui.keypad->w;
env->out.keypad_dpy.h = env->gui.keypad->h;
/*
@@ -2955,7 +2936,6 @@ static void sdl_setup(struct video_desc *env)
e = (const unsigned char *)p + l;
for (s = p; s < e - 20 ; s++) {
if (!memcmp(s, region, reg_len)) { /* keyword found */
ast_log(LOG_WARNING, "found entry\n");
/* reset previous entries */
keypad_cfg_read(&env->gui, "reset");
break;
@@ -2990,7 +2970,31 @@ static void sdl_setup(struct video_desc *env)
munmap(p, l);
if (fd >= 0)
close(fd);
}
}
/* [re]set the main sdl window, useful in case of resize */
static void sdl_setup(struct video_desc *env)
{
int dpy_fmt = SDL_IYUV_OVERLAY; /* YV12 causes flicker in SDL */
int depth, maxw, maxh;
const SDL_VideoInfo *info = SDL_GetVideoInfo();
/* We want at least 16bpp to support YUV overlays.
* E.g with SDL_VIDEODRIVER = aalib the default is 8
*/
depth = info->vfmt->BitsPerPixel;
if (depth < 16)
depth = 16;
/*
* initialize the SDL environment. We have one large window
* with local and remote video, and a keypad.
* At the moment we arrange them statically, as follows:
* - on the left, the remote video;
* - on the center, the keypad
* - on the right, the local video
*/
keypad_setup(env);
#define BORDER 5 /* border around our windows */
maxw = env->in.rem_dpy.w + env->out.loc_dpy.w + env->out.keypad_dpy.w;
maxh = MAX( MAX(env->in.rem_dpy.h, env->out.loc_dpy.h), env->out.keypad_dpy.h);
@@ -3226,7 +3230,6 @@ static int keypad_cfg_read(struct gui_info *gui, const char *val)
}
if (gui->kp_size == gui->kp_used)
return 0;
ast_log(LOG_WARNING, "allocated entry %d\n", gui->kp_used);
gui->kp[gui->kp_used++] = e;
return 1;
}
@@ -3297,7 +3300,6 @@ int console_video_config(struct video_desc **penv,
CV_F("remote_size", video_geom(&env->in.rem_dpy, val));
CV_STR("keypad", env->keypad_file);
CV_F("region", keypad_cfg_read(&env->gui, val));
CV_STR("keypad_mask", env->keypad_mask);
CV_STR("keypad_font", env->keypad_font);
CV_UINT("fps", env->out.fps);
CV_UINT("bitrate", env->out.bitrate);