Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
91d62b7c
提交
91d62b7c
authored
2月 24, 2017
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10050 polish
上级
be245edf
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
404 行增加
和
74 行删除
+404
-74
configure.ac
configure.ac
+4
-4
switch_core_video.h
src/include/switch_core_video.h
+19
-1
mod_video_filter.c
src/mod/applications/mod_video_filter/mod_video_filter.c
+27
-12
switch_core_video.c
src/switch_core_video.c
+346
-51
switch_rtp.c
src/switch_rtp.c
+8
-6
没有找到文件。
configure.ac
浏览文件 @
91d62b7c
...
@@ -412,12 +412,12 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
...
@@ -412,12 +412,12 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
LIBS="$LIBS -m64"
LIBS="$LIBS -m64"
fi
fi
elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC
-ffast-math
)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC
-ffast-math
)
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC
-ffast-math
)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC
-ffast-math
)
AC_SUBST([AM_MOD_AVMD_CXXFLAGS], [-std=gnu99]) # FS-8809, needed for MAP_POPULATE
AC_SUBST([AM_MOD_AVMD_CXXFLAGS], [-std=gnu99]) # FS-8809, needed for MAP_POPULATE
if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then
if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
...
...
src/include/switch_core_video.h
浏览文件 @
91d62b7c
...
@@ -77,6 +77,24 @@ typedef struct switch_rgb_color_s {
...
@@ -77,6 +77,24 @@ typedef struct switch_rgb_color_s {
uint8_t
b
;
uint8_t
b
;
}
switch_rgb_color_t
;
}
switch_rgb_color_t
;
typedef
struct
switch_hsl_color_s
{
double
h
;
double
s
;
double
l
;
}
switch_hsl_color_t
;
typedef
struct
{
double
l
;
double
a
;
double
b
;
}
switch_lab_color_t
;
typedef
struct
{
double
x
;
double
y
;
double
z
;
}
switch_xyz_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
{
unsigned
int
x
;
/**< leftmost column */
unsigned
int
x
;
/**< leftmost column */
...
@@ -391,7 +409,7 @@ SWITCH_DECLARE(switch_status_t) switch_I420_copy2(uint8_t *src_planes[], int src
...
@@ -391,7 +409,7 @@ SWITCH_DECLARE(switch_status_t) switch_I420_copy2(uint8_t *src_planes[], int src
/*!\brief chromakey an img, img must be RGBA and return modified img */
/*!\brief chromakey an img, img must be RGBA and return modified img */
SWITCH_DECLARE
(
void
)
switch_img_chromakey
(
switch_image_t
*
img
,
switch_rgb_color_t
*
mask
,
int
threshold
);
SWITCH_DECLARE
(
void
)
switch_img_chromakey
(
switch_image_t
*
img
,
switch_rgb_color_t
*
mask
,
int
threshold
);
SWITCH_DECLARE
(
void
)
switch_img_chromakey_multi
(
switch_image_t
*
img
,
switch_rgb_color_t
*
mask
,
int
*
thresholds
,
int
count
);
SWITCH_DECLARE
(
void
)
switch_img_chromakey_multi
(
switch_image_t
*
img
,
switch_
image_t
*
cache_img
,
switch_
rgb_color_t
*
mask
,
int
*
thresholds
,
int
count
);
SWITCH_END_EXTERN_C
SWITCH_END_EXTERN_C
...
...
src/mod/applications/mod_video_filter/mod_video_filter.c
浏览文件 @
91d62b7c
...
@@ -43,8 +43,10 @@ SWITCH_MODULE_DEFINITION(mod_video_filter, mod_video_filter_load, mod_video_filt
...
@@ -43,8 +43,10 @@ SWITCH_MODULE_DEFINITION(mod_video_filter, mod_video_filter_load, mod_video_filt
typedef
struct
chromakey_context_s
{
typedef
struct
chromakey_context_s
{
int
threshold
;
int
threshold
;
switch_image_t
*
bgimg
;
switch_image_t
*
bgimg
;
switch_image_t
*
backup_img
;
switch_image_t
*
bgimg_scaled
;
switch_image_t
*
bgimg_scaled
;
switch_image_t
*
last_img
;
void
*
data
;
switch_size_t
datalen
;
switch_file_handle_t
vfh
;
switch_file_handle_t
vfh
;
switch_rgb_color_t
bgcolor
;
switch_rgb_color_t
bgcolor
;
switch_rgb_color_t
mask
[
MAX_MASK
];
switch_rgb_color_t
mask
[
MAX_MASK
];
...
@@ -69,6 +71,9 @@ static void uninit_context(chromakey_context_t *context)
...
@@ -69,6 +71,9 @@ static void uninit_context(chromakey_context_t *context)
switch_core_file_close
(
&
context
->
vfh
);
switch_core_file_close
(
&
context
->
vfh
);
memset
(
&
context
->
vfh
,
0
,
sizeof
(
context
->
vfh
));
memset
(
&
context
->
vfh
,
0
,
sizeof
(
context
->
vfh
));
}
}
switch_img_free
(
&
context
->
last_img
);
switch_safe_free
(
context
->
data
);
}
}
static
void
parse_params
(
chromakey_context_t
*
context
,
int
start
,
int
argc
,
char
**
argv
,
const
char
**
function
,
switch_media_bug_flag_t
*
flags
)
static
void
parse_params
(
chromakey_context_t
*
context
,
int
start
,
int
argc
,
char
**
argv
,
const
char
**
function
,
switch_media_bug_flag_t
*
flags
)
...
@@ -76,6 +81,9 @@ static void parse_params(chromakey_context_t *context, int start, int argc, char
...
@@ -76,6 +81,9 @@ static void parse_params(chromakey_context_t *context, int start, int argc, char
int
n
=
argc
-
start
;
int
n
=
argc
-
start
;
int
i
=
start
;
int
i
=
start
;
switch_core_session_request_video_refresh
(
context
->
session
);
switch_core_media_gen_key_frame
(
context
->
session
);
switch_mutex_lock
(
context
->
command_mutex
);
switch_mutex_lock
(
context
->
command_mutex
);
if
(
n
>
0
&&
argv
[
i
])
{
// color
if
(
n
>
0
&&
argv
[
i
])
{
// color
...
@@ -183,7 +191,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
...
@@ -183,7 +191,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
chromakey_context_t
*
context
=
(
chromakey_context_t
*
)
user_data
;
chromakey_context_t
*
context
=
(
chromakey_context_t
*
)
user_data
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_image_t
*
img
=
NULL
;
switch_image_t
*
img
=
NULL
;
void
*
data
=
NULL
;
switch_size_t
bytes
;
if
(
!
switch_channel_ready
(
channel
))
{
if
(
!
switch_channel_ready
(
channel
))
{
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
...
@@ -194,17 +202,27 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
...
@@ -194,17 +202,27 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
}
}
if
(
switch_mutex_trylock
(
context
->
command_mutex
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_mutex_trylock
(
context
->
command_mutex
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_img_patch
(
frame
->
img
,
context
->
backup
_img
,
0
,
0
);
switch_img_patch
(
frame
->
img
,
context
->
last
_img
,
0
,
0
);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
data
=
malloc
(
frame
->
img
->
d_w
*
frame
->
img
->
d_h
*
4
);
bytes
=
frame
->
img
->
d_w
*
frame
->
img
->
d_h
*
4
;
switch_assert
(
data
);
if
(
bytes
>
context
->
datalen
)
{
context
->
data
=
realloc
(
context
->
data
,
bytes
);
context
->
datalen
=
bytes
;
}
switch_assert
(
context
->
data
);
switch_img_to_raw
(
frame
->
img
,
context
->
data
,
frame
->
img
->
d_w
*
4
,
SWITCH_IMG_FMT_ARGB
);
img
=
switch_img_wrap
(
NULL
,
SWITCH_IMG_FMT_ARGB
,
frame
->
img
->
d_w
,
frame
->
img
->
d_h
,
1
,
context
->
data
);
switch_img_to_raw
(
frame
->
img
,
data
,
frame
->
img
->
d_w
*
4
,
SWITCH_IMG_FMT_ARGB
);
img
=
switch_img_wrap
(
NULL
,
SWITCH_IMG_FMT_ARGB
,
frame
->
img
->
d_w
,
frame
->
img
->
d_h
,
1
,
data
);
switch_assert
(
img
);
switch_assert
(
img
);
switch_img_chromakey_multi
(
img
,
context
->
mask
,
context
->
thresholds
,
context
->
mask_len
);
switch_img_chromakey_multi
(
img
,
context
->
last_img
,
context
->
mask
,
context
->
thresholds
,
context
->
mask_len
);
switch_img_free
(
&
context
->
last_img
);
switch_img_copy
(
img
,
&
context
->
last_img
);
if
(
context
->
bgimg
)
{
if
(
context
->
bgimg
)
{
if
(
context
->
bgimg_scaled
&&
(
context
->
bgimg_scaled
->
d_w
!=
frame
->
img
->
d_w
||
context
->
bgimg_scaled
->
d_h
!=
frame
->
img
->
d_h
))
{
if
(
context
->
bgimg_scaled
&&
(
context
->
bgimg_scaled
->
d_w
!=
frame
->
img
->
d_w
||
context
->
bgimg_scaled
->
d_h
!=
frame
->
img
->
d_h
))
{
...
@@ -261,10 +279,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
...
@@ -261,10 +279,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
}
}
switch_img_patch
(
frame
->
img
,
img
,
0
,
0
);
switch_img_patch
(
frame
->
img
,
img
,
0
,
0
);
switch_img_free
(
&
context
->
backup_img
);
switch_img_copy
(
frame
->
img
,
&
context
->
backup_img
);
switch_img_free
(
&
img
);
switch_img_free
(
&
img
);
free
(
data
);
switch_mutex_unlock
(
context
->
command_mutex
);
switch_mutex_unlock
(
context
->
command_mutex
);
...
@@ -313,7 +328,7 @@ SWITCH_STANDARD_APP(chromakey_start_function)
...
@@ -313,7 +328,7 @@ SWITCH_STANDARD_APP(chromakey_start_function)
char
*
argv
[
4
]
=
{
0
};
char
*
argv
[
4
]
=
{
0
};
int
argc
;
int
argc
;
char
*
lbuf
;
char
*
lbuf
;
switch_media_bug_flag_t
flags
=
SMBF_READ_VIDEO_PING
|
SMBF_READ_VIDEO_PATCH
;
switch_media_bug_flag_t
flags
=
SMBF_READ_VIDEO_PING
;
//
SMBF_READ_VIDEO_PATCH;
const
char
*
function
=
"chromakey"
;
const
char
*
function
=
"chromakey"
;
chromakey_context_t
*
context
;
chromakey_context_t
*
context
;
...
...
src/switch_core_video.c
浏览文件 @
91d62b7c
差异被折叠。
点击展开。
src/switch_rtp.c
浏览文件 @
91d62b7c
...
@@ -6672,12 +6672,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -6672,12 +6672,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
}
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_PROXY_MEDIA
])
{
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_PROXY_MEDIA
])
{
pt
=
2
00000
;
pt
=
1
00000
;
}
}
if
(
rtp_session
->
vb
)
{
if
(
rtp_session
->
vb
)
{
if
(
switch_jb_poll
(
rtp_session
->
vb
))
{
if
(
switch_jb_poll
(
rtp_session
->
vb
))
{
pt
=
0
;
pt
=
100
0
;
}
}
}
}
...
@@ -6687,7 +6687,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -6687,7 +6687,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
poll_status
=
switch_poll
(
rtp_session
->
read_pollfd
,
1
,
&
fdr
,
pt
);
poll_status
=
switch_poll
(
rtp_session
->
read_pollfd
,
1
,
&
fdr
,
pt
);
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
rtp_session
->
dtmf_data
.
out_digit_dur
>
0
)
{
if
(
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
&&
rtp_session
->
dtmf_data
.
out_digit_dur
>
0
)
{
return_cng_frame
();
return_cng_frame
();
}
}
...
@@ -6709,8 +6708,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -6709,8 +6708,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if
(
read_pretriggered
)
{
if
(
read_pretriggered
)
{
read_pretriggered
=
0
;
read_pretriggered
=
0
;
}
else
{
}
else
{
status
=
read_rtp_packet
(
rtp_session
,
&
bytes
,
flags
,
pmapP
,
poll_status
,
SWITCH_TRUE
);
status
=
read_rtp_packet
(
rtp_session
,
&
bytes
,
flags
,
pmapP
,
poll_status
,
SWITCH_TRUE
);
if
(
status
==
SWITCH_STATUS_GENERR
)
{
if
(
status
==
SWITCH_STATUS_GENERR
)
{
ret
=
-
1
;
ret
=
-
1
;
...
@@ -7196,7 +7195,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
...
@@ -7196,7 +7195,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
do_continue
:
do_continue
:
if
(
!
bytes
&&
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
if
(
!
bytes
&&
!
rtp_session
->
flags
[
SWITCH_RTP_FLAG_USE_TIMER
])
{
switch_yield
(
sleep_mss
);
if
(
sleep_mss
)
{
switch_yield
(
sleep_mss
);
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论