Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
4c256cc0
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,发现更多精彩内容 >>
提交
4c256cc0
编写于
12月 07, 2013
作者:
J
Jim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8 from Ceropean/master
Fixed build for *nix and added functions to platform-nix.c
上级
5d3f3e0d
1005a841
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
14 deletion
+50
-14
libobs/CMakeLists.txt
libobs/CMakeLists.txt
+5
-1
libobs/util/platform-nix.c
libobs/util/platform-nix.c
+45
-13
未找到文件。
libobs/CMakeLists.txt
浏览文件 @
4c256cc0
...
...
@@ -2,7 +2,7 @@ if(WIN32)
set
(
libobs_platform_src
obs-windows.c
util/platform-windows.c
)
elseif
(
APPLE
AND UNIX
)
elseif
(
APPLE
)
set
(
libobs_platform_src
obs-cocoa.c
util/platform-cocoa.m
)
...
...
@@ -15,6 +15,10 @@ elseif(APPLE AND UNIX)
mark_as_advanced
(
COCOA
)
include_directories
(
${
COCOA
}
)
link_libraries
(
${
COCOA
}
)
elseif
(
UNIX
)
set
(
libobs_platform_src
obs-nix.c
util/platform-nix.c
)
else
()
endif
()
...
...
libobs/util/platform-nix.c
浏览文件 @
4c256cc0
...
...
@@ -25,54 +25,86 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <unistd.h>
#include <time.h>
#include "dstr.h"
#include "platform.h"
void
*
os_dlopen
(
const
char
*
path
)
{
/* TODO */
return
NULL
;
struct
dstr
dylib_name
;
dstr_init_copy
(
&
dylib_name
,
path
);
if
(
!
dstr_find
(
&
dylib_name
,
".so"
))
dstr_cat
(
&
dylib_name
,
".so"
);
void
*
res
=
dlopen
(
dylib_name
.
array
,
RTLD_LAZY
);
if
(
!
res
)
blog
(
LOG_ERROR
,
"os_dlopen(%s->%s): %s
\n
"
,
path
,
dylib_name
.
array
,
dlerror
());
dstr_free
(
&
dylib_name
);
return
res
;
}
void
*
os_dlsym
(
void
*
module
,
const
char
*
func
)
{
/* TODO */
return
NULL
;
return
dlsym
(
module
,
func
);
}
void
os_dlclose
(
void
*
module
)
{
/* TODO */
dlclose
(
module
);
}
void
os_sleepto_ns
(
uint64_t
time_target
)
{
/* TODO */
uint64_t
current
=
os_gettime_ns
();
if
(
time_target
<
current
)
return
;
time_target
-=
current
;
struct
timespec
req
,
remain
;
memset
(
&
req
,
0
,
sizeof
(
req
));
memset
(
&
remain
,
0
,
sizeof
(
remain
));
req
.
tv_sec
=
time_target
/
1000000000
;
req
.
tv_nsec
=
time_target
%
1000000000
;
while
(
nanosleep
(
&
req
,
&
remain
))
{
req
=
remain
;
memset
(
&
remain
,
0
,
sizeof
(
remain
));
}
}
void
os_sleep_ms
(
uint32_t
duration
)
{
/* TODO */
usleep
(
duration
*
1000
);
}
uint64_t
os_gettime_ns
(
void
)
{
/* TODO */
return
0
;
struct
timespec
tp
;
clock_gettime
(
CLOCK_REALTIME
,
&
tp
);
return
tp
.
tv_nsec
;
}
uint64_t
os_gettime_ms
(
void
)
{
/* TODO */
return
0
;
return
os_gettime_ns
()
/
1000000
;
}
/* should return $HOME/ */
char
*
os_get_home_path
(
void
)
{
/* TODO */
return
NULL
;
char
*
path_ptr
=
getenv
(
"HOME"
);
if
(
path_ptr
==
NULL
)
bcrash
(
"Could not get $HOME
\n
"
);
char
*
path
=
bmalloc
(
strlen
(
path_ptr
)
+
1
);
strcpy
(
path
,
path_ptr
);
return
path
;
}
int
os_mkdir
(
const
char
*
path
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录