Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
78d5240e
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
78d5240e
编写于
8月 03, 2015
作者:
J
John Bradley
提交者:
kc5nra
8月 14, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
obs-ffmpeg: Add more informative logging to source
上级
207203d1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
11 deletion
+20
-11
plugins/obs-ffmpeg/obs-ffmpeg-source.c
plugins/obs-ffmpeg/obs-ffmpeg-source.c
+20
-11
未找到文件。
plugins/obs-ffmpeg/obs-ffmpeg-source.c
浏览文件 @
78d5240e
...
...
@@ -24,6 +24,14 @@
#include <libswscale/swscale.h>
#define FF_LOG(level, format, ...) \
blog(level, "[Media Source]: " format, ##__VA_ARGS__)
#define FF_LOG_S(source, level, format, ...) \
blog(level, "[Media Source '%s']: " format, \
obs_source_get_name(source), ##__VA_ARGS__)
#define FF_BLOG(level, format, ...) \
FF_LOG_S(s->source, level, format, ##__VA_ARGS__)
static
bool
video_frame
(
struct
ff_frame
*
frame
,
void
*
opaque
);
static
bool
video_format
(
AVCodecContext
*
codec_context
,
void
*
opaque
);
...
...
@@ -95,7 +103,7 @@ struct ffmpeg_source {
};
static
bool
set_obs_frame_colorprops
(
struct
ff_frame
*
frame
,
struct
obs_source_frame
*
obs_frame
)
struct
ffmpeg_source
*
s
,
struct
obs_source_frame
*
obs_frame
)
{
enum
AVColorSpace
frame_cs
=
av_frame_get_colorspace
(
frame
->
frame
);
enum
video_colorspace
obs_cs
;
...
...
@@ -106,7 +114,7 @@ static bool set_obs_frame_colorprops(struct ff_frame *frame,
case
AVCOL_SPC_BT470BG
:
obs_cs
=
VIDEO_CS_601
;
break
;
case
AVCOL_SPC_UNSPECIFIED
:
obs_cs
=
VIDEO_CS_DEFAULT
;
break
;
default:
blog
(
LOG_WARNING
,
"frame using an unsupported colorspace %d"
,
FF_BLOG
(
LOG_WARNING
,
"frame using an unsupported colorspace %d"
,
frame_cs
);
obs_cs
=
VIDEO_CS_DEFAULT
;
}
...
...
@@ -122,7 +130,7 @@ static bool set_obs_frame_colorprops(struct ff_frame *frame,
range
,
obs_frame
->
color_matrix
,
obs_frame
->
color_range_min
,
obs_frame
->
color_range_max
))
{
blog
(
LOG_ERROR
,
"Failed to get video format "
FF_BLOG
(
LOG_ERROR
,
"Failed to get video format "
"parameters for video format %u"
,
obs_cs
);
return
false
;
...
...
@@ -140,7 +148,7 @@ bool update_sws_context(struct ffmpeg_source *s, AVFrame *frame)
sws_freeContext
(
s
->
sws_ctx
);
if
(
frame
->
width
<=
0
||
frame
->
height
<=
0
)
{
av_log
(
NULL
,
AV_
LOG_ERROR
,
"unable to create a sws "
FF_BLOG
(
LOG_ERROR
,
"unable to create a sws "
"context that has a width(%d) or "
"height(%d) of zero."
,
frame
->
width
,
frame
->
height
);
...
...
@@ -158,7 +166,7 @@ bool update_sws_context(struct ffmpeg_source *s, AVFrame *frame)
NULL
,
NULL
,
NULL
);
if
(
s
->
sws_ctx
==
NULL
)
{
av_log
(
NULL
,
AV_
LOG_ERROR
,
"unable to create sws "
FF_BLOG
(
LOG_ERROR
,
"unable to create sws "
"context with src{w:%d,h:%d,f:%d}->"
"dst{w:%d,h:%d,f:%d}"
,
frame
->
width
,
frame
->
height
,
...
...
@@ -172,7 +180,7 @@ bool update_sws_context(struct ffmpeg_source *s, AVFrame *frame)
bfree
(
s
->
sws_data
);
s
->
sws_data
=
bzalloc
(
frame
->
width
*
frame
->
height
*
4
);
if
(
s
->
sws_data
==
NULL
)
{
av_log
(
NULL
,
AV_
LOG_ERROR
,
"unable to allocate sws "
FF_BLOG
(
LOG_ERROR
,
"unable to allocate sws "
"pixel data with size %d"
,
frame
->
width
*
frame
->
height
*
4
);
goto
fail
;
...
...
@@ -237,7 +245,7 @@ static bool video_frame_hwaccel(struct ff_frame *frame,
obs_frame
->
linesize
[
i
]
=
frame
->
frame
->
linesize
[
i
];
}
if
(
!
set_obs_frame_colorprops
(
frame
,
obs_frame
))
if
(
!
set_obs_frame_colorprops
(
frame
,
s
,
obs_frame
))
return
false
;
obs_source_output_video
(
s
->
source
,
obs_frame
);
...
...
@@ -254,7 +262,7 @@ static bool video_frame_direct(struct ff_frame *frame,
obs_frame
->
linesize
[
i
]
=
frame
->
frame
->
linesize
[
i
];
}
if
(
!
set_obs_frame_colorprops
(
frame
,
obs_frame
))
if
(
!
set_obs_frame_colorprops
(
frame
,
s
,
obs_frame
))
return
false
;
obs_source_output_video
(
s
->
source
,
obs_frame
);
...
...
@@ -479,12 +487,12 @@ static void ffmpeg_source_update(void *data, obs_data_t *settings)
if
(
audio_buffer_size
<
1
)
{
audio_buffer_size
=
1
;
blog
(
LOG_WARNING
,
"invalid audio_buffer_size %d"
,
FF_BLOG
(
LOG_WARNING
,
"invalid audio_buffer_size %d"
,
audio_buffer_size
);
}
if
(
video_buffer_size
<
1
)
{
video_buffer_size
=
1
;
blog
(
LOG_WARNING
,
"invalid audio_buffer_size %d"
,
FF_BLOG
(
LOG_WARNING
,
"invalid audio_buffer_size %d"
,
audio_buffer_size
);
}
s
->
demuxer
->
options
.
audio_frame_queue_size
=
audio_buffer_size
;
...
...
@@ -492,7 +500,8 @@ static void ffmpeg_source_update(void *data, obs_data_t *settings)
if
(
frame_drop
<
AVDISCARD_NONE
||
frame_drop
>
AVDISCARD_ALL
)
{
frame_drop
=
AVDISCARD_NONE
;
blog
(
LOG_WARNING
,
"invalid frame_drop %d"
,
frame_drop
);
FF_BLOG
(
LOG_WARNING
,
"invalid frame_drop %d"
,
frame_drop
);
}
s
->
demuxer
->
options
.
frame_drop
=
frame_drop
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录