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
d63b800e
Commit
d63b800e
authored
Jul 23, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: hls: move probing to manager
parent
e017b611
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
57 deletions
+59
-57
modules/demux/hls/HLSManager.cpp
modules/demux/hls/HLSManager.cpp
+56
-0
modules/demux/hls/HLSManager.hpp
modules/demux/hls/HLSManager.hpp
+2
-0
modules/demux/hls/hls.cpp
modules/demux/hls/hls.cpp
+1
-57
No files found.
modules/demux/hls/HLSManager.cpp
View file @
d63b800e
...
@@ -46,6 +46,62 @@ HLSManager::~HLSManager()
...
@@ -46,6 +46,62 @@ HLSManager::~HLSManager()
{
{
}
}
bool
HLSManager
::
isHTTPLiveStreaming
(
stream_t
*
s
)
{
const
uint8_t
*
peek
;
int
size
=
stream_Peek
(
s
,
&
peek
,
7
);
if
(
size
<
7
||
memcmp
(
peek
,
"#EXTM3U"
,
7
))
return
false
;
size
=
stream_Peek
(
s
,
&
peek
,
512
);
if
(
size
<
7
)
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 */
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
++
)
{
size_t
len
=
strlen
(
ext
[
i
]);
if
(
size
<
0
||
(
size_t
)
size
<
len
)
continue
;
if
(
!
memcmp
(
peek
,
ext
[
i
],
len
))
return
true
;
}
}
return
false
;
}
AbstractAdaptationLogic
*
HLSManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
)
AbstractAdaptationLogic
*
HLSManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
)
{
{
switch
(
type
)
switch
(
type
)
...
...
modules/demux/hls/HLSManager.hpp
View file @
d63b800e
...
@@ -37,6 +37,8 @@ namespace hls
...
@@ -37,6 +37,8 @@ namespace hls
virtual
~
HLSManager
();
virtual
~
HLSManager
();
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
);
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
);
virtual
bool
updatePlaylist
();
virtual
bool
updatePlaylist
();
static
bool
isHTTPLiveStreaming
(
stream_t
*
);
};
};
}
}
...
...
modules/demux/hls/hls.cpp
View file @
d63b800e
...
@@ -94,67 +94,11 @@ vlc_module_end ()
...
@@ -94,67 +94,11 @@ vlc_module_end ()
/*****************************************************************************
/*****************************************************************************
* Open:
* Open:
*****************************************************************************/
*****************************************************************************/
static
bool
isHTTPLiveStreaming
(
stream_t
*
s
)
{
const
uint8_t
*
peek
;
int
size
=
stream_Peek
(
s
,
&
peek
,
7
);
if
(
size
<
7
||
memcmp
(
peek
,
"#EXTM3U"
,
7
))
return
false
;
size
=
stream_Peek
(
s
,
&
peek
,
512
);
if
(
size
<
7
)
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 */
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
++
)
{
size_t
len
=
strlen
(
ext
[
i
]);
if
(
size
<
0
||
(
size_t
)
size
<
len
)
continue
;
if
(
!
memcmp
(
peek
,
ext
[
i
],
len
))
return
true
;
}
}
return
false
;
}
static
int
Open
(
vlc_object_t
*
p_obj
)
static
int
Open
(
vlc_object_t
*
p_obj
)
{
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_obj
;
demux_t
*
p_demux
=
(
demux_t
*
)
p_obj
;
if
(
!
isHTTPLiveStreaming
(
p_demux
->
s
))
if
(
!
HLSManager
::
isHTTPLiveStreaming
(
p_demux
->
s
))
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
Parser
parser
(
p_demux
->
s
);
Parser
parser
(
p_demux
->
s
);
...
...
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