mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-17 12:17:00 +00:00
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(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(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_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 (params) {
|
||||||
if ((var = switch_event_get_header(params, "text"))) {
|
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);
|
switch_mutex_lock(member->conference->canvas->mutex);
|
||||||
layer = &member->conference->canvas->layers[member->video_layer_id];
|
layer = &member->conference->canvas->layers[member->video_layer_id];
|
||||||
switch_img_free(&layer->mute_img);
|
switch_img_free(&layer->mute_img);
|
||||||
|
switch_img_free(&member->video_mute_img);
|
||||||
|
|
||||||
if (!clear && layer->cur_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);
|
switch_img_copy(layer->cur_img, &layer->mute_img);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2101,12 +2103,15 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
|
|||||||
if (switch_test_flag(imember, MFLAG_CAN_BE_SEEN)) {
|
if (switch_test_flag(imember, MFLAG_CAN_BE_SEEN)) {
|
||||||
layer->mute_patched = 0;
|
layer->mute_patched = 0;
|
||||||
} else {
|
} else {
|
||||||
|
switch_image_t *tmp;
|
||||||
|
|
||||||
if (img && img != imember->avatar_png_img) {
|
if (img && img != imember->avatar_png_img) {
|
||||||
switch_img_free(&img);
|
switch_img_free(&img);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!layer->mute_patched) {
|
if (!layer->mute_patched) {
|
||||||
if (imember->video_mute_png || layer->mute_img) {
|
|
||||||
|
if (imember->video_mute_img || layer->mute_img) {
|
||||||
clear_layer(conference->canvas, layer);
|
clear_layer(conference->canvas, layer);
|
||||||
|
|
||||||
if (!layer->mute_img && imember->video_mute_img) {
|
if (!layer->mute_img && imember->video_mute_img) {
|
||||||
@ -2115,10 +2120,16 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (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
|
#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 *fg ="#cccccc";
|
||||||
const char *bg = "#142e55";
|
const char *bg = "#142e55";
|
||||||
const char *font_face = NULL;
|
const char *font_face = NULL;
|
||||||
const char *fontsz = "4%";
|
const char *fontsz = "4%";
|
||||||
const char *txt = "Value Optimized Out!";
|
char *txt = "Value Optimized Out!";
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char *argv[6] = { 0 };
|
char *argv[6] = { 0 };
|
||||||
switch_rgb_color_t bgcolor = { 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;
|
int len = 0;
|
||||||
char *duptxt = strdup(text);
|
char *duptxt = strdup(text);
|
||||||
switch_img_txt_handle_t *txthandle = NULL;
|
switch_img_txt_handle_t *txthandle = NULL;
|
||||||
switch_image_t *txtimg = NULL;
|
switch_image_t *txtimg = NULL;
|
||||||
|
int x = 0, y = 0;
|
||||||
|
|
||||||
if (strchr(text, ':')) {
|
if (strchr(text, ':')) {
|
||||||
argc = switch_split(duptxt, ':', argv);
|
argc = switch_split(duptxt, ':', argv);
|
||||||
@ -863,7 +864,7 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const c
|
|||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
txt = argv[4];
|
txt = argv[4];
|
||||||
}
|
}
|
||||||
}
|
} else txt = duptxt;
|
||||||
|
|
||||||
if (!txt) txt = duptxt;
|
if (!txt) txt = duptxt;
|
||||||
|
|
||||||
@ -873,6 +874,9 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, const c
|
|||||||
font_size = atoi(fontsz);
|
font_size = atoi(fontsz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (*txt == ' ') txt++;
|
||||||
|
while (end_of(txt) == ' ') end_of(txt) = '\0';
|
||||||
|
|
||||||
len = strlen(txt);
|
len = strlen(txt);
|
||||||
|
|
||||||
if (len < 5) len = 5;
|
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_img_txt_handle_create(&txthandle, font_face, fg, bg, font_size, 0, NULL);
|
||||||
switch_color_set_rgb(&bgcolor, bg);
|
switch_color_set_rgb(&bgcolor, bg);
|
||||||
|
|
||||||
width = switch_img_txt_handle_render(txthandle,
|
pre_width = switch_img_txt_handle_render(txthandle,
|
||||||
NULL,
|
NULL,
|
||||||
font_size / 2, font_size / 2,
|
font_size / 2, font_size / 2,
|
||||||
txt, NULL, fg, bg, 0, 0);
|
txt, NULL, fg, bg, 0, 0);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
txtimg = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, font_size * 2, 1);
|
|
||||||
|
|
||||||
switch_img_fill(txtimg, 0, 0, txtimg->d_w, txtimg->d_h, &bgcolor);
|
switch_img_fill(txtimg, 0, 0, txtimg->d_w, txtimg->d_h, &bgcolor);
|
||||||
switch_img_txt_handle_render(txthandle,
|
switch_img_txt_handle_render(txthandle,
|
||||||
txtimg,
|
txtimg,
|
||||||
font_size / 2, font_size / 2,
|
x, y,
|
||||||
txt, NULL, fg, bg, 0, 0);
|
txt, NULL, fg, bg, 0, 0);
|
||||||
switch_img_txt_handle_destroy(&txthandle);
|
switch_img_txt_handle_destroy(&txthandle);
|
||||||
return txtimg;
|
return txtimg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user