From 5199939f48fa898b7c4a03661b68b3565c4d54b9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Jan 2018 15:02:39 -0600 Subject: [PATCH] FS-10893: [mod_conference] Add more banner text params #resolve --- .../mod_conference/conference_video.c | 60 ++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 2fab1a01a3..c1bd8ff425 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1168,19 +1168,75 @@ void conference_member_set_logo(conference_member_t *member, const char *path) if (params && (var = switch_event_get_header(params, "text"))) { switch_image_t *img = NULL; const char *tmp; - int x = 0, y = 0; + int x = 0, y = 0, center = 0, center_off = 0; + if ((tmp = switch_event_get_header(params, "center_offset"))) { + center_off = atoi(tmp); + if (center_off < 0) { + center_off = 0; + } + } + if ((tmp = switch_event_get_header(params, "text_x"))) { - x = atoi(tmp); + if (!strcasecmp(tmp, "center")) { + center = 1; + } else { + x = atoi(tmp); + if (x < 0) x = 0; + } } if ((tmp = switch_event_get_header(params, "text_y"))) { y = atoi(tmp); + if (y < 0) y = 0; } img = switch_img_write_text_img(member->video_logo->d_w, member->video_logo->d_h, SWITCH_FALSE, var); switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_NECESSARY); switch_img_attenuate(member->video_logo); + + if (center) { + x = center_off + ((member->video_logo->d_w - center_off - img->d_w) / 2); + } + + switch_img_patch(member->video_logo, img, x, y); + switch_img_free(&img); + } + + if (params && (var = switch_event_get_header(params, "alt_text"))) { + switch_image_t *img = NULL; + const char *tmp; + int x = 0, y = 0, center = 0, center_off = 0; + + if ((tmp = switch_event_get_header(params, "alt_center_offset"))) { + center_off = atoi(tmp); + if (center_off < 0) { + center_off = 0; + } + } + + if ((tmp = switch_event_get_header(params, "alt_text_x"))) { + if (!strcasecmp(tmp, "center")) { + center = 1; + } else { + x = atoi(tmp); + if (x < 0) x = 0; + } + } + + if ((tmp = switch_event_get_header(params, "alt_text_y"))) { + y = atoi(tmp); + if (y < 0) y = 0; + } + + img = switch_img_write_text_img(member->video_logo->d_w, member->video_logo->d_h, SWITCH_FALSE, var); + switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_NECESSARY); + switch_img_attenuate(member->video_logo); + + if (center) { + x = center_off + ((member->video_logo->d_w - center_off - img->d_w) / 2); + } + switch_img_patch(member->video_logo, img, x, y); switch_img_free(&img); }