Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
289ccee4
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,发现更多精彩内容 >>
提交
289ccee4
编写于
7月 29, 2016
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
obs-outputs: Add ability to bind to an IP address for RTMP
上级
9ebe5349
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
0 deletion
+37
-0
plugins/obs-outputs/data/locale/en-US.ini
plugins/obs-outputs/data/locale/en-US.ini
+1
-0
plugins/obs-outputs/rtmp-stream.c
plugins/obs-outputs/rtmp-stream.c
+36
-0
未找到文件。
plugins/obs-outputs/data/locale/en-US.ini
浏览文件 @
289ccee4
...
...
@@ -2,3 +2,4 @@ RTMPStream="RTMP Stream"
RTMPStream.DropThreshold
=
"Drop Threshold (milliseconds)"
FLVOutput
=
"FLV File Output"
FLVOutput.FilePath
=
"File Path"
Default
=
"Default"
plugins/obs-outputs/rtmp-stream.c
浏览文件 @
289ccee4
...
...
@@ -25,6 +25,7 @@
#include "librtmp/rtmp.h"
#include "librtmp/log.h"
#include "flv-mux.h"
#include "net-if.h"
#ifdef _WIN32
#include <Iphlpapi.h>
...
...
@@ -42,6 +43,7 @@
#define OPT_DROP_THRESHOLD "drop_threshold_ms"
#define OPT_MAX_SHUTDOWN_TIME_SEC "max_shutdown_time_sec"
#define OPT_BIND_IP "bind_ip"
//#define TEST_FRAMEDROPS
...
...
@@ -68,6 +70,7 @@ struct rtmp_stream {
struct
dstr
path
,
key
;
struct
dstr
username
,
password
;
struct
dstr
encoder_name
;
struct
dstr
bind_ip
;
/* frame drop variables */
int64_t
drop_threshold_usec
;
...
...
@@ -164,6 +167,7 @@ static void rtmp_stream_destroy(void *data)
dstr_free
(
&
stream
->
username
);
dstr_free
(
&
stream
->
password
);
dstr_free
(
&
stream
->
encoder_name
);
dstr_free
(
&
stream
->
bind_ip
);
os_event_destroy
(
stream
->
stop_event
);
os_sem_destroy
(
stream
->
send_sem
);
pthread_mutex_destroy
(
&
stream
->
packets_mutex
);
...
...
@@ -600,6 +604,17 @@ static int try_connect(struct rtmp_stream *stream)
set_rtmp_dstr
(
&
stream
->
rtmp
.
Link
.
flashVer
,
&
stream
->
encoder_name
);
stream
->
rtmp
.
Link
.
swfUrl
=
stream
->
rtmp
.
Link
.
tcUrl
;
if
(
dstr_is_empty
(
&
stream
->
bind_ip
)
||
dstr_cmp
(
&
stream
->
bind_ip
,
"default"
)
==
0
)
{
memset
(
&
stream
->
rtmp
.
m_bindIP
,
0
,
sizeof
(
stream
->
rtmp
.
m_bindIP
));
}
else
{
bool
success
=
netif_str_to_addr
(
&
stream
->
rtmp
.
m_bindIP
.
addr
,
&
stream
->
rtmp
.
m_bindIP
.
addrLen
,
stream
->
bind_ip
.
array
);
if
(
success
)
info
(
"Binding to IP"
);
}
RTMP_AddStream
(
&
stream
->
rtmp
,
stream
->
key
.
array
);
for
(
size_t
idx
=
1
;;
idx
++
)
{
...
...
@@ -636,6 +651,7 @@ static bool init_connect(struct rtmp_stream *stream)
{
obs_service_t
*
service
;
obs_data_t
*
settings
;
const
char
*
bind_ip
;
if
(
stopping
(
stream
))
pthread_join
(
stream
->
send_thread
,
NULL
);
...
...
@@ -663,6 +679,10 @@ static bool init_connect(struct rtmp_stream *stream)
(
int64_t
)
obs_data_get_int
(
settings
,
OPT_DROP_THRESHOLD
)
*
1000
;
stream
->
max_shutdown_time_sec
=
(
int
)
obs_data_get_int
(
settings
,
OPT_MAX_SHUTDOWN_TIME_SEC
);
bind_ip
=
obs_data_get_string
(
settings
,
OPT_BIND_IP
);
dstr_copy
(
&
stream
->
bind_ip
,
bind_ip
);
obs_data_release
(
settings
);
return
true
;
}
...
...
@@ -837,6 +857,7 @@ static void rtmp_stream_defaults(obs_data_t *defaults)
{
obs_data_set_default_int
(
defaults
,
OPT_DROP_THRESHOLD
,
600
);
obs_data_set_default_int
(
defaults
,
OPT_MAX_SHUTDOWN_TIME_SEC
,
5
);
obs_data_set_default_string
(
defaults
,
OPT_BIND_IP
,
"default"
);
}
static
obs_properties_t
*
rtmp_stream_properties
(
void
*
unused
)
...
...
@@ -844,11 +865,26 @@ static obs_properties_t *rtmp_stream_properties(void *unused)
UNUSED_PARAMETER
(
unused
);
obs_properties_t
*
props
=
obs_properties_create
();
struct
netif_saddr_data
addrs
=
{
0
};
obs_property_t
*
p
;
obs_properties_add_int
(
props
,
OPT_DROP_THRESHOLD
,
obs_module_text
(
"RTMPStream.DropThreshold"
),
200
,
10000
,
100
);
p
=
obs_properties_add_list
(
props
,
OPT_BIND_IP
,
obs_module_text
(
"RTMPStream.BindIP"
),
OBS_COMBO_TYPE_LIST
,
OBS_COMBO_FORMAT_STRING
);
obs_property_list_add_string
(
p
,
obs_module_text
(
"Default"
),
"default"
);
netif_get_addrs
(
&
addrs
);
for
(
size_t
i
=
0
;
i
<
addrs
.
addrs
.
num
;
i
++
)
{
struct
netif_saddr_item
item
=
addrs
.
addrs
.
array
[
i
];
obs_property_list_add_string
(
p
,
item
.
name
,
item
.
addr
);
}
netif_saddr_data_free
(
&
addrs
);
return
props
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录