Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
b4b87526
Commit
b4b87526
authored
Jul 14, 2016
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: hls: set demux only from file extensions
we can no longer rely on codecs to guess format
parent
a1b3900b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
43 deletions
+33
-43
modules/demux/adaptive/SegmentTracker.cpp
modules/demux/adaptive/SegmentTracker.cpp
+26
-1
modules/demux/adaptive/SegmentTracker.hpp
modules/demux/adaptive/SegmentTracker.hpp
+1
-1
modules/demux/adaptive/Streams.cpp
modules/demux/adaptive/Streams.cpp
+1
-1
modules/demux/hls/HLSStreams.cpp
modules/demux/hls/HLSStreams.cpp
+0
-3
modules/demux/hls/playlist/Parser.cpp
modules/demux/hls/playlist/Parser.cpp
+5
-36
modules/demux/hls/playlist/Parser.hpp
modules/demux/hls/playlist/Parser.hpp
+0
-1
No files found.
modules/demux/adaptive/SegmentTracker.cpp
View file @
b4b87526
...
...
@@ -77,13 +77,18 @@ void SegmentTracker::setAdaptationLogic(AbstractAdaptationLogic *logic_)
registerListener
(
logic
);
}
StreamFormat
SegmentTracker
::
initial
Format
()
const
StreamFormat
SegmentTracker
::
getCurrent
Format
()
const
{
BaseRepresentation
*
rep
=
curRepresentation
;
if
(
!
rep
)
rep
=
logic
->
getNextRepresentation
(
adaptationSet
,
NULL
);
if
(
rep
)
{
/* Ensure ephemere content is updated/loaded */
if
(
rep
->
needsUpdate
())
(
void
)
rep
->
runLocalUpdates
(
0
,
curNumber
,
false
);
return
rep
->
getStreamFormat
();
}
return
StreamFormat
();
}
...
...
@@ -167,6 +172,26 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
curRepresentation
->
scheduleNextUpdate
(
next
);
}
if
(
rep
->
getStreamFormat
()
!=
format
)
{
/* Initial format ? */
if
(
format
==
StreamFormat
(
StreamFormat
::
UNSUPPORTED
))
{
format
=
rep
->
getStreamFormat
();
}
else
{
format
=
rep
->
getStreamFormat
();
notify
(
SegmentTrackerEvent
(
&
format
));
/* Notify new demux format */
return
NULL
;
/* Force current demux to end */
}
}
if
(
format
==
StreamFormat
(
StreamFormat
::
UNSUPPORTED
))
{
return
NULL
;
/* Can't return chunk because no demux will be created */
}
if
(
!
init_sent
)
{
init_sent
=
true
;
...
...
modules/demux/adaptive/SegmentTracker.hpp
View file @
b4b87526
...
...
@@ -91,7 +91,7 @@ namespace adaptive
~
SegmentTracker
();
void
setAdaptationLogic
(
AbstractAdaptationLogic
*
);
StreamFormat
initial
Format
()
const
;
StreamFormat
getCurrent
Format
()
const
;
bool
segmentsListReady
()
const
;
void
reset
();
SegmentChunk
*
getNextChunk
(
bool
,
HTTPConnectionManager
*
);
...
...
modules/demux/adaptive/Streams.cpp
View file @
b4b87526
...
...
@@ -274,7 +274,7 @@ AbstractStream::buffering_status AbstractStream::bufferize(mtime_t nz_deadline,
if
(
!
demuxer
)
{
format
=
segmentTracker
->
initial
Format
();
format
=
segmentTracker
->
getCurrent
Format
();
if
(
!
startDemux
())
{
/* If demux fails because of probing failure / wrong format*/
...
...
modules/demux/hls/HLSStreams.cpp
View file @
b4b87526
...
...
@@ -58,9 +58,6 @@ AbstractDemuxer * HLSStream::createDemux(const StreamFormat &format)
AbstractDemuxer
*
ret
=
NULL
;
switch
((
unsigned
)
format
)
{
case
StreamFormat
::
UNKNOWN
:
ret
=
new
Demuxer
(
p_realdemux
,
"any"
,
fakeesout
->
getEsOut
(),
demuxersource
);
break
;
case
StreamFormat
::
PACKEDAAC
:
ret
=
new
Demuxer
(
p_realdemux
,
"avformat"
,
fakeesout
->
getEsOut
(),
demuxersource
);
...
...
modules/demux/hls/playlist/Parser.cpp
View file @
b4b87526
...
...
@@ -73,37 +73,6 @@ static void releaseTagsList(std::list<Tag *> &list)
list
.
clear
();
}
void
M3U8Parser
::
setFormatFromCodecs
(
Representation
*
rep
,
const
std
::
string
codecsstring
)
{
std
::
list
<
std
::
string
>
codecs
;
std
::
list
<
std
::
string
>
tokens
=
Helper
::
tokenize
(
codecsstring
,
','
);
std
::
list
<
std
::
string
>::
const_iterator
it
;
for
(
it
=
tokens
.
begin
();
it
!=
tokens
.
end
();
++
it
)
{
/* Truncate init data */
std
::
size_t
pos
=
(
*
it
).
find_first_of
(
'.'
,
0
);
if
(
pos
!=
std
::
string
::
npos
)
codecs
.
push_back
((
*
it
).
substr
(
0
,
pos
));
else
codecs
.
push_back
(
*
it
);
}
if
(
!
codecs
.
empty
())
{
if
(
codecs
.
size
()
==
1
)
{
std
::
string
codec
=
codecs
.
front
();
transform
(
codec
.
begin
(),
codec
.
end
(),
codec
.
begin
(),
(
int
(
*
)(
int
))
std
::
tolower
);
if
(
codec
==
"mp4a"
)
rep
->
streamFormat
=
StreamFormat
(
StreamFormat
::
PACKEDAAC
);
}
else
{
rep
->
streamFormat
=
StreamFormat
(
StreamFormat
::
MPEG2TS
);
}
}
}
void
M3U8Parser
::
setFormatFromExtension
(
Representation
*
rep
,
const
std
::
string
&
filename
)
{
std
::
size_t
pos
=
filename
.
find_last_of
(
'.'
);
...
...
@@ -115,10 +84,14 @@ void M3U8Parser::setFormatFromExtension(Representation *rep, const std::string &
{
rep
->
streamFormat
=
StreamFormat
(
StreamFormat
::
PACKEDAAC
);
}
else
if
(
extension
==
"ts"
||
extension
==
"mp2t"
||
extension
==
"mpeg"
)
else
if
(
extension
==
"ts"
||
extension
==
"mp2t"
||
extension
==
"mpeg"
||
extension
==
"m2ts"
)
{
rep
->
streamFormat
=
StreamFormat
(
StreamFormat
::
MPEG2TS
);
}
else
{
rep
->
streamFormat
=
StreamFormat
(
StreamFormat
::
UNSUPPORTED
);
}
}
}
...
...
@@ -126,7 +99,6 @@ Representation * M3U8Parser::createRepresentation(BaseAdaptationSet *adaptSet, c
{
const
Attribute
*
uriAttr
=
tag
->
getAttributeByName
(
"URI"
);
const
Attribute
*
bwAttr
=
tag
->
getAttributeByName
(
"BANDWIDTH"
);
const
Attribute
*
codecsAttr
=
tag
->
getAttributeByName
(
"CODECS"
);
const
Attribute
*
resAttr
=
tag
->
getAttributeByName
(
"RESOLUTION"
);
Representation
*
rep
=
new
(
std
::
nothrow
)
Representation
(
adaptSet
);
...
...
@@ -156,9 +128,6 @@ Representation * M3U8Parser::createRepresentation(BaseAdaptationSet *adaptSet, c
if
(
bwAttr
)
rep
->
setBandwidth
(
bwAttr
->
decimal
());
if
(
codecsAttr
)
setFormatFromCodecs
(
rep
,
codecsAttr
->
quotedString
());
if
(
resAttr
)
{
std
::
pair
<
int
,
int
>
res
=
resAttr
->
getResolution
();
...
...
modules/demux/hls/playlist/Parser.hpp
View file @
b4b87526
...
...
@@ -63,7 +63,6 @@ namespace hls
void
createAndFillRepresentation
(
vlc_object_t
*
,
BaseAdaptationSet
*
,
const
AttributesTag
*
,
const
std
::
list
<
Tag
*>&
);
void
parseSegments
(
vlc_object_t
*
,
Representation
*
,
const
std
::
list
<
Tag
*>&
);
void
setFormatFromCodecs
(
Representation
*
,
const
std
::
string
);
void
setFormatFromExtension
(
Representation
*
rep
,
const
std
::
string
&
);
std
::
list
<
Tag
*>
parseEntries
(
stream_t
*
);
};
...
...
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