diff --git a/channels/console_video.c b/channels/console_video.c index f35813e3cc..87148d3b0c 100644 --- a/channels/console_video.c +++ b/channels/console_video.c @@ -2926,6 +2926,8 @@ static void sdl_setup(struct video_desc *env) * You can add it to a jpeg file using wrjpgcom */ do { /* only once, in fact */ + const char region[] = "region"; + int reg_len = strlen(region); const unsigned char *s, *e; fd = open(env->keypad_file, O_RDONLY); @@ -2945,8 +2947,10 @@ static void sdl_setup(struct video_desc *env) } e = (const unsigned char *)p + l; for (s = p; s < e - 20 ; s++) { - if (!memcmp(s, "keypad_entry", 12)) { /* keyword found */ + 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; } } @@ -2957,9 +2961,9 @@ static void sdl_setup(struct video_desc *env) continue; if (*s > 127) /* likely end of comment */ break; - if (memcmp(s, "keypad_entry", 12)) /* keyword not found */ + if (memcmp(s, region, reg_len)) /* keyword not found */ break; - s += 12; + s += reg_len; l = MIN(sizeof(buf), e - s); ast_copy_string(buf, s, l); s1 = ast_skip_blanks(buf); /* between token and '=' */ @@ -3148,7 +3152,6 @@ static int keypad_cfg_read(struct gui_info *gui, const char *val) if (gui->kp) { gui->kp_used = 0; } - ret = 1; break; case 5: /* token circle xc yc diameter */ if (strcasecmp(s2, "circle")) /* invalid */ @@ -3286,7 +3289,7 @@ int console_video_config(struct video_desc **penv, CV_F("local_size", video_geom(&env->out.loc_dpy, val)); CV_F("remote_size", video_geom(&env->in.rem_dpy, val)); CV_STR("keypad", env->keypad_file); - CV_F("keypad_entry", 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_UINT("fps", env->out.fps); diff --git a/configs/oss.conf.sample b/configs/oss.conf.sample index ee2355099f..24b0b38ee1 100644 --- a/configs/oss.conf.sample +++ b/configs/oss.conf.sample @@ -102,7 +102,7 @@ ; which is a lot more convenient to manage. ; E.g. for jpeg you can write them with wrjpgcom (part of libjpeg). ; The format to define keys is -; keypad_entry = x0 y0 x1 y1 h +; region = x0 y0 x1 y1 h ; where is the event to be generated (a digit, pickup, hangup,...) ; is the shape of the region (currently 'rect' and 'circle' are ; supported, the latter is really an ellipse), x0 y0 x1 y1 are the @@ -112,23 +112,23 @@ ; [my_skin](!) keypad = /tmp/keypad.jpg - keypad_entry = 1 rect 19 18 67 18 28 - keypad_entry = 2 rect 84 18 133 18 28 - keypad_entry = 3 rect 152 18 201 18 28 - keypad_entry = 4 rect 19 60 67 60 28 - keypad_entry = 5 rect 84 60 133 60 28 - keypad_entry = 6 rect 152 60 201 60 28 - keypad_entry = 7 rect 19 103 67 103 28 - keypad_entry = 8 rect 84 103 133 103 28 - keypad_entry = 9 rect 152 103 201 103 28 - keypad_entry = * rect 19 146 67 146 28 - keypad_entry = 0 rect 84 146 133 146 28 - keypad_entry = # rect 152 146 201 146 28 - keypad_entry = pickup rect 229 15 267 15 40 - keypad_entry = hangup rect 230 66 270 64 40 - keypad_entry = mute circle 232 141 264 141 33 - keypad_entry = sendvideo circle 235 185 266 185 33 - keypad_entry = autoanswer rect 228 212 275 212 50 + region = 1 rect 19 18 67 18 28 + region = 2 rect 84 18 133 18 28 + region = 3 rect 152 18 201 18 28 + region = 4 rect 19 60 67 60 28 + region = 5 rect 84 60 133 60 28 + region = 6 rect 152 60 201 60 28 + region = 7 rect 19 103 67 103 28 + region = 8 rect 84 103 133 103 28 + region = 9 rect 152 103 201 103 28 + region = * rect 19 146 67 146 28 + region = 0 rect 84 146 133 146 28 + region = # rect 152 146 201 146 28 + region = pickup rect 229 15 267 15 40 + region = hangup rect 230 66 270 64 40 + region = mute circle 232 141 264 141 33 + region = sendvideo circle 235 185 266 185 33 + region = autoanswer rect 228 212 275 212 50 ; uncomment this line to add video support ; [default](+,my_video,my_skin)