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
Hide 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);
...
@@ -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
)
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
);
int
size
=
stream_Peek
(
s
->
p_source
,
&
peek
,
46
);
if
(
i_size
<
1
)
if
(
size
<
7
)
return
false
;
return
false
;
if
(
strncasecmp
((
const
char
*
)
peek
,
"#EXTM3U"
,
7
)
!=
0
)
if
(
memcmp
(
peek
,
"#EXTM3U"
,
7
)
!=
0
)
return
false
;
return
false
;
peek
+=
7
;
size
-=
7
;
/* Parse stream and search for
/* Parse stream and search for
* EXT-X-TARGETDURATION or EXT-X-STREAM-INF tag, see
* EXT-X-TARGETDURATION or EXT-X-STREAM-INF tag, see
* http://tools.ietf.org/html/draft-pantos-http-live-streaming-04#page-8 */
* http://tools.ietf.org/html/draft-pantos-http-live-streaming-04#page-8 */
peek_end
=
peek
+
i_size
;
while
(
size
--
)
while
(
peek
<=
peek_end
)
{
{
static
const
char
*
const
ext
[]
=
{
if
(
*
peek
==
'#'
)
"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
++
)
{
{
for
(
unsigned
int
i
=
0
;
i
<
ARRAY_SIZE
(
ext
);
i
++
)
size_t
len
=
strlen
(
ext
[
i
]);
{
if
(
size
<
len
)
char
*
p
=
strstr
((
const
char
*
)
peek
,
ext
[
i
]);
continue
;
if
(
p
!=
NULL
)
if
(
!
memcmp
(
peek
,
ext
[
i
],
len
))
return
true
;
return
true
;
}
}
}
peek
++
;
}
};
return
false
;
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