Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f6c7421a
提交
f6c7421a
authored
2月 12, 2015
作者:
Seven Du
提交者:
Anthony Minessale
5月 27, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7506 FS-7513: refactor with rgb color space to support anti aliasing
上级
a6a8a99d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
140 行增加
和
74 行删除
+140
-74
switch_core_video.h
src/include/switch_core_video.h
+16
-10
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+19
-19
switch_core_video.c
src/switch_core_video.c
+105
-45
没有找到文件。
src/include/switch_core_video.h
浏览文件 @
f6c7421a
...
@@ -50,7 +50,11 @@ typedef struct switch_yuv_color_s {
...
@@ -50,7 +50,11 @@ typedef struct switch_yuv_color_s {
uint8_t
v
;
uint8_t
v
;
}
switch_yuv_color_t
;
}
switch_yuv_color_t
;
typedef
struct
switch_rgb_color_s
{
uint8_t
r
;
uint8_t
g
;
uint8_t
b
;
}
switch_rgb_color_t
;
/**\brief Representation of a rectangle on a surface */
/**\brief Representation of a rectangle on a surface */
typedef
struct
switch_image_rect
{
typedef
struct
switch_image_rect
{
...
@@ -164,26 +168,28 @@ SWITCH_DECLARE(void) switch_img_flip(switch_image_t *img);
...
@@ -164,26 +168,28 @@ SWITCH_DECLARE(void) switch_img_flip(switch_image_t *img);
*/
*/
SWITCH_DECLARE
(
void
)
switch_img_free
(
switch_image_t
**
img
);
SWITCH_DECLARE
(
void
)
switch_img_free
(
switch_image_t
**
img
);
SWITCH_DECLARE
(
void
)
switch_img_draw_text
(
switch_image_t
*
IMG
,
int
x
,
int
y
,
switch_
yuv
_color_t
color
,
uint16_t
font_size
,
char
*
text
);
SWITCH_DECLARE
(
void
)
switch_img_draw_text
(
switch_image_t
*
IMG
,
int
x
,
int
y
,
switch_
rgb
_color_t
color
,
uint16_t
font_size
,
char
*
text
);
SWITCH_DECLARE
(
void
)
switch_img_add_text
(
void
*
buffer
,
int
w
,
int
x
,
int
y
,
char
*
s
);
SWITCH_DECLARE
(
void
)
switch_img_add_text
(
void
*
buffer
,
int
w
,
int
x
,
int
y
,
char
*
s
);
SWITCH_DECLARE
(
switch_image_t
*
)
switch_img_copy_rect
(
switch_image_t
*
img
,
int
x
,
int
y
,
int
w
,
int
h
);
SWITCH_DECLARE
(
switch_image_t
*
)
switch_img_copy_rect
(
switch_image_t
*
img
,
int
x
,
int
y
,
int
w
,
int
h
);
SWITCH_DECLARE
(
void
)
switch_img_fill
(
switch_image_t
*
img
,
int
x
,
int
y
,
int
w
,
int
h
,
switch_
yuv_color_t
color
);
SWITCH_DECLARE
(
void
)
switch_img_fill
(
switch_image_t
*
img
,
int
x
,
int
y
,
int
w
,
int
h
,
switch_
rgb_color_t
*
color
);
SWITCH_DECLARE
(
void
)
switch_img_draw_pixel
(
switch_image_t
*
img
,
int
x
,
int
y
,
switch_yuv_color_t
color
);
SWITCH_DECLARE
(
void
)
switch_img_draw_pixel
(
switch_image_t
*
img
,
int
x
,
int
y
,
switch_yuv_color_t
*
color
);
SWITCH_DECLARE
(
void
)
switch_color_set
(
switch_yuv_color_t
*
color
,
const
char
*
color_str
);
SWITCH_DECLARE
(
void
)
switch_color_set_rgb
(
switch_rgb_color_t
*
color
,
const
char
*
color_str
);
SWITCH_DECLARE
(
void
)
switch_color_set_yuv
(
switch_yuv_color_t
*
color
,
const
char
*
color_str
);
SWITCH_DECLARE
(
void
)
switch_color_rgb2yuv
(
switch_rgb_color_t
*
rgb
,
switch_yuv_color_t
*
yuv
);
SWITCH_DECLARE
(
switch_status_t
)
switch_img_txt_handle_create
(
switch_img_txt_handle_t
**
handleP
,
const
char
*
font_family
,
SWITCH_DECLARE
(
switch_status_t
)
switch_img_txt_handle_create
(
switch_img_txt_handle_t
**
handleP
,
const
char
*
font_family
,
const
char
*
font_color
,
uint16_t
font_size
,
double
angle
,
switch_memory_pool_t
*
pool
);
const
char
*
font_color
,
const
char
*
bgcolor
,
uint16_t
font_size
,
double
angle
,
switch_memory_pool_t
*
pool
);
SWITCH_DECLARE
(
void
)
switch_img_txt_handle_destroy
(
switch_img_txt_handle_t
**
handleP
);
SWITCH_DECLARE
(
void
)
switch_img_txt_handle_destroy
(
switch_img_txt_handle_t
**
handleP
);
SWITCH_DECLARE
(
switch_status_t
)
switch_img_txt_handle_render
(
switch_img_txt_handle_t
*
handle
,
switch_image_t
*
img
,
SWITCH_DECLARE
(
switch_status_t
)
switch_img_txt_handle_render
(
switch_img_txt_handle_t
*
handle
,
switch_image_t
*
img
,
int
x
,
int
y
,
const
char
*
text
,
int
x
,
int
y
,
const
char
*
text
,
const
char
*
font_family
,
const
char
*
font_color
,
uint16_t
font_size
,
double
angle
);
const
char
*
font_family
,
const
char
*
font_color
,
const
char
*
bgcolor
,
uint16_t
font_size
,
double
angle
);
/** @} */
/** @} */
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
f6c7421a
...
@@ -376,7 +376,7 @@ typedef struct mcu_canvas_s {
...
@@ -376,7 +376,7 @@ typedef struct mcu_canvas_s {
int
total_layers
;
int
total_layers
;
int
layers_used
;
int
layers_used
;
int
layout_floor_id
;
int
layout_floor_id
;
switch_
yuv
_color_t bgcolor;
switch_
rgb
_color_t
bgcolor
;
switch_mutex_t
*
mutex
;
switch_mutex_t
*
mutex
;
switch_mutex_t
*
cond_mutex
;
switch_mutex_t
*
cond_mutex
;
switch_mutex_t
*
cond2_mutex
;
switch_mutex_t
*
cond2_mutex
;
...
@@ -891,9 +891,9 @@ static int mcu_canvas_wake(mcu_canvas_t *mcu_canvas)
...
@@ -891,9 +891,9 @@ static int mcu_canvas_wake(mcu_canvas_t *mcu_canvas)
return
0
;
return
0
;
}
}
static void reset_image(switch_image_t *img, switch_
yuv
_color_t *color)
static
void
reset_image
(
switch_image_t
*
img
,
switch_
rgb
_color_t
*
color
)
{
{
switch_img_fill(img, 0, 0, img->w, img->h,
*
color);
switch_img_fill
(
img
,
0
,
0
,
img
->
w
,
img
->
h
,
color
);
}
}
#define SCALE_FACTOR 360.0f
#define SCALE_FACTOR 360.0f
...
@@ -1004,7 +1004,7 @@ static void scale_and_patch(conference_obj_t *conference, mcu_layer_t *layer)
...
@@ -1004,7 +1004,7 @@ static void scale_and_patch(conference_obj_t *conference, mcu_layer_t *layer)
static
void
set_canvas_bgcolor
(
mcu_canvas_t
*
canvas
,
char
*
color
)
static
void
set_canvas_bgcolor
(
mcu_canvas_t
*
canvas
,
char
*
color
)
{
{
switch_color_set(&canvas->bgcolor, color);
switch_color_set
_rgb
(
&
canvas
->
bgcolor
,
color
);
reset_image
(
canvas
->
img
,
&
canvas
->
bgcolor
);
reset_image
(
canvas
->
img
,
&
canvas
->
bgcolor
);
}
}
...
@@ -1051,7 +1051,7 @@ static void detach_video_layer(conference_member_t *member)
...
@@ -1051,7 +1051,7 @@ static void detach_video_layer(conference_member_t *member)
static
void
layer_set_banner
(
mcu_canvas_t
*
canvas
,
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;
switch_
rgb
_color_t
fgcolor
,
bgcolor
;
int
font_scale
=
4
;
int
font_scale
=
4
;
int
font_size
=
0
;
int
font_size
=
0
;
const
char
*
fg
=
"#cccccc"
;
const
char
*
fg
=
"#cccccc"
;
...
@@ -1099,8 +1099,8 @@ static void layer_set_banner(mcu_canvas_t *canvas, mcu_layer_t *layer, const cha
...
@@ -1099,8 +1099,8 @@ static void layer_set_banner(mcu_canvas_t *canvas, mcu_layer_t *layer, const cha
font_size
=
(
double
)(
font_scale
/
100
.
0
f
)
*
layer
->
screen_h
;
font_size
=
(
double
)(
font_scale
/
100
.
0
f
)
*
layer
->
screen_h
;
switch_color_set(&fgcolor, fg);
switch_color_set
_rgb
(
&
fgcolor
,
fg
);
switch_color_set(&bgcolor, bg);
switch_color_set
_rgb
(
&
bgcolor
,
bg
);
switch_img_free
(
&
layer
->
banner_img
);
switch_img_free
(
&
layer
->
banner_img
);
layer
->
banner_img
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
layer
->
screen_w
,
font_size
*
2
,
1
);
layer
->
banner_img
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
layer
->
screen_w
,
font_size
*
2
,
1
);
...
@@ -1110,10 +1110,10 @@ static void layer_set_banner(mcu_canvas_t *canvas, mcu_layer_t *layer, const cha
...
@@ -1110,10 +1110,10 @@ static void layer_set_banner(mcu_canvas_t *canvas, mcu_layer_t *layer, const cha
switch_img_txt_handle_destroy
(
&
layer
->
txthandle
);
switch_img_txt_handle_destroy
(
&
layer
->
txthandle
);
}
}
switch_img_txt_handle_create(&layer->txthandle, font_face, fg, font_size, 0, NULL);
switch_img_txt_handle_create
(
&
layer
->
txthandle
,
font_face
,
fg
,
"#000000"
,
font_size
,
0
,
NULL
);
reset_image
(
layer
->
banner_img
,
&
bgcolor
);
reset_image
(
layer
->
banner_img
,
&
bgcolor
);
switch_img_txt_handle_render(layer->txthandle, layer->banner_img, font_size / 2, font_size / 2, text, NULL, NULL, 0, 0);
switch_img_txt_handle_render
(
layer
->
txthandle
,
layer
->
banner_img
,
font_size
/
2
,
font_size
/
2
,
text
,
NULL
,
NULL
,
NULL
,
0
,
0
);
if
(
params
)
switch_event_destroy
(
&
params
);
if
(
params
)
switch_event_destroy
(
&
params
);
switch_safe_free
(
dup
);
switch_safe_free
(
dup
);
...
@@ -1126,7 +1126,7 @@ static switch_status_t attach_video_layer(conference_member_t *member, int idx)
...
@@ -1126,7 +1126,7 @@ static switch_status_t attach_video_layer(conference_member_t *member, int idx)
const
char
*
res_id
=
NULL
;
const
char
*
res_id
=
NULL
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
const
char
*
banner
=
NULL
;
const
char
*
banner
=
NULL
;
switch_
yuv
_color_t color;
switch_
rgb
_color_t
color
;
if
(
!
member
->
session
)
abort
();
if
(
!
member
->
session
)
abort
();
...
@@ -1169,8 +1169,8 @@ static switch_status_t attach_video_layer(conference_member_t *member, int idx)
...
@@ -1169,8 +1169,8 @@ static switch_status_t attach_video_layer(conference_member_t *member, int idx)
}
}
switch_color_set(&color, "#000000");
switch_color_set
_rgb
(
&
color
,
"#000000"
);
switch_img_fill(member->conference->canvas->img, layer->x_pos, layer->y_pos, layer->screen_w, layer->screen_h, color);
switch_img_fill
(
member
->
conference
->
canvas
->
img
,
layer
->
x_pos
,
layer
->
y_pos
,
layer
->
screen_w
,
layer
->
screen_h
,
&
color
);
end:
end:
...
@@ -1541,19 +1541,19 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
...
@@ -1541,19 +1541,19 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
}
}
}
}
if (
0
) {
if
(
1
)
{
switch_img_txt_handle_t
*
txthandle
=
NULL
;
switch_img_txt_handle_t
*
txthandle
=
NULL
;
switch_
yuv
_color_t color;
switch_
rgb
_color_t
color
;
switch_img_txt_handle_create
(
&
txthandle
,
"/usr/share/fonts/truetype/Microsoft/Verdana.ttf"
,
switch_img_txt_handle_create
(
&
txthandle
,
"/usr/share/fonts/truetype/Microsoft/Verdana.ttf"
,
"#FFFFFF", 24, 0, NULL);
"#FFFFFF"
,
"#000000"
,
24
,
0
,
NULL
);
switch_img_txt_handle_render(txthandle, conference->canvas->img, 10, 10, "W00t this works!", NULL, NULL, 0, 0);
switch_img_txt_handle_render
(
txthandle
,
conference
->
canvas
->
img
,
10
,
10
,
"W00t this works!"
,
NULL
,
NULL
,
NULL
,
0
,
0
);
switch_color_set(&color, "#FF0000");
switch_color_set
_rgb
(
&
color
,
"#FF0000"
);
switch_img_fill(conference->canvas->img, 300, 10, 400, 40, color);
switch_img_fill
(
conference
->
canvas
->
img
,
300
,
10
,
400
,
40
,
&
color
);
switch_img_txt_handle_render(txthandle, conference->canvas->img, 300, 22, "W00t this works!", NULL, NULL, 0, 0);
switch_img_txt_handle_render
(
txthandle
,
conference
->
canvas
->
img
,
300
,
22
,
"W00t this works!"
,
NULL
,
NULL
,
"#FF0000"
,
0
,
0
);
switch_img_txt_handle_destroy
(
&
txthandle
);
switch_img_txt_handle_destroy
(
&
txthandle
);
...
...
src/switch_core_video.c
浏览文件 @
f6c7421a
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论