Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
6cacb670
提交
6cacb670
authored
4月 21, 2015
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7513: add text to video logo in mod_conference
上级
bce3ca50
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
87 行增加
和
1 行删除
+87
-1
switch_core_video.h
src/include/switch_core_video.h
+1
-0
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+19
-1
switch_core_video.c
src/switch_core_video.c
+67
-0
没有找到文件。
src/include/switch_core_video.h
浏览文件 @
6cacb670
...
...
@@ -239,6 +239,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
);
/** @} */
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
6cacb670
...
...
@@ -404,6 +404,7 @@ typedef struct mcu_layer_s {
switch_image_t *cur_img;
switch_image_t *banner_img;
switch_image_t *logo_img;
switch_image_t *logo_text_img;
switch_image_t *mute_img;
switch_img_txt_handle_t *txthandle;
conference_file_node_t *fnode;
...
...
@@ -1019,6 +1020,7 @@ static void reset_layer(mcu_canvas_t *canvas, mcu_layer_t *layer)
switch_img_free(&layer->banner_img);
switch_img_free(&layer->logo_img);
switch_img_free(&layer->logo_text_img);
layer->banner_patched = 0;
layer->is_avatar = 0;
...
...
@@ -1108,6 +1110,13 @@ static void scale_and_patch(conference_obj_t *conference, mcu_layer_t *layer, sw
switch_img_fit(&layer->logo_img, ew, eh);
switch_img_find_position(layer->logo_pos, ew, eh, layer->logo_img->d_w, layer->logo_img->d_h, &ex, &ey);
switch_img_patch(IMG, layer->logo_img, x_pos + ex, y_pos + ey);
if (layer->logo_text_img) {
int tx = 0, ty = 0;
switch_img_find_position(POS_LEFT_BOT,
layer->logo_img->d_w, layer->logo_img->d_h, layer->logo_text_img->d_w, layer->logo_text_img->d_h, &tx, &ty);
switch_img_patch(IMG, layer->logo_text_img, x_pos + ex + tx, y_pos + ey + ty);
}
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "insert at %d,%d\n", 0, 0);
...
...
@@ -1187,6 +1196,7 @@ static void layer_set_logo(conference_member_t *member, mcu_layer_t *layer, cons
if (path) {
switch_img_free(&layer->logo_img);
switch_img_free(&layer->logo_text_img);
}
if (*path == '{') {
...
...
@@ -1232,7 +1242,13 @@ static void layer_set_logo(conference_member_t *member, mcu_layer_t *layer, cons
layer->logo_img = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB);
}
layer->logo_pos = pos;
if (layer->logo_img) {
layer->logo_pos = pos;
if ((var = switch_event_get_header(params, "text"))) {
layer->logo_text_img = switch_img_write_text_img(layer->screen_w, layer->screen_h, var);
}
}
if (params) switch_event_destroy(¶ms);
...
...
@@ -1330,6 +1346,7 @@ static void layer_set_banner(conference_member_t *member, mcu_layer_t *layer, co
switch_img_free(&layer->banner_img);
switch_img_free(&layer->logo_img);
switch_img_free(&layer->logo_text_img);
layer->banner_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, layer->screen_w, font_size * 2, 1);
if (layer->txthandle) {
...
...
@@ -2170,6 +2187,7 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
layer->banner_patched = 0;
switch_img_free(&layer->banner_img);
switch_img_free(&layer->logo_img);
switch_img_free(&layer->logo_text_img);
switch_img_free(&layer->mute_img);
switch_mutex_unlock(conference->canvas->mutex);
...
...
src/switch_core_video.c
浏览文件 @
6cacb670
...
...
@@ -744,6 +744,73 @@ SWITCH_DECLARE(switch_status_t) switch_img_txt_handle_render(switch_img_txt_hand
#endif
}
SWITCH_DECLARE
(
switch_image_t
*
)
switch_img_write_text_img
(
int
w
,
int
h
,
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!"
;
int
argc
=
0
;
char
*
argv
[
6
]
=
{
0
};
switch_rgb_color_t
bgcolor
=
{
0
};
int
width
,
font_size
=
0
;
int
len
=
0
;
char
*
duptxt
=
strdup
(
text
);
switch_img_txt_handle_t
*
txthandle
=
NULL
;
switch_image_t
*
txtimg
=
NULL
;
if
(
strchr
(
text
,
':'
))
{
argc
=
switch_split
(
duptxt
,
':'
,
argv
);
if
(
argc
>
0
)
{
fg
=
argv
[
0
];
}
if
(
argc
>
1
)
{
bg
=
argv
[
1
];
}
if
(
argc
>
2
)
{
font_face
=
argv
[
2
];
}
if
(
argc
>
3
)
{
fontsz
=
argv
[
3
];
}
if
(
argc
>
4
)
{
txt
=
argv
[
4
];
}
}
if
(
!
txt
)
txt
=
duptxt
;
if
(
strrchr
(
fontsz
,
'%'
))
{
font_size
=
1
+
((
int
)
(
float
)
h
*
(
atof
(
fontsz
)
/
100
.
0
f
));
}
else
{
font_size
=
atoi
(
fontsz
);
}
len
=
strlen
(
txt
);
if
(
len
<
5
)
len
=
5
;
width
=
(
int
)
(
float
)(
font_size
*
0
.
75
f
*
len
);
txtimg
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
width
,
font_size
*
2
,
1
);
switch_img_txt_handle_create
(
&
txthandle
,
font_face
,
fg
,
bg
,
font_size
,
0
,
NULL
);
switch_color_set_rgb
(
&
bgcolor
,
bg
);
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
,
txt
,
NULL
,
fg
,
bg
,
0
,
0
);
switch_img_txt_handle_destroy
(
&
txthandle
);
return
txtimg
;
}
/* WARNING:
patch a big IMG with a rect hole, note this function is WIP ......
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论