FS-7513 fix all video mute related issues
This commit is contained in:
parent
22ec9c378e
commit
3e33920657
|
@ -359,7 +359,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width,
|
|||
SWITCH_DECLARE(switch_img_position_t) parse_img_position(const char *name);
|
||||
SWITCH_DECLARE(void) switch_img_find_position(switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP);
|
||||
SWITCH_DECLARE(switch_status_t) switch_img_convert(switch_image_t *src, switch_convert_fmt_t fmt, void *dest, switch_size_t *size);
|
||||
SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const char *text);
|
||||
SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_bool_t full, const char *text);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
@ -1271,7 +1271,7 @@ static void layer_set_logo(conference_member_t *member, mcu_layer_t *layer, cons
|
|||
|
||||
if (params) {
|
||||
if ((var = switch_event_get_header(params, "text"))) {
|
||||
layer->logo_text_img = switch_img_write_text_img(layer->screen_w, layer->screen_h, var);
|
||||
layer->logo_text_img = switch_img_write_text_img(layer->screen_w, layer->screen_h, SWITCH_FALSE, var);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1728,8 +1728,10 @@ static void vmute_snap(conference_member_t *member, switch_bool_t clear)
|
|||
switch_mutex_lock(member->conference->canvas->mutex);
|
||||
layer = &member->conference->canvas->layers[member->video_layer_id];
|
||||
switch_img_free(&layer->mute_img);
|
||||
|
||||
switch_img_free(&member->video_mute_img);
|
||||
|
||||
if (!clear && layer->cur_img) {
|
||||
switch_img_copy(layer->cur_img, &member->video_mute_img);
|
||||
switch_img_copy(layer->cur_img, &layer->mute_img);
|
||||
}
|
||||
|
||||
|
@ -2101,24 +2103,33 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
|
|||
if (switch_test_flag(imember, MFLAG_CAN_BE_SEEN)) {
|
||||
layer->mute_patched = 0;
|
||||
} else {
|
||||
switch_image_t *tmp;
|
||||
|
||||
if (img && img != imember->avatar_png_img) {
|
||||
switch_img_free(&img);
|
||||
}
|
||||
|
||||
if (!layer->mute_patched) {
|
||||
if (imember->video_mute_png || layer->mute_img) {
|
||||
clear_layer(conference->canvas, layer);
|
||||
|
||||
if (imember->video_mute_img || layer->mute_img) {
|
||||
clear_layer(conference->canvas, layer);
|
||||
|
||||
if (!layer->mute_img && imember->video_mute_img) {
|
||||
//layer->mute_img = switch_img_read_png(imember->video_mute_png, SWITCH_IMG_FMT_I420);
|
||||
switch_img_copy(imember->video_mute_img, &layer->mute_img);
|
||||
}
|
||||
|
||||
if (layer->mute_img) {
|
||||
scale_and_patch(conference, layer, layer->mute_img, SWITCH_TRUE);
|
||||
scale_and_patch(conference, layer, layer->mute_img, SWITCH_FALSE);
|
||||
}
|
||||
layer->mute_patched = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tmp = switch_img_write_text_img(layer->screen_w, layer->screen_h, SWITCH_TRUE, "VIDEO MUTED");
|
||||
switch_img_patch(conference->canvas->img, tmp, layer->x_pos, layer->y_pos);
|
||||
switch_img_free(&tmp);
|
||||
|
||||
layer->mute_patched = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -825,21 +825,22 @@ SWITCH_DECLARE(uint32_t) switch_img_txt_handle_render(switch_img_txt_handle_t *h
|
|||
#endif
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const char *text)
|
||||
SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_bool_t full, const char *text)
|
||||
{
|
||||
const char *fg ="#cccccc";
|
||||
const char *bg = "#142e55";
|
||||
const char *font_face = NULL;
|
||||
const char *fontsz = "4%";
|
||||
const char *txt = "Value Optimized Out!";
|
||||
char *txt = "Value Optimized Out!";
|
||||
int argc = 0;
|
||||
char *argv[6] = { 0 };
|
||||
switch_rgb_color_t bgcolor = { 0 };
|
||||
int width, font_size = 0;
|
||||
int pre_width = 0, width = 0, font_size = 0, height = 0;
|
||||
int len = 0;
|
||||
char *duptxt = strdup(text);
|
||||
switch_img_txt_handle_t *txthandle = NULL;
|
||||
switch_image_t *txtimg = NULL;
|
||||
int x = 0, y = 0;
|
||||
|
||||
if (strchr(text, ':')) {
|
||||
argc = switch_split(duptxt, ':', argv);
|
||||
|
@ -863,8 +864,8 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const c
|
|||
if (argc > 4) {
|
||||
txt = argv[4];
|
||||
}
|
||||
}
|
||||
|
||||
} else txt = duptxt;
|
||||
|
||||
if (!txt) txt = duptxt;
|
||||
|
||||
if (strrchr(fontsz, '%')) {
|
||||
|
@ -873,6 +874,9 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const c
|
|||
font_size = atoi(fontsz);
|
||||
}
|
||||
|
||||
while (*txt == ' ') txt++;
|
||||
while (end_of(txt) == ' ') end_of(txt) = '\0';
|
||||
|
||||
len = strlen(txt);
|
||||
|
||||
if (len < 5) len = 5;
|
||||
|
@ -880,17 +884,35 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const c
|
|||
switch_img_txt_handle_create(&txthandle, font_face, fg, bg, font_size, 0, NULL);
|
||||
switch_color_set_rgb(&bgcolor, bg);
|
||||
|
||||
width = switch_img_txt_handle_render(txthandle,
|
||||
NULL,
|
||||
font_size / 2, font_size / 2,
|
||||
txt, NULL, fg, bg, 0, 0);
|
||||
pre_width = switch_img_txt_handle_render(txthandle,
|
||||
NULL,
|
||||
font_size / 2, font_size / 2,
|
||||
txt, NULL, fg, bg, 0, 0);
|
||||
|
||||
txtimg = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, font_size * 2, 1);
|
||||
height = font_size * 2;
|
||||
|
||||
if (full && w > width) {
|
||||
width = w;
|
||||
} else {
|
||||
width = pre_width;
|
||||
}
|
||||
|
||||
|
||||
txtimg = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1);
|
||||
|
||||
|
||||
x = font_size / 2;
|
||||
y = font_size / 2;
|
||||
|
||||
if (full) {
|
||||
x = (txtimg->d_w / 2) - (pre_width / 2);
|
||||
}
|
||||
|
||||
|
||||
switch_img_fill(txtimg, 0, 0, txtimg->d_w, txtimg->d_h, &bgcolor);
|
||||
switch_img_txt_handle_render(txthandle,
|
||||
txtimg,
|
||||
font_size / 2, font_size / 2,
|
||||
x, y,
|
||||
txt, NULL, fg, bg, 0, 0);
|
||||
switch_img_txt_handle_destroy(&txthandle);
|
||||
return txtimg;
|
||||
|
|
Loading…
Reference in New Issue