Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
ddf78324
提交
ddf78324
authored
2月 28, 2015
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7503: recording tweak
上级
ad7af42c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
104 行增加
和
42 行删除
+104
-42
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+4
-15
mod_vlc.c
src/mod/formats/mod_vlc/mod_vlc.c
+99
-26
switch_core_file.c
src/switch_core_file.c
+1
-1
没有找到文件。
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
ddf78324
...
...
@@ -1585,7 +1585,6 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
layout_group_t
*
lg
=
NULL
;
switch_image_t
*
write_img
=
NULL
,
*
file_img
=
NULL
;
uint32_t
timestamp
=
0
;
switch_timer_t
file_timer
=
{
0
};
if
(
conference
->
video_layout_group
)
{
lg
=
switch_core_hash_find
(
conference
->
layout_group_hash
,
conference
->
video_layout_group
);
...
...
@@ -1606,7 +1605,6 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
conference
->
video_timer_reset
=
1
;
packet
=
switch_core_alloc
(
conference
->
pool
,
SWITCH_RECOMMENDED_BUFFER_SIZE
);
switch_core_timer_init
(
&
file_timer
,
"soft"
,
1
,
90
,
NULL
);
while
(
globals
.
running
&&
!
switch_test_flag
(
conference
,
CFLAG_DESTRUCT
)
&&
switch_test_flag
(
conference
,
CFLAG_VIDEO_MUXING
))
{
switch_bool_t
need_refresh
=
SWITCH_FALSE
,
need_keyframe
=
SWITCH_FALSE
,
need_reset
=
SWITCH_FALSE
;
...
...
@@ -1841,18 +1839,13 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
if
(
conference
->
canvas
->
play_file
)
{
conference
->
canvas
->
reset_video
=
1
;
conference
->
canvas
->
play_file
=
0
;
//if (file_timer.interval) {
// switch_core_timer_destroy(&file_timer);
//}
conference
->
canvas
->
timer
.
interval
=
1
;
conference
->
canvas
->
timer
.
samples
=
90
;
}
write_img
=
file_img
=
write_frame
.
img
;
//switch_core_timer_sync(&file_timer);
//timestamp = file_timer.samplecount;
switch_core_timer_sync
(
&
conference
->
canvas
->
timer
);
timestamp
=
conference
->
canvas
->
timer
.
samplecount
;
}
...
...
@@ -1944,10 +1937,6 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
switch_core_timer_destroy
(
&
conference
->
canvas
->
timer
);
if
(
file_timer
.
interval
)
{
switch_core_timer_destroy
(
&
file_timer
);
}
destroy_canvas
(
&
conference
->
canvas
);
return
NULL
;
...
...
@@ -6977,14 +6966,14 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
flags
=
SWITCH_FILE_FLAG_READ
|
SWITCH_FILE_DATA_SHORT
;
if
(
conference
->
members_with_video
&&
switch_test_flag
(
conference
,
CFLAG_TRANSCODE_VIDEO
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Vido FLAG
\n
"
);
flags
|=
SWITCH_FILE_FLAG_VIDEO
;
}
/* Open the file */
fnode
->
fh
.
pre_buffer_datalen
=
SWITCH_DEFAULT_FILE_BUFFER_LEN
;
if
(
switch_core_file_open
(
&
fnode
->
fh
,
file
,
channels
,
conference
->
rate
,
flags
,
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_file_open
(
&
fnode
->
fh
,
file
,
channels
,
conference
->
rate
,
flags
,
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_event_t
*
event
;
if
(
test_eflag
(
conference
,
EFLAG_PLAY_FILE
)
&&
...
...
src/mod/formats/mod_vlc/mod_vlc.c
浏览文件 @
ddf78324
...
...
@@ -210,10 +210,17 @@ static void vlc_media_state_callback(const libvlc_event_t * event, void * data)
static
void
vlc_mediaplayer_av_error_callback
(
const
libvlc_event_t
*
event
,
void
*
data
)
{
vlc_file_context_t
*
acontext
=
(
vlc_file_context_t
*
)
data
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
vlc_file_context_t
*
acontext
=
data
;
vlc_video_context_t
*
vcontext
=
NULL
;
int
status
;
int
status
=
libvlc_media_get_state
(
vcontext
->
m
);
if
(
acontext
)
{
if
(
!
(
vcontext
=
acontext
->
vcontext
))
{
return
;
}
}
status
=
libvlc_media_get_state
(
vcontext
->
m
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Got a libvlc_MediaPlayerEncounteredError callback. mediaPlayer Status: %d
\n
"
,
status
);
if
(
status
==
libvlc_Error
)
{
...
...
@@ -238,10 +245,16 @@ static void vlc_mediaplayer_av_error_callback(const libvlc_event_t * event, void
}
static
void
vlc_media_av_state_callback
(
const
libvlc_event_t
*
event
,
void
*
data
)
{
vlc_file_context_t
*
acontext
=
(
vlc_file_context_t
*
)
data
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
int
new_state
=
event
->
u
.
media_state_changed
.
new_state
;
vlc_file_context_t
*
acontext
=
data
;
vlc_video_context_t
*
vcontext
=
NULL
;
if
(
acontext
)
{
if
(
!
(
vcontext
=
acontext
->
vcontext
))
{
return
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Got a libvlc_MediaStateChanged callback. New state: %d
\n
"
,
new_state
);
if
(
new_state
==
libvlc_Ended
||
new_state
==
libvlc_Error
||
new_state
==
6
)
{
vcontext
->
err
=
1
;
...
...
@@ -319,11 +332,16 @@ void vlc_play_audio_callback(void *data, const void *samples, unsigned count, in
void
vlc_file_play_audio_callback
(
void
*
data
,
const
void
*
samples
,
unsigned
count
,
int64_t
pts
)
{
vlc_file_context_t
*
acontext
=
(
vlc_file_context_t
*
)
data
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
vlc_file_context_t
*
acontext
=
data
;
vlc_video_context_t
*
vcontext
=
NULL
;
switch_size_t
bytes
;
if
(
acontext
)
{
if
(
!
(
vcontext
=
acontext
->
vcontext
))
{
return
;
}
}
switch_mutex_lock
(
vcontext
->
audio_mutex
);
bytes
=
switch_buffer_inuse
(
vcontext
->
audio_buffer
);
...
...
@@ -547,9 +565,7 @@ void vlc_imem_release_callback(void *data, const char *cookie, size_t size, void
static
switch_status_t
av_init_handle
(
switch_file_handle_t
*
handle
,
switch_image_t
*
img
)
{
vlc_file_context_t
*
acontext
=
(
vlc_file_context_t
*
)
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
switch_memory_pool_t
*
pool
=
acontext
->
pool
;
switch_memory_pool_t
*
pool
;
int64_t
pts
=
0
;
char
*
imem_main
,
*
imem_slave
;
unsigned
char
audio_data_buf
[
SWITCH_RECOMMENDED_BUFFER_SIZE
]
=
{
0
};
...
...
@@ -557,11 +573,19 @@ static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image
switch_size_t
audio_datalen
;
uint32_t
offset
=
500
;
const
char
*
tmp
;
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
const
char
*
opts
[
25
]
=
{
*
vlc_args
,
switch_core_sprintf
(
acontext
->
pool
,
"--sout=%s"
,
acontext
->
path
)
};
int
argc
=
2
;
vlc_video_context_t
*
vcontext
;
vcontext
=
acontext
->
vcontext
;
pool
=
acontext
->
pool
;
vcontext
=
switch_core_alloc
(
acontext
->
pool
,
sizeof
(
vlc_video_context_t
));
...
...
@@ -668,9 +692,13 @@ static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image
static
switch_status_t
vlc_file_av_open
(
switch_file_handle_t
*
handle
,
const
char
*
path
)
{
vlc_file_context_t
*
acontext
=
(
vlc_file_context_t
*
)
handle
->
private_info
;
vlc_video_context_t
*
vcontext
;
libvlc_event_manager_t
*
mp_event_manager
,
*
m_event_manager
;
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
;
if
(
acontext
)
{
vcontext
=
acontext
->
vcontext
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"VLC open %s for reading
\n
"
,
acontext
->
path
);
...
...
@@ -748,19 +776,29 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
vlc_file_context_t
*
context
;
libvlc_event_manager_t
*
mp_event_manager
,
*
m_event_manager
;
char
*
ext
=
NULL
;
switch_file_t
*
fd
=
NULL
;
const
char
*
realpath
=
NULL
;
context
=
switch_core_alloc
(
handle
->
memory_pool
,
sizeof
(
*
context
));
context
->
pool
=
handle
->
memory_pool
;
context
->
vlc_handle
=
libvlc_new
(
sizeof
(
vlc_args
)
/
sizeof
(
char
*
),
vlc_args
);
realpath
=
path
;
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_VIDEO
)
&&
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
)
&&
(
ext
=
strrchr
(
path
,
'.'
))
&&
!
strcasecmp
(
ext
,
".mp4"
))
{
realpath
=
path
;
path
=
switch_core_sprintf
(
context
->
pool
,
"#transcode{vcodec=h264,acodec=mp3}:std{access=file,mux=mp4,dst=%s}"
,
path
);
}
context
->
path
=
switch_core_strdup
(
context
->
pool
,
path
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"VLC attempt to open %s %s %s %s
\n
"
,
context
->
path
,
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_READ
)
?
"read"
:
""
,
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
)
?
"write"
:
""
,
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_VIDEO
)
?
"video"
:
""
);
if
(
!
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_VIDEO
))
{
switch_buffer_create_dynamic
(
&
(
context
->
audio_buffer
),
VLC_BUFFER_SIZE
,
VLC_BUFFER_SIZE
*
8
,
0
);
...
...
@@ -864,17 +902,32 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p
context
->
pts
=
0
;
}
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_VIDEO
))
{
if
(
switch_file_open
(
&
fd
,
realpath
,
SWITCH_FOPEN_WRITE
|
SWITCH_FOPEN_CREATE
|
SWITCH_FOPEN_TRUNCATE
,
SWITCH_FPROT_UREAD
|
SWITCH_FPROT_UWRITE
,
handle
->
memory_pool
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_file_close
(
fd
);
}
else
{
return
SWITCH_STATUS_GENERR
;
}
}
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
vlc_file_av_read
(
switch_file_handle_t
*
handle
,
void
*
data
,
size_t
*
len
)
{
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
NULL
;
size_t
bytes
=
*
len
*
sizeof
(
int16_t
)
*
handle
->
channels
,
read
;
libvlc_state_t
status
;
if
(
acontext
)
{
if
(
!
(
vcontext
=
acontext
->
vcontext
))
{
return
SWITCH_STATUS_FALSE
;
}
}
if
(
vcontext
->
err
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"VLC ended
\n
"
);
return
SWITCH_STATUS_GENERR
;
...
...
@@ -992,9 +1045,15 @@ static switch_status_t vlc_file_read(switch_file_handle_t *handle, void *data, s
static
switch_status_t
vlc_file_read_video
(
switch_file_handle_t
*
handle
,
switch_frame_t
*
frame
)
{
vlc_file_context_t
*
acontext
=
(
vlc_file_context_t
*
)
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
void
*
pop
;
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
NULL
;
if
(
acontext
)
{
if
(
!
(
vcontext
=
acontext
->
vcontext
))
{
return
SWITCH_STATUS_FALSE
;
}
}
if
(
vcontext
->
err
)
{
return
SWITCH_STATUS_FALSE
;
...
...
@@ -1023,9 +1082,13 @@ static switch_status_t vlc_file_read_video(switch_file_handle_t *handle, switch_
static
switch_status_t
vlc_file_write_video
(
switch_file_handle_t
*
handle
,
switch_frame_t
*
frame
)
{
vlc_file_context_t
*
acontext
=
(
vlc_file_context_t
*
)
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
NULL
;
if
(
acontext
)
{
vcontext
=
acontext
->
vcontext
;
}
if
(
vcontext
&&
vcontext
->
err
)
{
return
SWITCH_STATUS_FALSE
;
...
...
@@ -1084,10 +1147,14 @@ static switch_status_t vlc_file_write_video(switch_file_handle_t *handle, switch
static
switch_status_t
vlc_file_av_write
(
switch_file_handle_t
*
handle
,
void
*
data
,
size_t
*
len
)
{
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
size_t
bytes
=
*
len
*
sizeof
(
int16_t
)
*
handle
->
channels
;
int64_t
pts
;
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
NULL
;
if
(
acontext
)
{
vcontext
=
acontext
->
vcontext
;
}
if
(
!
vcontext
)
{
return
SWITCH_STATUS_SUCCESS
;
...
...
@@ -1144,9 +1211,15 @@ static switch_status_t vlc_file_write(switch_file_handle_t *handle, void *data,
static
switch_status_t
vlc_file_av_close
(
switch_file_handle_t
*
handle
)
{
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
acontext
->
vcontext
;
vlc_file_context_t
*
acontext
=
handle
->
private_info
;
vlc_video_context_t
*
vcontext
=
NULL
;
if
(
acontext
)
{
if
(
!
(
vcontext
=
acontext
->
vcontext
))
{
return
SWITCH_STATUS_FALSE
;
}
}
vcontext
->
ending
=
1
;
if
(
vcontext
&&
vcontext
->
video_queue
)
{
...
...
@@ -2392,7 +2465,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_vlc_load)
vlc_file_supported_formats
[
0
]
=
"vlc"
;
vlc_file_supported_formats
[
1
]
=
"mp4"
;
/* maybe add config for this mod to enable or disable */
vlc_file_supported_formats
[
1
]
=
"mov"
;
/* maybe add config for this mod to enable or disable */
vlc_file_supported_formats
[
2
]
=
"mov"
;
/* maybe add config for this mod to enable or disable */
file_interface
=
switch_loadable_module_create_interface
(
*
module_interface
,
SWITCH_FILE_INTERFACE
);
file_interface
->
interface_name
=
modname
;
...
...
src/switch_core_file.c
浏览文件 @
ddf78324
...
...
@@ -391,7 +391,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
SWITCH_DECLARE
(
switch_bool_t
)
switch_core_file_has_video
(
switch_file_handle_t
*
fh
)
{
return
switch_test_flag
(
fh
,
SWITCH_FILE_FLAG_VIDEO
)
?
SWITCH_TRUE
:
SWITCH_FALSE
;
return
(
switch_test_flag
(
fh
,
SWITCH_FILE_OPEN
)
&&
switch_test_flag
(
fh
,
SWITCH_FILE_FLAG_VIDEO
)
)
?
SWITCH_TRUE
:
SWITCH_FALSE
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_file_write
(
switch_file_handle_t
*
fh
,
void
*
data
,
switch_size_t
*
len
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论