提交 d7127764 authored 作者: Anthony Minessale's avatar Anthony Minessale 提交者: Michael Jerris

FS-7506 FS-7513: banner update

上级 0697db4f
......@@ -2,8 +2,8 @@ include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_conference
mod_LTLIBRARIES = mod_conference.la
mod_conference_la_SOURCES = mod_conference.c utf8.c
mod_conference_la_CFLAGS = $(AM_CFLAGS) -I. -I/usr/include/freetype2
mod_conference_la_SOURCES = mod_conference.c
mod_conference_la_CFLAGS = $(AM_CFLAGS) -I.
mod_conference_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_conference_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lyuv -lfreetype
......
......@@ -929,25 +929,26 @@ static void scale_and_patch(conference_obj_t *conference, mcu_layer_t *layer)
if (layer->geometry.scale) {
int img_w = 0, img_h = 0;
double screen_aspect = 0, img_aspect = 0;
int x_pos = layer->x_pos;
int y_pos = layer->y_pos;
img_w = layer->screen_w = IMG->d_w * layer->geometry.scale / SCALE_FACTOR;
img_h = layer->screen_h = IMG->d_h * layer->geometry.scale / SCALE_FACTOR;
layer->x_pos = IMG->d_w * layer->geometry.x / SCALE_FACTOR;
layer->y_pos = IMG->d_h * layer->geometry.y / SCALE_FACTOR;
screen_aspect = (double) layer->screen_w / layer->screen_h;
img_aspect = (double) img->d_w / img->d_h;
if (screen_aspect > img_aspect) {
img_w = img_aspect * layer->screen_h;
layer->x_pos += (layer->screen_w - img_w) / 2;
x_pos += (layer->screen_w - img_w) / 2;
} else if (screen_aspect < img_aspect) {
img_h = layer->screen_w / img_aspect;
layer->y_pos += (layer->screen_h - img_h) / 2;
y_pos += (layer->screen_h - img_h) / 2;
}
/*int I420Scale(const uint8* src_y, int src_stride_y,
const uint8* src_u, int src_stride_u,
const uint8* src_v, int src_stride_v,
......@@ -989,7 +990,7 @@ static void scale_and_patch(conference_obj_t *conference, mcu_layer_t *layer)
// reserv the bottom room for text, e.g. caller id
// switch_img_set_rect(layer->img, 0, 0, layer->img->d_w, layer->img->d_h - 20);
}
switch_img_patch(IMG, layer->img, layer->x_pos, layer->y_pos);
switch_img_patch(IMG, layer->img, x_pos, y_pos);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "insert at %d,%d\n", 0, 0);
......@@ -1048,10 +1049,11 @@ static void detach_video_layer(conference_member_t *member)
switch_mutex_unlock(member->conference->canvas->mutex);
}
static void layer_set_banner(mcu_layer_t *layer, const char *text)
static void layer_set_banner(mcu_canvas_t *canvas, mcu_layer_t *layer, const char *text)
{
switch_yuv_color_t fgcolor, bgcolor;
int font_size = 24;
int font_scale = 4;
int font_size = 0;
const char *fg = "#cccccc";
const char *bg = "#142e55";
char *parsed = NULL;
......@@ -1080,14 +1082,18 @@ static void layer_set_banner(mcu_layer_t *layer, const char *text)
font_face = var;
}
if ((var = switch_event_get_header(params, "font_size"))) {
if ((var = switch_event_get_header(params, "font_scale"))) {
int tmp = atoi(var);
if (tmp >= 5 && tmp <= 50) {
font_size = tmp;
font_scale = tmp;
}
}
}
font_size = (double)(font_scale / 100.0f) * layer->screen_h;
switch_color_set(&fgcolor, fg);
switch_color_set(&bgcolor, bg);
......@@ -1115,6 +1121,7 @@ static switch_status_t attach_video_layer(conference_member_t *member, int idx)
const char *res_id = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
const char *banner = NULL;
switch_yuv_color_t color;
if (!member->session) abort();
......@@ -1144,7 +1151,7 @@ static switch_status_t attach_video_layer(conference_member_t *member, int idx)
}
if ((banner = switch_channel_get_variable_dup(channel, "video_banner_text", SWITCH_FALSE, -1))) {
layer_set_banner(layer, banner);
layer_set_banner(member->conference->canvas, layer, banner);
}
layer->member_id = member->id;
......@@ -1155,6 +1162,11 @@ static switch_status_t attach_video_layer(conference_member_t *member, int idx)
if (layer->geometry.audio_position) {
conf_api_sub_position(member, NULL, layer->geometry.audio_position);
}
switch_color_set(&color, "#000000");
switch_img_fill(member->conference->canvas->img, layer->x_pos, layer->y_pos, layer->screen_w, layer->screen_h, color);
end:
......
#include <stdarg.h>
/* is c the start of a utf8 sequence? */
#define isutf(c) (((c)&0xC0)!=0x80)
/* convert UTF-8 data to wide character */
int u8_toucs(uint32_t *dest, int sz, char *src, int srcsz);
/* the opposite conversion */
int u8_toutf8(char *dest, int sz, uint32_t *src, int srcsz);
/* single character to UTF-8 */
int u8_wc_toutf8(char *dest, uint32_t ch);
/* character number to byte offset */
int u8_offset(char *str, int charnum);
/* byte offset to character number */
int u8_charnum(char *s, int offset);
/* return next character, updating an index variable */
uint32_t u8_nextchar(char *s, int *i);
/* move to next character */
void u8_inc(char *s, int *i);
/* move to previous character */
void u8_dec(char *s, int *i);
/* returns length of next utf-8 sequence */
int u8_seqlen(char *s);
/* assuming src points to the character after a backslash, read an
escape sequence, storing the result in dest and returning the number of
input characters processed */
int u8_read_escape_sequence(char *src, uint32_t *dest);
/* given a wide character, convert it to an ASCII escape sequence stored in
buf, where buf is "sz" bytes. returns the number of characters output.*/
int u8_escape_wchar(char *buf, int sz, uint32_t ch);
/* convert a string "src" containing escape sequences to UTF-8 */
int u8_unescape(char *buf, int sz, char *src);
/* convert UTF-8 "src" to ASCII with escape sequences.
if escape_quotes is nonzero, quote characters will be preceded by
backslashes as well. */
int u8_escape(char *buf, int sz, char *src, int escape_quotes);
/* utility predicates used by the above */
int octal_digit(char c);
int hex_digit(char c);
/* return a pointer to the first occurrence of ch in s, or NULL if not
found. character index of found character returned in *charn. */
char *u8_strchr(char *s, uint32_t ch, int *charn);
/* same as the above, but searches a buffer of a given size instead of
a NUL-terminated string. */
char *u8_memchr(char *s, uint32_t ch, size_t sz, int *charn);
/* count the number of characters in a UTF-8 string */
int u8_strlen(char *s);
int u8_is_locale_utf8(char *locale);
/* printf where the format string and arguments may be in UTF-8.
you can avoid this function and just use ordinary printf() if the current
locale is UTF-8. */
int u8_vprintf(char *fmt, va_list ap);
int u8_printf(char *fmt, ...);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论