Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
09ede13f
提交
09ede13f
authored
5月 19, 2015
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7500 add switch_img_letterbox and use it for the mirror input function
上级
387b405c
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
70 行增加
和
12 行删除
+70
-12
switch_core_video.h
src/include/switch_core_video.h
+1
-0
mod_avcodec.c
src/mod/codecs/mod_avcodec/mod_avcodec.c
+11
-5
mod_openh264.cpp
src/mod/codecs/mod_openh264/mod_openh264.cpp
+10
-3
switch_core_media.c
src/switch_core_media.c
+3
-4
switch_core_video.c
src/switch_core_video.c
+45
-0
没有找到文件。
src/include/switch_core_video.h
浏览文件 @
09ede13f
...
...
@@ -363,6 +363,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_convert(switch_image_t *src, switch_c
SWITCH_DECLARE
(
switch_image_t
*
)
switch_img_write_text_img
(
int
w
,
int
h
,
switch_bool_t
full
,
const
char
*
text
);
SWITCH_DECLARE
(
switch_image_t
*
)
switch_img_read_file
(
const
char
*
file_name
);
SWITCH_DECLARE
(
switch_status_t
)
switch_img_letterbox
(
switch_image_t
*
img
,
switch_image_t
**
imgP
,
int
width
,
int
height
,
const
char
*
color
);
/** @} */
...
...
src/mod/codecs/mod_avcodec/mod_avcodec.c
浏览文件 @
09ede13f
...
...
@@ -182,7 +182,7 @@ static switch_status_t init_x264(h264_codec_context_t *context, uint32_t width,
context
->
bandwidth
=
5120
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"initializing x264 handle %dx%d bw:%d
\n
"
,
width
,
height
,
context
->
bandwidth
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"initializing x264 handle %dx%d bw:%d
\n
"
,
context
->
codec_settings
.
video
.
width
,
context
->
codec_settings
.
video
.
height
,
context
->
bandwidth
);
if
(
xh
)
{
...
...
@@ -697,12 +697,16 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec,
if
(
context
->
change_bandwidth
)
{
context
->
codec_settings
.
video
.
bandwidth
=
context
->
change_bandwidth
;
context
->
change_bandwidth
=
0
;
init_x264
(
context
,
0
,
0
);
if
(
init_x264
(
context
,
0
,
0
)
!=
SWITCH_STATUS_SUCCESS
)
{
return
SWITCH_STATUS_FALSE
;
}
switch_set_flag
(
frame
,
SFF_WAIT_KEY_FRAME
);
}
if
(
!
context
->
x264_handle
)
{
init_x264
(
context
,
width
,
height
);
if
(
init_x264
(
context
,
width
,
height
)
!=
SWITCH_STATUS_SUCCESS
)
{
return
SWITCH_STATUS_FALSE
;
}
switch_set_flag
(
frame
,
SFF_WAIT_KEY_FRAME
);
}
...
...
@@ -715,8 +719,10 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec,
if
(
context
->
x264_params
.
i_width
!=
width
||
context
->
x264_params
.
i_height
!=
height
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"picture size changed from %dx%d to %dx%d, reinitializing encoder
\n
"
,
context
->
x264_params
.
i_width
,
context
->
x264_params
.
i_width
,
width
,
height
);
init_x264
(
context
,
width
,
height
);
context
->
x264_params
.
i_width
,
context
->
x264_params
.
i_height
,
width
,
height
);
if
(
init_x264
(
context
,
width
,
height
)
!=
SWITCH_STATUS_SUCCESS
)
{
return
SWITCH_STATUS_FALSE
;
}
switch_set_flag
(
frame
,
SFF_WAIT_KEY_FRAME
);
}
...
...
src/mod/codecs/mod_openh264/mod_openh264.cpp
浏览文件 @
09ede13f
...
...
@@ -192,11 +192,18 @@ static switch_size_t buffer_h264_nalu(h264_codec_context_t *context, switch_fram
nalu_idc
=
(
nalu_hdr
&
0x60
)
>>
5
;
nalu_type
=
nalu_hdr
&
0x1f
;
if
(
!
context
->
got_sps
&&
nalu_type
!=
7
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Waiting SPS/PPS, Got %d
\n
"
,
nalu_type
);
return
0
;
if
(
context
->
got_sps
<=
0
)
{
context
->
got_sps
--
;
if
((
abs
(
context
->
got_sps
)
%
30
)
==
0
)
{
switch_set_flag
(
frame
,
SFF_WAIT_KEY_FRAME
);
}
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "waiting pps\n");
//return SWITCH_STATUS_RESTART;
}
if
(
context
->
got_sps
<=
0
&&
nalu_type
==
7
)
context
->
got_sps
=
1
;
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "XXX GOT %d len:%d\n", nalu_type, frame->datalen);
if
(
!
context
->
got_sps
)
{
...
...
src/switch_core_media.c
浏览文件 @
09ede13f
...
...
@@ -10326,14 +10326,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
/* When desired, scale video to match the input signal (if output is bigger) */
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO_READY
)
&&
smh
->
vid_params
.
width
&&
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO_MIRROR_INPUT
)
&&
(
smh
->
vid_params
.
width
*
smh
->
vid_params
.
height
)
<
(
img
->
d_w
*
img
->
d_h
))
{
(
(
smh
->
vid_params
.
width
!=
img
->
d_w
)
||
(
smh
->
vid_params
.
height
!=
img
->
d_h
)
))
{
switch_img_copy
(
img
,
&
dup_img
);
switch_img_fit
(
&
dup_img
,
smh
->
vid_params
.
width
,
smh
->
vid_params
.
height
);
switch_img_letterbox
(
img
,
&
dup_img
,
smh
->
vid_params
.
width
,
smh
->
vid_params
.
height
,
"#000000f"
);
img
=
dup_img
;
}
if
(
session
->
bugs
)
{
switch_media_bug_t
*
bp
;
switch_bool_t
ok
=
SWITCH_TRUE
;
...
...
src/switch_core_video.c
浏览文件 @
09ede13f
...
...
@@ -1677,6 +1677,51 @@ SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char*
#endif
SWITCH_DECLARE
(
switch_status_t
)
switch_img_letterbox
(
switch_image_t
*
img
,
switch_image_t
**
imgP
,
int
width
,
int
height
,
const
char
*
color
)
{
int
img_w
=
0
,
img_h
=
0
;
double
screen_aspect
=
0
,
img_aspect
=
0
;
int
x_pos
=
0
;
int
y_pos
=
0
;
switch_image_t
*
IMG
=
NULL
,
*
scale_img
=
NULL
;
switch_rgb_color_t
bgcolor
=
{
0
};
switch_assert
(
imgP
);
*
imgP
=
NULL
;
if
(
img
->
d_w
==
width
&&
img
->
d_h
==
height
)
{
switch_img_copy
(
img
,
imgP
);
return
SWITCH_STATUS_SUCCESS
;
}
IMG
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
width
,
height
,
1
);
switch_color_set_rgb
(
&
bgcolor
,
color
);
switch_img_fill
(
IMG
,
0
,
0
,
IMG
->
d_w
,
IMG
->
d_h
,
&
bgcolor
);
img_w
=
IMG
->
d_w
;
img_h
=
IMG
->
d_h
;
screen_aspect
=
(
double
)
IMG
->
d_w
/
IMG
->
d_h
;
img_aspect
=
(
double
)
img
->
d_w
/
img
->
d_h
;
if
(
screen_aspect
>
img_aspect
)
{
img_w
=
img_aspect
*
IMG
->
d_h
;
x_pos
=
(
IMG
->
d_w
-
img_w
)
/
2
;
}
else
if
(
screen_aspect
<
img_aspect
)
{
img_h
=
IMG
->
d_w
/
img_aspect
;
y_pos
=
(
IMG
->
d_h
-
img_h
)
/
2
;
}
switch_img_scale
(
img
,
&
scale_img
,
img_w
,
img_h
);
switch_img_patch
(
IMG
,
scale_img
,
x_pos
,
y_pos
);
switch_img_free
(
&
scale_img
);
*
imgP
=
IMG
;
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_img_fit
(
switch_image_t
**
srcP
,
int
width
,
int
height
)
{
switch_image_t
*
src
,
*
tmp
=
NULL
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论