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
f2f15f46
Commit
f2f15f46
authored
Jun 15, 2008
by
bl4
Committed by
Rémi Denis-Courmont
Jun 15, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
M3U playlist detection
Signed-off-by:
Rémi Denis-Courmont
<
rdenis@simphalempin.com
>
parent
8c032439
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
modules/demux/playlist/m3u.c
modules/demux/playlist/m3u.c
+37
-1
No files found.
modules/demux/playlist/m3u.c
View file @
f2f15f46
...
...
@@ -47,6 +47,7 @@ struct demux_sys_t
static
int
Demux
(
demux_t
*
p_demux
);
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
);
static
void
parseEXTINF
(
char
*
psz_string
,
char
**
ppsz_artist
,
char
**
ppsz_name
,
int
*
pi_duration
);
static
bool
ContainsURL
(
demux_t
*
p_demux
);
/*****************************************************************************
* Import_M3U: main import function
...
...
@@ -61,7 +62,7 @@ int Import_M3U( vlc_object_t *p_this )
demux_IsPathExtension
(
p_demux
,
".m3u"
)
||
demux_IsPathExtension
(
p_demux
,
".vlc"
)
||
/* A .ram file can contain a single rtsp link */
demux_IsPathExtension
(
p_demux
,
".ram"
)
||
demux_IsPathExtension
(
p_demux
,
".rm"
)
||
demux_IsForced
(
p_demux
,
"m3u"
)
)
)
demux_IsForced
(
p_demux
,
"m3u"
)
||
ContainsURL
(
p_demux
)
)
)
return
VLC_EGENERIC
;
STANDARD_DEMUX_INIT_MSG
(
"found valid M3U playlist"
);
...
...
@@ -70,6 +71,41 @@ int Import_M3U( vlc_object_t *p_this )
return
VLC_SUCCESS
;
}
static
bool
ContainsURL
(
demux_t
*
p_demux
)
{
uint8_t
*
p_peek
;
int
i_peek
;
uint8_t
*
p_peek_end
;
i_peek
=
stream_Peek
(
p_demux
->
s
,
&
p_peek
,
1024
);
if
(
i_peek
<=
0
)
return
false
;
p_peek_end
=
p_peek
+
i_peek
;
while
(
p_peek
+
sizeof
(
"https://"
)
<
p_peek_end
)
{
/* One line starting with an URL is enough */
if
(
!
strncasecmp
(
p_peek
,
"http://"
,
sizeof
(
"http://"
)
-
1
)
||
!
strncasecmp
(
p_peek
,
"mms://"
,
sizeof
(
"mms://"
)
-
1
)
||
!
strncasecmp
(
p_peek
,
"rtsp://"
,
sizeof
(
"rtsp://"
)
-
1
)
||
!
strncasecmp
(
p_peek
,
"https://"
,
sizeof
(
"https://"
)
-
1
)
||
!
strncasecmp
(
p_peek
,
"ftp://"
,
sizeof
(
"ftp://"
)
-
1
)
)
{
return
true
;
}
/* Comments and blank lines are ignored */
else
if
(
*
p_peek
!=
'#'
&&
*
p_peek
!=
'\n'
&&
*
p_peek
!=
'\r'
)
{
return
false
;
}
while
(
p_peek
<
p_peek_end
&&
*
p_peek
!=
'\n'
)
p_peek
++
;
if
(
*
p_peek
==
'\n'
)
p_peek
++
;
}
return
false
;
}
/*****************************************************************************
* Deactivate: frees unused data
*****************************************************************************/
...
...
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