Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
dc04acdb
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,发现更多精彩内容 >>
提交
dc04acdb
编写于
6月 15, 2016
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vlc-video: Add ability to add directories to playlist
上级
d0eae5d0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
76 addition
and
18 deletion
+76
-18
plugins/vlc-video/vlc-video-source.c
plugins/vlc-video/vlc-video-source.c
+76
-18
未找到文件。
plugins/vlc-video/vlc-video-source.c
浏览文件 @
dc04acdb
#include "vlc-video-plugin.h"
#include <media-io/video-frame.h>
#include <util/threading.h>
#include <util/platform.h>
#include <util/dstr.h>
#define do_log(level, format, ...) \
...
...
@@ -374,6 +375,57 @@ static int vlcs_audio_setup(void **p_data, char *format, unsigned *rate,
return
0
;
}
static
void
add_file
(
struct
vlc_source
*
c
,
struct
darray
*
array
,
const
char
*
path
)
{
DARRAY
(
struct
media_file_data
)
new_files
;
struct
media_file_data
data
;
struct
dstr
new_path
=
{
0
};
libvlc_media_t
*
new_media
;
new_files
.
da
=
*
array
;
dstr_copy
(
&
new_path
,
path
);
#ifdef _WIN32
dstr_replace
(
&
new_path
,
"/"
,
"
\\
"
);
#endif
path
=
new_path
.
array
;
new_media
=
get_media
(
&
c
->
files
.
da
,
path
);
if
(
!
new_media
)
new_media
=
get_media
(
&
new_files
.
da
,
path
);
if
(
!
new_media
)
new_media
=
create_media_from_file
(
path
);
if
(
new_media
)
{
data
.
path
=
new_path
.
array
;
data
.
media
=
new_media
;
da_push_back
(
new_files
,
&
data
);
}
else
{
dstr_free
(
&
new_path
);
}
*
array
=
new_files
.
da
;
}
static
bool
valid_extension
(
const
char
*
ext
)
{
if
(
!
ext
)
return
false
;
return
astrcmpi
(
ext
,
".mp4"
)
==
0
||
astrcmpi
(
ext
,
".ts"
)
==
0
||
astrcmpi
(
ext
,
".mov"
)
==
0
||
astrcmpi
(
ext
,
".flv"
)
==
0
||
astrcmpi
(
ext
,
".mkv"
)
==
0
||
astrcmpi
(
ext
,
".avi"
)
==
0
||
astrcmpi
(
ext
,
".mp3"
)
==
0
||
astrcmpi
(
ext
,
".ogg"
)
==
0
||
astrcmpi
(
ext
,
".aac"
)
==
0
||
astrcmpi
(
ext
,
".wav"
)
==
0
||
astrcmpi
(
ext
,
".webm"
)
==
0
;
}
static
void
vlcs_update
(
void
*
data
,
obs_data_t
*
settings
)
{
DARRAY
(
struct
media_file_data
)
new_files
;
...
...
@@ -408,29 +460,35 @@ static void vlcs_update(void *data, obs_data_t *settings)
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
obs_data_t
*
item
=
obs_data_array_item
(
array
,
i
);
const
char
*
path
=
obs_data_get_string
(
item
,
"value"
);
struct
media_file_data
data
;
struct
dstr
new_path
=
{
0
};
libvlc_media_t
*
new_media
;
os_dir_t
*
dir
=
os_opendir
(
path
);
dstr_copy
(
&
new_path
,
path
);
#ifdef _WIN32
dstr_replace
(
&
new_path
,
"/"
,
"
\\
"
);
#endif
path
=
new_path
.
array
;
if
(
dir
)
{
struct
dstr
dir_path
=
{
0
};
struct
os_dirent
*
ent
;
for
(;;)
{
const
char
*
ext
;
ent
=
os_readdir
(
dir
);
if
(
!
ent
)
break
;
if
(
ent
->
directory
)
continue
;
new_media
=
get_media
(
&
c
->
files
.
da
,
path
);
ext
=
os_get_path_extension
(
ent
->
d_name
);
if
(
!
valid_extension
(
ext
))
continue
;
if
(
!
new_media
)
new_media
=
get_media
(
&
new_files
.
da
,
path
);
if
(
!
new_media
)
new_media
=
create_media_from_file
(
path
);
dstr_copy
(
&
dir_path
,
path
);
dstr_cat_ch
(
&
dir_path
,
'/'
);
dstr_cat
(
&
dir_path
,
ent
->
d_name
);
add_file
(
c
,
&
new_files
.
da
,
dir_path
.
array
);
}
if
(
new_media
)
{
data
.
path
=
new_path
.
array
;
data
.
media
=
new_media
;
da_push_back
(
new_files
,
&
data
);
dstr_free
(
&
dir_path
);
os_closedir
(
dir
);
}
else
{
dstr_free
(
&
new_
path
);
add_file
(
c
,
&
new_files
.
da
,
path
);
}
obs_data_release
(
item
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录