mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
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:
@@ -340,7 +340,6 @@ struct video_desc {
|
|||||||
int gui_ok;
|
int gui_ok;
|
||||||
SDL_Surface *screen; /* the main window */
|
SDL_Surface *screen; /* the main window */
|
||||||
char keypad_file[256]; /* image for the keypad */
|
char keypad_file[256]; /* image for the keypad */
|
||||||
char keypad_mask[256]; /* background for the keypad */
|
|
||||||
char keypad_font[256]; /* font for the keypad */
|
char keypad_font[256]; /* font for the keypad */
|
||||||
struct display_window win[WIN_MAX];
|
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:
|
Configuration options control the appeareance of the gui:
|
||||||
|
|
||||||
keypad = /tmp/phone.jpg ; the keypad on the screen
|
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
|
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);
|
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;
|
int fd = -1;
|
||||||
void *p = NULL;
|
void *p = NULL;
|
||||||
off_t l = 0;
|
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.w = env->gui.keypad->w;
|
||||||
env->out.keypad_dpy.h = env->gui.keypad->h;
|
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;
|
e = (const unsigned char *)p + l;
|
||||||
for (s = p; s < e - 20 ; s++) {
|
for (s = p; s < e - 20 ; s++) {
|
||||||
if (!memcmp(s, region, reg_len)) { /* keyword found */
|
if (!memcmp(s, region, reg_len)) { /* keyword found */
|
||||||
ast_log(LOG_WARNING, "found entry\n");
|
|
||||||
/* reset previous entries */
|
/* reset previous entries */
|
||||||
keypad_cfg_read(&env->gui, "reset");
|
keypad_cfg_read(&env->gui, "reset");
|
||||||
break;
|
break;
|
||||||
@@ -2990,7 +2970,31 @@ static void sdl_setup(struct video_desc *env)
|
|||||||
munmap(p, l);
|
munmap(p, l);
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
close(fd);
|
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 */
|
#define BORDER 5 /* border around our windows */
|
||||||
maxw = env->in.rem_dpy.w + env->out.loc_dpy.w + env->out.keypad_dpy.w;
|
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);
|
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)
|
if (gui->kp_size == gui->kp_used)
|
||||||
return 0;
|
return 0;
|
||||||
ast_log(LOG_WARNING, "allocated entry %d\n", gui->kp_used);
|
|
||||||
gui->kp[gui->kp_used++] = e;
|
gui->kp[gui->kp_used++] = e;
|
||||||
return 1;
|
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_F("remote_size", video_geom(&env->in.rem_dpy, val));
|
||||||
CV_STR("keypad", env->keypad_file);
|
CV_STR("keypad", env->keypad_file);
|
||||||
CV_F("region", keypad_cfg_read(&env->gui, val));
|
CV_F("region", keypad_cfg_read(&env->gui, val));
|
||||||
CV_STR("keypad_mask", env->keypad_mask);
|
|
||||||
CV_STR("keypad_font", env->keypad_font);
|
CV_STR("keypad_font", env->keypad_font);
|
||||||
CV_UINT("fps", env->out.fps);
|
CV_UINT("fps", env->out.fps);
|
||||||
CV_UINT("bitrate", env->out.bitrate);
|
CV_UINT("bitrate", env->out.bitrate);
|
||||||
|
Reference in New Issue
Block a user