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
697f59f9
Commit
697f59f9
authored
Dec 17, 2014
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: dash: regroup under SegmentInformation
parent
738ebc3c
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
438 additions
and
296 deletions
+438
-296
modules/stream_filter/Makefile.am
modules/stream_filter/Makefile.am
+2
-0
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
...m_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
+1
-1
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
...filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+1
-1
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
...m_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
+1
-1
modules/stream_filter/dash/adaptationlogic/AlwaysLowestAdaptationLogic.cpp
...lter/dash/adaptationlogic/AlwaysLowestAdaptationLogic.cpp
+1
-1
modules/stream_filter/dash/adaptationlogic/AlwaysLowestAdaptationLogic.hpp
...lter/dash/adaptationlogic/AlwaysLowestAdaptationLogic.hpp
+1
-1
modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
...les/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
+1
-1
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
..._filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
+1
-1
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
...am_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
+1
-1
modules/stream_filter/dash/mp4/AtomsReader.cpp
modules/stream_filter/dash/mp4/AtomsReader.cpp
+6
-7
modules/stream_filter/dash/mp4/AtomsReader.hpp
modules/stream_filter/dash/mp4/AtomsReader.hpp
+7
-4
modules/stream_filter/dash/mpd/AdaptationSet.cpp
modules/stream_filter/dash/mpd/AdaptationSet.cpp
+2
-23
modules/stream_filter/dash/mpd/AdaptationSet.h
modules/stream_filter/dash/mpd/AdaptationSet.h
+3
-6
modules/stream_filter/dash/mpd/IMPDParser.cpp
modules/stream_filter/dash/mpd/IMPDParser.cpp
+0
-12
modules/stream_filter/dash/mpd/IMPDParser.h
modules/stream_filter/dash/mpd/IMPDParser.h
+0
-1
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+91
-51
modules/stream_filter/dash/mpd/IsoffMainParser.h
modules/stream_filter/dash/mpd/IsoffMainParser.h
+5
-4
modules/stream_filter/dash/mpd/Period.cpp
modules/stream_filter/dash/mpd/Period.cpp
+1
-1
modules/stream_filter/dash/mpd/Period.h
modules/stream_filter/dash/mpd/Period.h
+3
-1
modules/stream_filter/dash/mpd/Representation.cpp
modules/stream_filter/dash/mpd/Representation.cpp
+1
-118
modules/stream_filter/dash/mpd/Representation.h
modules/stream_filter/dash/mpd/Representation.h
+2
-18
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.cpp
+24
-32
modules/stream_filter/dash/mpd/Segment.h
modules/stream_filter/dash/mpd/Segment.h
+11
-10
modules/stream_filter/dash/mpd/SegmentInformation.cpp
modules/stream_filter/dash/mpd/SegmentInformation.cpp
+187
-0
modules/stream_filter/dash/mpd/SegmentInformation.hpp
modules/stream_filter/dash/mpd/SegmentInformation.hpp
+85
-0
No files found.
modules/stream_filter/Makefile.am
View file @
697f59f9
...
...
@@ -70,6 +70,8 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/mpd/SegmentInfoCommon.h
\
stream_filter/dash/mpd/SegmentInfoDefault.cpp
\
stream_filter/dash/mpd/SegmentInfoDefault.h
\
stream_filter/dash/mpd/SegmentInformation.cpp
\
stream_filter/dash/mpd/SegmentInformation.hpp
\
stream_filter/dash/mpd/SegmentList.cpp
\
stream_filter/dash/mpd/SegmentList.h
\
stream_filter/dash/mpd/SegmentTemplate.cpp
\
...
...
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
View file @
697f59f9
...
...
@@ -50,7 +50,7 @@ Chunk* AbstractAdaptationLogic::getNextChunk(Streams::Type type)
if
(
!
currentPeriod
)
return
NULL
;
const
Representation
*
rep
=
getCurrentRepresentation
(
type
);
Representation
*
rep
=
getCurrentRepresentation
(
type
);
if
(
rep
==
NULL
)
return
NULL
;
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
View file @
697f59f9
...
...
@@ -36,7 +36,7 @@ AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic (MPD *mpd) :
{
}
const
Representation
*
AlwaysBestAdaptationLogic
::
getCurrentRepresentation
(
Streams
::
Type
type
)
const
Representation
*
AlwaysBestAdaptationLogic
::
getCurrentRepresentation
(
Streams
::
Type
type
)
const
{
RepresentationSelector
selector
;
return
selector
.
select
(
currentPeriod
,
type
);
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
View file @
697f59f9
...
...
@@ -36,7 +36,7 @@ namespace dash
public:
AlwaysBestAdaptationLogic
(
mpd
::
MPD
*
mpd
);
virtual
const
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
;
virtual
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
;
};
}
}
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysLowestAdaptationLogic.cpp
View file @
697f59f9
...
...
@@ -28,7 +28,7 @@ AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic(mpd::MPD *mpd):
{
}
const
Representation
*
AlwaysLowestAdaptationLogic
::
getCurrentRepresentation
(
Streams
::
Type
type
)
const
Representation
*
AlwaysLowestAdaptationLogic
::
getCurrentRepresentation
(
Streams
::
Type
type
)
const
{
RepresentationSelector
selector
;
return
selector
.
select
(
currentPeriod
,
type
,
0
);
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysLowestAdaptationLogic.hpp
View file @
697f59f9
...
...
@@ -31,7 +31,7 @@ namespace dash
public:
AlwaysLowestAdaptationLogic
(
mpd
::
MPD
*
mpd
);
virtual
const
dash
::
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
;
virtual
dash
::
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
;
};
}
}
...
...
modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
View file @
697f59f9
...
...
@@ -48,7 +48,7 @@ namespace dash
};
virtual
dash
::
http
::
Chunk
*
getNextChunk
(
Streams
::
Type
)
=
0
;
virtual
const
dash
::
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
=
0
;
virtual
dash
::
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
=
0
;
};
}
}
...
...
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
View file @
697f59f9
...
...
@@ -43,7 +43,7 @@ RateBasedAdaptationLogic::RateBasedAdaptationLogic (MPD *mpd) :
height
=
var_InheritInteger
(
mpd
->
getVLCObject
(),
"dash-prefheight"
);
}
const
Representation
*
RateBasedAdaptationLogic
::
getCurrentRepresentation
(
Streams
::
Type
type
)
const
Representation
*
RateBasedAdaptationLogic
::
getCurrentRepresentation
(
Streams
::
Type
type
)
const
{
if
(
currentPeriod
==
NULL
)
return
NULL
;
...
...
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
View file @
697f59f9
...
...
@@ -38,7 +38,7 @@ namespace dash
public:
RateBasedAdaptationLogic
(
mpd
::
MPD
*
mpd
);
const
dash
::
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
;
dash
::
mpd
::
Representation
*
getCurrentRepresentation
(
Streams
::
Type
)
const
;
virtual
void
updateDownloadRate
(
size_t
,
mtime_t
);
private:
...
...
modules/stream_filter/dash/mp4/AtomsReader.cpp
View file @
697f59f9
...
...
@@ -24,15 +24,14 @@
using
namespace
dash
::
mp4
;
using
namespace
dash
::
mpd
;
AtomsReader
::
AtomsReader
(
ISegment
*
segmen
t_
)
AtomsReader
::
AtomsReader
(
vlc_object_t
*
objec
t_
)
{
segment
=
segmen
t_
;
object
=
objec
t_
;
rootbox
=
NULL
;
}
AtomsReader
::~
AtomsReader
()
{
vlc_object_t
*
object
=
segment
->
getRepresentation
()
->
getMPD
()
->
getVLCObject
();
while
(
rootbox
&&
rootbox
->
p_first
)
{
MP4_Box_t
*
p_next
=
rootbox
->
p_first
->
p_next
;
...
...
@@ -42,11 +41,11 @@ AtomsReader::~AtomsReader()
delete
rootbox
;
}
bool
AtomsReader
::
parseBlock
(
void
*
buffer
,
size_t
size
)
bool
AtomsReader
::
parseBlock
(
void
*
buffer
,
size_t
size
,
Representation
*
rep
)
{
if
(
!
segment
->
getRepresentation
()
)
if
(
!
rep
)
return
false
;
vlc_object_t
*
object
=
segment
->
getRepresentation
()
->
getMPD
()
->
getVLCObject
();
stream_t
*
stream
=
stream_MemoryNew
(
object
,
(
uint8_t
*
)
buffer
,
size
,
true
);
if
(
stream
)
{
...
...
@@ -78,7 +77,7 @@ bool AtomsReader::parseBlock(void *buffer, size_t size)
point
.
offset
+=
sidx
->
p_items
[
i
].
i_referenced_size
;
point
.
time
+=
sidx
->
p_items
[
i
].
i_subsegment_duration
;
}
segment
->
getRepresentation
()
->
SplitUsingIndex
(
splitlist
);
rep
->
SplitUsingIndex
(
splitlist
);
}
}
stream_Delete
(
stream
);
...
...
modules/stream_filter/dash/mp4/AtomsReader.hpp
View file @
697f59f9
...
...
@@ -24,7 +24,6 @@
# include "config.h"
#endif
#include "mpd/Segment.h"
#include <vlc_common.h>
#include <vlc_stream.h>
extern
"C"
{
...
...
@@ -33,17 +32,21 @@ extern "C" {
namespace
dash
{
namespace
mpd
{
class
Representation
;
}
namespace
mp4
{
class
AtomsReader
{
public:
AtomsReader
(
dash
::
mpd
::
ISegmen
t
*
);
AtomsReader
(
vlc_object_
t
*
);
~
AtomsReader
();
bool
parseBlock
(
void
*
,
size_t
);
bool
parseBlock
(
void
*
,
size_t
,
dash
::
mpd
::
Representation
*
);
protected:
dash
::
mpd
::
ISegment
*
segmen
t
;
vlc_object_t
*
objec
t
;
MP4_Box_t
*
rootbox
;
};
}
...
...
modules/stream_filter/dash/mpd/AdaptationSet.cpp
View file @
697f59f9
...
...
@@ -38,12 +38,10 @@
using
namespace
dash
::
mpd
;
AdaptationSet
::
AdaptationSet
(
Period
*
period
)
:
ICanonicalUrl
(
period
),
SegmentInformation
(
period
),
subsegmentAlignmentFlag
(
false
),
segmentInfoDefault
(
NULL
),
isBitstreamSwitching
(
false
),
mediaTemplate
(
NULL
),
initTemplate
(
NULL
)
isBitstreamSwitching
(
false
)
{
}
...
...
@@ -51,8 +49,6 @@ AdaptationSet::~AdaptationSet ()
{
delete
this
->
segmentInfoDefault
;
vlc_delete_all
(
this
->
representations
);
delete
mediaTemplate
;
delete
initTemplate
;
}
const
std
::
string
&
AdaptationSet
::
getMimeType
()
const
...
...
@@ -108,23 +104,6 @@ void AdaptationSet::addRepresentation (Represe
this
->
representations
.
push_back
(
rep
);
}
void
AdaptationSet
::
setTemplates
(
SegmentTemplate
*
media
,
SegmentTemplate
*
init
)
{
mediaTemplate
=
media
;
initTemplate
=
init
;
}
std
::
vector
<
SegmentTemplate
*>
AdaptationSet
::
getTemplates
()
const
{
std
::
vector
<
SegmentTemplate
*>
ret
;
if
(
mediaTemplate
)
{
if
(
initTemplate
)
ret
.
push_back
(
initTemplate
);
ret
.
push_back
(
mediaTemplate
);
}
return
ret
;
}
void
AdaptationSet
::
setBitstreamSwitching
(
bool
value
)
{
...
...
modules/stream_filter/dash/mpd/AdaptationSet.h
View file @
697f59f9
...
...
@@ -31,7 +31,7 @@
#include "mpd/Representation.h"
#include "mpd/CommonAttributesElements.h"
#include "mpd/
ICanonicalUrl
.hpp"
#include "mpd/
SegmentInformation
.hpp"
namespace
dash
{
...
...
@@ -41,7 +41,8 @@ namespace dash
class
Period
;
class
SegmentTemplate
;
class
AdaptationSet
:
public
CommonAttributesElements
,
public
ICanonicalUrl
class
AdaptationSet
:
public
CommonAttributesElements
,
public
SegmentInformation
{
public:
AdaptationSet
(
Period
*
);
...
...
@@ -55,8 +56,6 @@ namespace dash
const
SegmentInfoDefault
*
getSegmentInfoDefault
()
const
;
void
setSegmentInfoDefault
(
const
SegmentInfoDefault
*
seg
);
void
setBitstreamSwitching
(
bool
value
);
void
setTemplates
(
SegmentTemplate
*
,
SegmentTemplate
*
=
NULL
);
std
::
vector
<
SegmentTemplate
*>
getTemplates
()
const
;
bool
getBitstreamSwitching
()
const
;
void
addRepresentation
(
Representation
*
rep
);
virtual
Url
getUrlSegment
()
const
;
/* reimpl */
...
...
@@ -66,8 +65,6 @@ namespace dash
std
::
vector
<
Representation
*>
representations
;
const
SegmentInfoDefault
*
segmentInfoDefault
;
bool
isBitstreamSwitching
;
SegmentTemplate
*
mediaTemplate
;
SegmentTemplate
*
initTemplate
;
};
}
}
...
...
modules/stream_filter/dash/mpd/IMPDParser.cpp
View file @
697f59f9
...
...
@@ -42,18 +42,6 @@ void IMPDParser::setMPDBaseUrl(Node *root)
}
}
void
IMPDParser
::
setPeriods
(
Node
*
root_
)
{
std
::
vector
<
Node
*>
periods
=
DOMHelper
::
getElementByTagName
(
root_
,
"Period"
,
false
);
for
(
size_t
i
=
0
;
i
<
periods
.
size
();
i
++
)
{
Period
*
period
=
new
Period
(
mpd
);
setAdaptationSets
(
periods
.
at
(
i
),
period
);
mpd
->
addPeriod
(
period
);
}
}
MPD
*
IMPDParser
::
getMPD
()
{
return
mpd
;
...
...
modules/stream_filter/dash/mpd/IMPDParser.h
View file @
697f59f9
...
...
@@ -47,7 +47,6 @@ namespace dash
virtual
MPD
*
getMPD
();
virtual
void
setMPDBaseUrl
(
dash
::
xml
::
Node
*
root
);
virtual
void
setAdaptationSets
(
dash
::
xml
::
Node
*
periodNode
,
Period
*
period
)
=
0
;
virtual
void
setPeriods
(
dash
::
xml
::
Node
*
root
);
protected:
dash
::
xml
::
Node
*
root
;
...
...
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
View file @
697f59f9
...
...
@@ -51,7 +51,8 @@ bool IsoffMainParser::parse (Profile profile)
mpd
=
new
MPD
(
p_stream
,
profile
);
setMPDAttributes
();
setMPDBaseUrl
(
root
);
setPeriods
(
root
);
parsePeriods
(
root
);
print
();
return
true
;
}
...
...
@@ -75,15 +76,32 @@ void IsoffMainParser::setMPDAttributes ()
mpd
->
setType
(
it
->
second
);
}
void
IsoffMainParser
::
parse
Template
(
Node
*
templateNode
,
AdaptationSet
*
se
t
)
void
IsoffMainParser
::
parse
Periods
(
Node
*
roo
t
)
{
std
::
vector
<
Node
*>
periods
=
DOMHelper
::
getElementByTagName
(
root
,
"Period"
,
false
);
std
::
vector
<
Node
*>::
const_iterator
it
;
for
(
it
=
periods
.
begin
();
it
!=
periods
.
end
();
it
++
)
{
Period
*
period
=
new
(
std
::
nothrow
)
Period
(
mpd
);
if
(
!
period
)
continue
;
parseSegmentInformation
(
*
it
,
period
);
setAdaptationSets
(
*
it
,
period
);
mpd
->
addPeriod
(
period
);
}
}
size_t
IsoffMainParser
::
parseSegmentTemplate
(
Node
*
templateNode
,
SegmentInformation
*
info
)
{
size_t
total
=
0
;
if
(
templateNode
==
NULL
||
!
templateNode
->
hasAttribute
(
"media"
))
return
;
return
total
;
std
::
string
mediaurl
=
templateNode
->
getAttributeValue
(
"media"
);
SegmentTemplate
*
mediaTemplate
=
NULL
;
if
(
mediaurl
.
empty
()
||
!
(
mediaTemplate
=
new
(
std
::
nothrow
)
SegmentTemplate
(
set
))
)
return
;
if
(
mediaurl
.
empty
()
||
!
(
mediaTemplate
=
new
(
std
::
nothrow
)
SegmentTemplate
(
info
))
)
return
total
;
mediaTemplate
->
setSourceUrl
(
mediaurl
);
if
(
templateNode
->
hasAttribute
(
"startNumber"
))
...
...
@@ -107,11 +125,25 @@ void IsoffMainParser::parseTemplate(Node *templateNode, AdaptationSet *set)
if
(
templateNode
->
hasAttribute
(
"initialization"
))
{
std
::
string
initurl
=
templateNode
->
getAttributeValue
(
"initialization"
);
if
(
!
initurl
.
empty
()
&&
(
initTemplate
=
new
(
std
::
nothrow
)
InitSegmentTemplate
(
set
)))
if
(
!
initurl
.
empty
()
&&
(
initTemplate
=
new
(
std
::
nothrow
)
InitSegmentTemplate
(
info
)))
initTemplate
->
setSourceUrl
(
initurl
);
}
set
->
setTemplates
(
mediaTemplate
,
initTemplate
);
info
->
setSegmentTemplate
(
mediaTemplate
,
SegmentInformation
::
INFOTYPE_MEDIA
);
info
->
setSegmentTemplate
(
initTemplate
,
SegmentInformation
::
INFOTYPE_INIT
);
total
+=
(
mediaTemplate
!=
NULL
);
return
total
;
}
size_t
IsoffMainParser
::
parseSegmentInformation
(
Node
*
node
,
SegmentInformation
*
info
)
{
size_t
total
=
0
;
parseSegmentBase
(
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentBase"
),
info
);
total
+=
parseSegmentList
(
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentList"
),
info
);
total
+=
parseSegmentTemplate
(
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentTemplate"
),
info
);
return
total
;
}
void
IsoffMainParser
::
setAdaptationSets
(
Node
*
periodNode
,
Period
*
period
)
...
...
@@ -127,7 +159,7 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period)
if
((
*
it
)
->
hasAttribute
(
"mimeType"
))
adaptationSet
->
setMimeType
((
*
it
)
->
getAttributeValue
(
"mimeType"
));
parse
Template
(
DOMHelper
::
getFirstChildElementByName
(
*
it
,
"SegmentTemplate"
)
,
adaptationSet
);
parse
SegmentInformation
(
*
it
,
adaptationSet
);
setRepresentations
((
*
it
),
adaptationSet
);
period
->
addAdaptationSet
(
adaptationSet
);
...
...
@@ -161,13 +193,8 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
if
(
repNode
->
hasAttribute
(
"mimeType"
))
currentRepresentation
->
setMimeType
(
repNode
->
getAttributeValue
(
"mimeType"
));
std
::
vector
<
Node
*>
segmentBase
=
DOMHelper
::
getElementByTagName
(
repNode
,
"SegmentBase"
,
false
);
std
::
vector
<
Node
*>
segmentList
=
DOMHelper
::
getElementByTagName
(
repNode
,
"SegmentList"
,
false
);
setSegmentBase
(
segmentBase
,
currentRepresentation
);
setSegmentList
(
segmentList
,
currentRepresentation
);
if
(
segmentBase
.
empty
()
&&
segmentList
.
empty
()
&&
adaptationSet
->
getTemplates
().
empty
())
size_t
totalmediasegments
=
parseSegmentInformation
(
repNode
,
currentRepresentation
);
if
(
!
totalmediasegments
)
{
/* unranged & segment less representation, add fake segment */
SegmentList
*
list
=
new
SegmentList
();
...
...
@@ -188,59 +215,90 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
}
}
void
IsoffMainParser
::
se
t
SegmentBase
(
std
::
vector
<
Node
*
>
&
segmentBase
,
Represent
ation
*
rep
)
void
IsoffMainParser
::
par
seSegmentBase
(
Node
*
segmentBase
Node
,
SegmentInform
ation
*
info
)
{
if
(
segmentBase
.
empty
()
)
if
(
!
segmentBase
Node
)
return
;
else
if
(
segmentBase
.
front
()
->
hasAttribute
(
"indexRange"
))
else
if
(
segmentBase
Node
->
hasAttribute
(
"indexRange"
))
{
SegmentList
*
list
=
new
SegmentList
();
Segment
*
seg
;
size_t
start
=
0
,
end
=
0
;
if
(
std
::
sscanf
(
segmentBase
.
front
()
->
getAttributeValue
(
"indexRange"
).
c_str
(),
"%"
PRIu64
"-%"
PRIu64
,
&
start
,
&
end
)
==
2
)
if
(
std
::
sscanf
(
segmentBase
Node
->
getAttributeValue
(
"indexRange"
).
c_str
(),
"%"
PRIu64
"-%"
PRIu64
,
&
start
,
&
end
)
==
2
)
{
seg
=
new
IndexSegment
(
rep
);
seg
=
new
IndexSegment
(
info
);
seg
->
setByteRange
(
start
,
end
);
list
->
addSegment
(
seg
);
/* index must be before data, so data starts at index end */
seg
=
new
Segment
(
rep
);
seg
=
new
Segment
(
info
);
seg
->
setByteRange
(
end
+
1
,
0
);
}
else
{
seg
=
new
Segment
(
rep
);
seg
=
new
Segment
(
info
);
}
list
->
addSegment
(
seg
);
rep
->
setSegmentList
(
list
);
info
->
setSegmentList
(
list
);
std
::
vector
<
Node
*>
initSeg
=
DOMHelper
::
getElementByTagName
(
segmentBase
.
front
()
,
"Initialization"
,
false
);
std
::
vector
<
Node
*>
initSeg
=
DOMHelper
::
getElementByTagName
(
segmentBase
Node
,
"Initialization"
,
false
);
if
(
!
initSeg
.
empty
())
{
SegmentBase
*
base
=
new
SegmentBase
();
setInitSegment
(
segmentBase
.
front
()
,
base
);
rep
->
setSegmentBase
(
base
);
setInitSegment
(
segmentBase
Node
,
base
);
info
->
setSegmentBase
(
base
);
}
}
else
{
SegmentBase
*
base
=
new
SegmentBase
();
setInitSegment
(
segmentBase
.
front
()
,
base
);
rep
->
setSegmentBase
(
base
);
setInitSegment
(
segmentBase
Node
,
base
);
info
->
setSegmentBase
(
base
);
}
}
void
IsoffMainParser
::
setSegmentList
(
std
::
vector
<
Node
*>
&
segmentList
,
Representation
*
rep
)
size_t
IsoffMainParser
::
parseSegmentList
(
Node
*
segListNode
,
SegmentInformation
*
info
)
{
if
(
segmentList
.
size
()
>
0
)
size_t
total
=
0
;
if
(
segListNode
)
{
std
::
vector
<
Node
*>
segments
=
DOMHelper
::
getElementByTagName
(
segListNode
,
"SegmentURL"
,
false
);
SegmentList
*
list
=
new
SegmentList
();
this
->
setSegments
(
segmentList
.
at
(
0
),
list
);
rep
->
setSegmentList
(
list
);
}
if
(
!
segments
.
empty
()
&&
(
list
=
new
(
std
::
nothrow
)
SegmentList
()))
{
std
::
vector
<
Node
*>::
const_iterator
it
;
for
(
it
=
segments
.
begin
();
it
!=
segments
.
end
();
it
++
)
{
Node
*
segmentURL
=
*
it
;
std
::
string
mediaUrl
=
segmentURL
->
getAttributeValue
(
"media"
);
if
(
mediaUrl
.
empty
())
continue
;
Segment
*
seg
=
new
(
std
::
nothrow
)
Segment
(
info
);
if
(
!
seg
)
continue
;
seg
->
setSourceUrl
(
segmentURL
->
getAttributeValue
(
"media"
));
if
(
segmentURL
->
hasAttribute
(
"mediaRange"
))
{
std
::
string
range
=
segmentURL
->
getAttributeValue
(
"mediaRange"
);
size_t
pos
=
range
.
find
(
"-"
);
seg
->
setByteRange
(
atoi
(
range
.
substr
(
0
,
pos
).
c_str
()),
atoi
(
range
.
substr
(
pos
+
1
,
range
.
size
()).
c_str
()));
}
list
->
addSegment
(
seg
);
total
++
;
}
info
->
setSegmentList
(
list
);
}
}
return
total
;
}
void
IsoffMainParser
::
setInitSegment
(
dash
::
xml
::
Node
*
segBaseNode
,
SegmentBase
*
base
)
{
std
::
vector
<
Node
*>
initSeg
=
DOMHelper
::
getElementByTagName
(
segBaseNode
,
"Initialisation"
,
false
);
...
...
@@ -263,25 +321,7 @@ void IsoffMainParser::setInitSegment (dash::xml::Node *segBaseNode, Segme
base
->
addInitSegment
(
seg
);
}
}
void
IsoffMainParser
::
setSegments
(
dash
::
xml
::
Node
*
segListNode
,
SegmentList
*
list
)
{
std
::
vector
<
Node
*>
segments
=
DOMHelper
::
getElementByTagName
(
segListNode
,
"SegmentURL"
,
false
);
for
(
size_t
i
=
0
;
i
<
segments
.
size
();
i
++
)
{
Segment
*
seg
=
new
Segment
(
this
->
currentRepresentation
);
seg
->
setSourceUrl
(
segments
.
at
(
i
)
->
getAttributeValue
(
"media"
));
if
(
segments
.
at
(
i
)
->
hasAttribute
(
"mediaRange"
))
{
std
::
string
range
=
segments
.
at
(
i
)
->
getAttributeValue
(
"mediaRange"
);
size_t
pos
=
range
.
find
(
"-"
);
seg
->
setByteRange
(
atoi
(
range
.
substr
(
0
,
pos
).
c_str
()),
atoi
(
range
.
substr
(
pos
+
1
,
range
.
size
()).
c_str
()));
}
list
->
addSegment
(
seg
);
}
}
void
IsoffMainParser
::
print
()
{
if
(
mpd
)
...
...
modules/stream_filter/dash/mpd/IsoffMainParser.h
View file @
697f59f9
...
...
@@ -53,11 +53,12 @@ namespace dash
void
setMPDAttributes
();
void
setAdaptationSets
(
dash
::
xml
::
Node
*
periodNode
,
Period
*
period
);
void
setRepresentations
(
dash
::
xml
::
Node
*
adaptationSetNode
,
AdaptationSet
*
adaptationSet
);
void
setSegmentBase
(
std
::
vector
<
xml
::
Node
*>
&
,
Representation
*
rep
);
void
setSegmentList
(
std
::
vector
<
xml
::
Node
*>
&
,
Representation
*
rep
);
void
setInitSegment
(
dash
::
xml
::
Node
*
segBaseNode
,
SegmentBase
*
base
);
void
setSegments
(
dash
::
xml
::
Node
*
segListNode
,
SegmentList
*
list
);
void
parseTemplate
(
dash
::
xml
::
Node
*
templateNode
,
AdaptationSet
*
);
void
parsePeriods
(
dash
::
xml
::
Node
*
);
size_t
parseSegmentInformation
(
dash
::
xml
::
Node
*
,
SegmentInformation
*
);
void
parseSegmentBase
(
dash
::
xml
::
Node
*
,
SegmentInformation
*
);
size_t
parseSegmentList
(
dash
::
xml
::
Node
*
,
SegmentInformation
*
);
size_t
parseSegmentTemplate
(
dash
::
xml
::
Node
*
,
SegmentInformation
*
);
};
}
}
...
...
modules/stream_filter/dash/mpd/Period.cpp
View file @
697f59f9
...
...
@@ -35,7 +35,7 @@
using
namespace
dash
::
mpd
;
Period
::
Period
(
MPD
*
mpd
)
:
ICanonicalUrl
(
mpd
)
SegmentInformation
(
mpd
)
{
}
...
...
modules/stream_filter/dash/mpd/Period.h
View file @
697f59f9
...
...
@@ -29,6 +29,7 @@
#include "mpd/AdaptationSet.h"
#include "mpd/ICanonicalUrl.hpp"
#include "mpd/SegmentInformation.hpp"
#include "Streams.hpp"
namespace
dash
...
...
@@ -36,7 +37,8 @@ namespace dash
namespace
mpd
{
class
MPD
;
class
Period
:
public
ICanonicalUrl
class
Period
:
public
SegmentInformation
{
public:
Period
(
MPD
*
);
...
...
modules/stream_filter/dash/mpd/Representation.cpp
View file @
697f59f9
...
...
@@ -35,15 +35,12 @@
using
namespace
dash
::
mpd
;
Representation
::
Representation
(
AdaptationSet
*
set
,
MPD
*
mpd_
)
:
ICanonicalUrl
(
set
),
SegmentInformation
(
set
),
mpd
(
mpd_
),
adaptationSet
(
set
),
bandwidth
(
0
),
qualityRanking
(
-
1
),
segmentInfo
(
NULL
),
trickModeType
(
NULL
),
segmentBase
(
NULL
),
segmentList
(
NULL
),
baseUrl
(
NULL
),
width
(
0
),
height
(
0
)
...
...
@@ -52,10 +49,7 @@ Representation::Representation ( AdaptationSet *set, MPD *mpd_ ) :
Representation
::~
Representation
()
{
delete
(
this
->
segmentInfo
);
delete
(
this
->
trickModeType
);
delete
segmentBase
;
delete
segmentList
;
delete
baseUrl
;
}
...
...
@@ -80,10 +74,6 @@ void Representation::setBandwidth( uint64_t bandwidth )