Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a433b973
提交
a433b973
authored
6月 07, 2013
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Skip to next file when you hup the stream
上级
46f4709e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
63 行增加
和
0 行删除
+63
-0
mod_local_stream.c
src/mod/formats/mod_local_stream/mod_local_stream.c
+63
-0
没有找到文件。
src/mod/formats/mod_local_stream/mod_local_stream.c
浏览文件 @
a433b973
...
...
@@ -85,6 +85,7 @@ struct local_stream_source {
switch_memory_pool_t
*
pool
;
int
shuffle
;
switch_thread_rwlock_t
*
rwlock
;
int
hup
;
int
ready
;
int
stopped
;
int
part_reload
;
...
...
@@ -261,6 +262,23 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
is_open
=
switch_test_flag
(
use_fh
,
SWITCH_FILE_OPEN
);
if
(
source
->
hup
)
{
source
->
hup
=
0
;
if
(
is_open
)
{
is_open
=
0
;
switch_core_file_close
(
use_fh
);
if
(
use_fh
==
&
source
->
chime_fh
)
{
source
->
chime_counter
=
source
->
rate
*
source
->
chime_freq
;
use_fh
=
&
fh
;
goto
retry
;
switch_core_file_close
(
&
fh
);
}
}
}
if
(
is_open
)
{
if
(
switch_core_file_read
(
use_fh
,
abuf
,
&
olen
)
!=
SWITCH_STATUS_SUCCESS
||
!
olen
)
{
switch_core_file_close
(
use_fh
);
...
...
@@ -579,6 +597,7 @@ static void launch_thread(const char *name, const char *path, switch_xml_t direc
source
->
timer_name
=
"soft"
;
source
->
prebuf
=
DEFAULT_PREBUFFER_SIZE
;
source
->
stopped
=
0
;
source
->
hup
=
0
;
source
->
chime_freq
=
30
;
for
(
param
=
switch_xml_child
(
directory
,
"param"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
...
...
@@ -901,6 +920,49 @@ SWITCH_STANDARD_API(start_local_stream_function)
return
SWITCH_STATUS_SUCCESS
;
}
#define HUP_LOCAL_STREAM_SYNTAX "<local_stream_name>"
SWITCH_STANDARD_API
(
hup_local_stream_function
)
{
local_stream_source_t
*
source
=
NULL
;
char
*
mycmd
=
NULL
,
*
argv
[
8
]
=
{
0
};
char
*
local_stream_name
=
NULL
;
int
argc
=
0
;
if
(
zstr
(
cmd
))
{
goto
usage
;
}
if
(
!
(
mycmd
=
strdup
(
cmd
)))
{
goto
usage
;
}
if
((
argc
=
switch_separate_string
(
mycmd
,
' '
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
]))))
<
1
)
{
goto
usage
;
}
local_stream_name
=
argv
[
0
];
switch_mutex_lock
(
globals
.
mutex
);
source
=
switch_core_hash_find
(
globals
.
source_hash
,
local_stream_name
);
switch_mutex_unlock
(
globals
.
mutex
);
if
(
source
)
{
source
->
hup
=
1
;
stream
->
write_function
(
stream
,
"+OK hup stream: %s"
,
source
->
name
);
goto
done
;
}
goto
done
;
usage
:
stream
->
write_function
(
stream
,
"-USAGE: %s
\n
"
,
START_LOCAL_STREAM_SYNTAX
);
done
:
switch_safe_free
(
mycmd
);
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_MODULE_LOAD_FUNCTION
(
mod_local_stream_load
)
{
switch_api_interface_t
*
commands_api_interface
;
...
...
@@ -924,6 +986,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_local_stream_load)
switch_core_hash_init
(
&
globals
.
source_hash
,
pool
);
launch_streams
(
NULL
);
SWITCH_ADD_API
(
commands_api_interface
,
"hup_local_stream"
,
"Skip to next file in local_stream"
,
hup_local_stream_function
,
RELOAD_LOCAL_STREAM_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"reload_local_stream"
,
"Reloads a local_stream"
,
reload_local_stream_function
,
RELOAD_LOCAL_STREAM_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"stop_local_stream"
,
"Stops and unloads a local_stream"
,
stop_local_stream_function
,
STOP_LOCAL_STREAM_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"start_local_stream"
,
"Starts a new local_stream"
,
start_local_stream_function
,
START_LOCAL_STREAM_SYNTAX
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论