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
74f02326
Commit
74f02326
authored
Mar 05, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httplive: fix stream detection
Using str*() on a bytestream is a bad idea.
parent
93a0d5ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
27 deletions
+39
-27
modules/stream_filter/httplive.c
modules/stream_filter/httplive.c
+39
-27
No files found.
modules/stream_filter/httplive.c
View file @
74f02326
...
...
@@ -165,45 +165,57 @@ static void segment_Free(segment_t *segment);
/****************************************************************************
*
****************************************************************************/
static
const
char
*
const
ext
[]
=
{
"#EXT-X-TARGETDURATION"
,
"#EXT-X-MEDIA-SEQUENCE"
,
"#EXT-X-KEY"
,
"#EXT-X-ALLOW-CACHE"
,
"#EXT-X-ENDLIST"
,
"#EXT-X-STREAM-INF"
,
"#EXT-X-DISCONTINUITY"
,
"#EXT-X-VERSION"
};
static
bool
isHTTPLiveStreaming
(
stream_t
*
s
)
{
const
uint8_t
*
peek
,
*
peek_end
;
const
uint8_t
*
peek
;
int
64_t
i_
size
=
stream_Peek
(
s
->
p_source
,
&
peek
,
46
);
if
(
i_size
<
1
)
int
size
=
stream_Peek
(
s
->
p_source
,
&
peek
,
46
);
if
(
size
<
7
)
return
false
;
if
(
strncasecmp
((
const
char
*
)
peek
,
"#EXTM3U"
,
7
)
!=
0
)
if
(
memcmp
(
peek
,
"#EXTM3U"
,
7
)
!=
0
)
return
false
;
peek
+=
7
;
size
-=
7
;
/* Parse stream and search for
* EXT-X-TARGETDURATION or EXT-X-STREAM-INF tag, see
* http://tools.ietf.org/html/draft-pantos-http-live-streaming-04#page-8 */
peek_end
=
peek
+
i_size
;
while
(
peek
<=
peek_end
)
{
if
(
*
peek
==
'#'
)
{
for
(
unsigned
int
i
=
0
;
i
<
ARRAY_SIZE
(
ext
);
i
++
)
while
(
size
--
)
{
static
const
char
*
const
ext
[]
=
{
"TARGETDURATION"
,
"MEDIA-SEQUENCE"
,
"KEY"
,
"ALLOW-CACHE"
,
"ENDLIST"
,
"STREAM-INF"
,
"DISCONTINUITY"
,
"VERSION"
};
if
(
*
peek
++
!=
'#'
)
continue
;
if
(
size
<
6
)
continue
;
if
(
memcmp
(
peek
,
"EXT-X-"
,
6
))
continue
;
peek
+=
6
;
size
-=
6
;
for
(
size_t
i
=
0
;
i
<
ARRAY_SIZE
(
ext
);
i
++
)
{
char
*
p
=
strstr
((
const
char
*
)
peek
,
ext
[
i
]);
if
(
p
!=
NULL
)
size_t
len
=
strlen
(
ext
[
i
]);
if
(
size
<
len
)
continue
;
if
(
!
memcmp
(
peek
,
ext
[
i
],
len
))
return
true
;
}
}
peek
++
;
};
return
false
;
}
...
...
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