Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b62156ba
Commit
b62156ba
authored
May 07, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move ignore-filetypes option from directory access to directory demux
parent
50922179
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
56 deletions
+53
-56
modules/access/directory.c
modules/access/directory.c
+0
-46
modules/access/fs.c
modules/access/fs.c
+0
-9
modules/demux/playlist/directory.c
modules/demux/playlist/directory.c
+44
-1
modules/demux/playlist/playlist.c
modules/demux/playlist/playlist.c
+9
-0
No files found.
modules/access/directory.c
View file @
b62156ba
...
...
@@ -80,7 +80,6 @@ struct directory
struct
access_sys_t
{
directory
*
current
;
char
*
ignored_exts
;
char
mode
;
};
...
...
@@ -90,45 +89,6 @@ static int visible (const char *name)
return
name
[
0
]
!=
'.'
;
}
/**
* Does the provided URI/path/stuff has one of the extension provided ?
*
* \param psz_exts A comma separated list of extension without dot, or only
* one ext (ex: "avi,mkv,webm")
* \param psz_uri The uri/path to check (ex: "file:///home/foo/bar.avi"). If
* providing an URI, it must not contain a query string.
*
* \return true if the uri/path has one of the provided extension
* false otherwise.
*/
static
bool
has_ext
(
const
char
*
psz_exts
,
const
char
*
psz_uri
)
{
if
(
psz_exts
==
NULL
)
return
false
;
const
char
*
ext
=
strrchr
(
psz_uri
,
'.'
);
if
(
ext
==
NULL
)
return
false
;
size_t
extlen
=
strlen
(
++
ext
);
for
(
const
char
*
type
=
psz_exts
,
*
end
;
type
[
0
];
type
=
end
+
1
)
{
end
=
strchr
(
type
,
','
);
if
(
end
==
NULL
)
end
=
type
+
strlen
(
type
);
if
(
type
+
extlen
==
end
&&
!
strncasecmp
(
ext
,
type
,
extlen
))
return
true
;
if
(
*
end
==
'\0'
)
break
;
}
return
false
;
}
#ifdef HAVE_OPENAT
/* Detect directories that recurse into themselves. */
static
bool
has_inode_loop
(
const
directory
*
dir
,
dev_t
dev
,
ino_t
inode
)
...
...
@@ -298,7 +258,6 @@ int DirInit (access_t *p_access, DIR *handle)
free
(
uri
);
p_access
->
p_sys
=
p_sys
;
p_sys
->
ignored_exts
=
var_InheritString
(
p_access
,
"ignore-filetypes"
);
p_access
->
pf_readdir
=
DirRead
;
...
...
@@ -320,7 +279,6 @@ void DirClose( vlc_object_t * p_this )
while
(
directory_pop
(
p_sys
))
;
free
(
p_sys
->
ignored_exts
);
free
(
p_sys
);
}
...
...
@@ -345,10 +303,6 @@ input_item_t* DirRead (access_t *p_access)
/* Check if it is a directory or even readable */
i_res
=
directory_open
(
p_current
,
psz_entry
,
&
handle
);
if
(
i_res
==
ENTRY_EACCESS
||
(
i_res
==
ENTRY_ENOTDIR
&&
has_ext
(
p_sys
->
ignored_exts
,
psz_entry
)))
continue
;
/* Create an input item for the current entry */
psz_uri
=
encode_URI_component
(
psz_entry
);
if
(
psz_uri
==
NULL
...
...
modules/access/fs.c
View file @
b62156ba
...
...
@@ -30,13 +30,6 @@
#include "fs.h"
#include <vlc_plugin.h>
#define IGNORE_TEXT N_("Ignored extensions")
#define IGNORE_LONGTEXT N_( \
"Files with these extensions will not be added to playlist when " \
"opening a directory.\n" \
"This is useful if you add directories that contain playlist files " \
"for instance. Use a comma-separated list of extensions." )
vlc_module_begin
()
set_description
(
N_
(
"File input"
)
)
set_shortname
(
N_
(
"File"
)
)
...
...
@@ -50,8 +43,6 @@ vlc_module_begin ()
add_submodule
()
set_section
(
N_
(
"Directory"
),
NULL
)
set_capability
(
"access"
,
55
)
add_string
(
"ignore-filetypes"
,
"m3u,db,nfo,ini,jpg,jpeg,ljpg,gif,png,pgm,pgmyuv,pbm,pam,tga,bmp,pnm,xpm,xcf,pcx,tif,tiff,lbm,sfv,txt,sub,idx,srt,cue,ssa"
,
IGNORE_TEXT
,
IGNORE_LONGTEXT
,
false
)
#ifndef HAVE_FDOPENDIR
add_shortcut
(
"file"
,
"directory"
,
"dir"
)
#else
...
...
modules/demux/playlist/directory.c
View file @
b62156ba
...
...
@@ -68,6 +68,44 @@ void Close_Dir ( vlc_object_t *p_this )
free
(
p_demux
->
p_sys
);
}
/**
* Does the provided URI/path/stuff has one of the extension provided ?
*
* \param psz_exts A comma separated list of extension without dot, or only
* one ext (ex: "avi,mkv,webm")
* \param psz_uri The uri/path to check (ex: "file:///home/foo/bar.avi"). If
* providing an URI, it must not contain a query string.
*
* \return true if the uri/path has one of the provided extension
* false otherwise.
*/
static
bool
has_ext
(
const
char
*
psz_exts
,
const
char
*
psz_uri
)
{
if
(
psz_exts
==
NULL
)
return
false
;
const
char
*
ext
=
strrchr
(
psz_uri
,
'.'
);
if
(
ext
==
NULL
)
return
false
;
size_t
extlen
=
strlen
(
++
ext
);
for
(
const
char
*
type
=
psz_exts
,
*
end
;
type
[
0
];
type
=
end
+
1
)
{
end
=
strchr
(
type
,
','
);
if
(
end
==
NULL
)
end
=
type
+
strlen
(
type
);
if
(
type
+
extlen
==
end
&&
!
strncasecmp
(
ext
,
type
,
extlen
)
)
return
true
;
if
(
*
end
==
'\0'
)
break
;
}
return
false
;
}
static
int
compar_type
(
input_item_t
*
p1
,
input_item_t
*
p2
)
{
if
(
p1
->
i_type
!=
p2
->
i_type
)
...
...
@@ -110,11 +148,14 @@ static int Demux( demux_t *p_demux )
input_item_t
*
p_input
;
input_item_node_t
*
p_node
;
input_item_t
*
p_item
;
char
*
psz_ignored_exts
;
p_input
=
GetCurrentItem
(
p_demux
);
p_node
=
input_item_node_Create
(
p_input
);
input_item_Release
(
p_input
);
psz_ignored_exts
=
var_InheritString
(
p_demux
,
"ignore-filetypes"
);
while
(
!
i_ret
&&
(
p_item
=
stream_ReadDir
(
p_demux
->
s
)
)
)
{
int
i_name_len
=
p_item
->
psz_name
?
strlen
(
p_item
->
psz_name
)
:
0
;
...
...
@@ -122,7 +163,8 @@ static int Demux( demux_t *p_demux )
/* skip "." and ".." items */
if
(
(
i_name_len
==
1
&&
p_item
->
psz_name
[
0
]
==
'.'
)
||
(
i_name_len
==
2
&&
p_item
->
psz_name
[
0
]
==
'.'
&&
p_item
->
psz_name
[
1
]
==
'.'
)
)
p_item
->
psz_name
[
1
]
==
'.'
)
||
has_ext
(
psz_ignored_exts
,
p_item
->
psz_name
))
goto
skip_item
;
input_item_CopyOptions
(
p_node
->
p_item
,
p_item
);
...
...
@@ -131,6 +173,7 @@ static int Demux( demux_t *p_demux )
skip_item:
input_item_Release
(
p_item
);
}
free
(
psz_ignored_exts
);
if
(
i_ret
)
{
...
...
modules/demux/playlist/playlist.c
View file @
b62156ba
...
...
@@ -61,6 +61,13 @@ static const char *const psz_sort_list_text[] = {
#define SORT_LONGTEXT N_( \
"Define the sort algorithm used when adding items from a directory." )
#define IGNORE_TEXT N_("Ignored extensions")
#define IGNORE_LONGTEXT N_( \
"Files with these extensions will not be added to playlist when " \
"opening a directory.\n" \
"This is useful if you add directories that contain playlist files " \
"for instance. Use a comma-separated list of extensions." )
vlc_module_begin
()
add_shortcut
(
"playlist"
)
set_category
(
CAT_INPUT
)
...
...
@@ -155,6 +162,8 @@ vlc_module_begin ()
add_shortcut
(
"playlist"
,
"directory"
)
set_capability
(
"demux"
,
10
)
set_callbacks
(
Import_Dir
,
Close_Dir
)
add_string
(
"ignore-filetypes"
,
"m3u,db,nfo,ini,jpg,jpeg,ljpg,gif,png,pgm,pgmyuv,pbm,pam,tga,bmp,pnm,xpm,xcf,pcx,tif,tiff,lbm,sfv,txt,sub,idx,srt,cue,ssa"
,
IGNORE_TEXT
,
IGNORE_LONGTEXT
,
false
)
add_string
(
"directory-sort"
,
"collate"
,
SORT_TEXT
,
SORT_LONGTEXT
,
false
)
change_string_list
(
psz_sort_list
,
psz_sort_list_text
)
vlc_module_end
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment