Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
65631ed3
提交
65631ed3
authored
12月 29, 2014
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert FS-7004 pending updated fixed for that issue from the original author.
上级
b368a755
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
3 行增加
和
22 行删除
+3
-22
mod_sndfile.c
src/mod/formats/mod_sndfile/mod_sndfile.c
+3
-22
没有找到文件。
src/mod/formats/mod_sndfile/mod_sndfile.c
浏览文件 @
65631ed3
...
@@ -54,13 +54,10 @@ struct sndfile_context {
...
@@ -54,13 +54,10 @@ struct sndfile_context {
typedef
struct
sndfile_context
sndfile_context
;
typedef
struct
sndfile_context
sndfile_context
;
static
switch_status_t
sndfile_perform_open
(
sndfile_context
*
context
,
const
char
*
path
,
const
char
*
mask
,
int
mode
);
static
switch_status_t
sndfile_file_open
(
switch_file_handle_t
*
handle
,
const
char
*
path
)
static
switch_status_t
sndfile_file_open
(
switch_file_handle_t
*
handle
,
const
char
*
path
)
{
{
sndfile_context
*
context
;
sndfile_context
*
context
;
int
mode
=
0
;
int
mode
=
0
;
const
char
*
mask
=
"rb"
;
char
*
ext
;
char
*
ext
;
struct
format_map
*
map
=
NULL
;
struct
format_map
*
map
=
NULL
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
...
@@ -87,10 +84,8 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
...
@@ -87,10 +84,8 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_WRITE_APPEND
)
||
switch_test_flag
(
handle
,
SWITCH_FILE_WRITE_OVER
)
||
handle
->
offset_pos
)
{
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_WRITE_APPEND
)
||
switch_test_flag
(
handle
,
SWITCH_FILE_WRITE_OVER
)
||
handle
->
offset_pos
)
{
mask
=
"ab+"
;
mode
+=
SFM_RDWR
;
mode
+=
SFM_RDWR
;
}
else
{
}
else
{
mask
=
"wb+"
;
mode
+=
SFM_WRITE
;
mode
+=
SFM_WRITE
;
}
}
}
}
...
@@ -186,7 +181,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
...
@@ -186,7 +181,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
ldup
=
strdup
(
last
);
ldup
=
strdup
(
last
);
switch_assert
(
ldup
);
switch_assert
(
ldup
);
switch_snprintf
(
last
,
alt_len
-
(
last
-
alt_path
),
"%d%s%s"
,
handle
->
samplerate
,
SWITCH_PATH_SEPARATOR
,
ldup
);
switch_snprintf
(
last
,
alt_len
-
(
last
-
alt_path
),
"%d%s%s"
,
handle
->
samplerate
,
SWITCH_PATH_SEPARATOR
,
ldup
);
if
(
sndfile_perform_open
(
context
,
alt_path
,
mask
,
mode
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
(
context
->
handle
=
sf_open
(
alt_path
,
mode
,
&
context
->
sfinfo
))
)
{
path
=
alt_path
;
path
=
alt_path
;
}
else
{
}
else
{
/* Try to find the file at the highest rate possible if we can't find one that matches the exact rate.
/* Try to find the file at the highest rate possible if we can't find one that matches the exact rate.
...
@@ -194,7 +189,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
...
@@ -194,7 +189,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
*/
*/
for
(
i
=
3
;
i
>=
0
;
i
--
)
{
for
(
i
=
3
;
i
>=
0
;
i
--
)
{
switch_snprintf
(
last
,
alt_len
-
(
last
-
alt_path
),
"%d%s%s"
,
rates
[
i
],
SWITCH_PATH_SEPARATOR
,
ldup
);
switch_snprintf
(
last
,
alt_len
-
(
last
-
alt_path
),
"%d%s%s"
,
rates
[
i
],
SWITCH_PATH_SEPARATOR
,
ldup
);
if
(
sndfile_perform_open
(
context
,
alt_path
,
mask
,
mode
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
(
context
->
handle
=
sf_open
(
alt_path
,
mode
,
&
context
->
sfinfo
))
)
{
path
=
alt_path
;
path
=
alt_path
;
break
;
break
;
}
}
...
@@ -203,7 +198,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
...
@@ -203,7 +198,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
}
}
if
(
!
context
->
handle
)
{
if
(
!
context
->
handle
)
{
if
(
sndfile_perform_open
(
context
,
path
,
mask
,
mode
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
(
context
->
handle
=
sf_open
(
path
,
mode
,
&
context
->
sfinfo
))
==
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error Opening File [%s] [%s]
\n
"
,
path
,
sf_strerror
(
context
->
handle
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error Opening File [%s] [%s]
\n
"
,
path
,
sf_strerror
(
context
->
handle
));
status
=
SWITCH_STATUS_GENERR
;
status
=
SWITCH_STATUS_GENERR
;
goto
end
;
goto
end
;
...
@@ -241,20 +236,6 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
...
@@ -241,20 +236,6 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
return
status
;
return
status
;
}
}
static
switch_status_t
sndfile_perform_open
(
sndfile_context
*
context
,
const
char
*
path
,
const
char
*
mask
,
int
mode
)
{
FILE
*
fd
=
NULL
;
fd
=
fopen
(
path
,
mask
);
if
(
!
fd
)
{
return
SWITCH_STATUS_FALSE
;
}
if
((
context
->
handle
=
sf_open_fd
(
fileno
(
fd
),
mode
,
&
context
->
sfinfo
,
SWITCH_TRUE
))
==
0
)
{
fclose
(
fd
);
return
SWITCH_STATUS_FALSE
;
}
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
sndfile_file_truncate
(
switch_file_handle_t
*
handle
,
int64_t
offset
)
static
switch_status_t
sndfile_file_truncate
(
switch_file_handle_t
*
handle
,
int64_t
offset
)
{
{
sndfile_context
*
context
=
handle
->
private_info
;
sndfile_context
*
context
=
handle
->
private_info
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论