Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5f6a7fc7
authored
Jun 22, 2019
by
sr1990
Committed by
sanil
Jun 22, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
[Patch V3] Support signalling of last segment number via supplemental descriptor in mpd.
parent
5b02f92d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
21 deletions
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SegmentBase.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
View file @
5f6a7fc7
...
...
@@ -242,7 +242,7 @@ public class DashManifestParser extends DefaultHandler
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SegmentList"
))
{
segmentBase
=
parseSegmentList
(
xpp
,
null
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SegmentTemplate"
))
{
segmentBase
=
parseSegmentTemplate
(
xpp
,
null
,
null
);
segmentBase
=
parseSegmentTemplate
(
xpp
,
null
,
null
,
null
);
}
else
{
maybeSkipTag
(
xpp
);
}
...
...
@@ -333,7 +333,8 @@ public class DashManifestParser extends DefaultHandler
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SegmentList"
))
{
segmentBase
=
parseSegmentList
(
xpp
,
(
SegmentList
)
segmentBase
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SegmentTemplate"
))
{
segmentBase
=
parseSegmentTemplate
(
xpp
,
(
SegmentTemplate
)
segmentBase
,
supplementalProperties
);
segmentBase
=
parseSegmentTemplate
(
xpp
,
(
SegmentTemplate
)
segmentBase
,
supplementalProperties
,
null
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"InbandEventStream"
))
{
inbandEventStreams
.
add
(
parseDescriptor
(
xpp
,
"InbandEventStream"
));
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
))
{
...
...
@@ -487,7 +488,7 @@ public class DashManifestParser extends DefaultHandler
List
<
Descriptor
>
adaptationSetRoleDescriptors
,
List
<
Descriptor
>
adaptationSetAccessibilityDescriptors
,
SegmentBase
segmentBase
,
ArrayList
<
Descriptor
>
paren
tSupplementalProperties
)
ArrayList
<
Descriptor
>
adaptationSe
tSupplementalProperties
)
throws
XmlPullParserException
,
IOException
{
String
id
=
xpp
.
getAttributeValue
(
null
,
"id"
);
int
bandwidth
=
parseInt
(
xpp
,
"bandwidth"
,
Format
.
NO_VALUE
);
...
...
@@ -520,7 +521,7 @@ public class DashManifestParser extends DefaultHandler
segmentBase
=
parseSegmentList
(
xpp
,
(
SegmentList
)
segmentBase
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SegmentTemplate"
))
{
segmentBase
=
parseSegmentTemplate
(
xpp
,
(
SegmentTemplate
)
segmentBase
,
parentS
upplementalProperties
);
adaptationSetSupplementalProperties
,
s
upplementalProperties
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"ContentProtection"
))
{
Pair
<
String
,
SchemeData
>
contentProtection
=
parseContentProtection
(
xpp
);
if
(
contentProtection
.
first
!=
null
)
{
...
...
@@ -760,7 +761,8 @@ public class DashManifestParser extends DefaultHandler
}
protected
SegmentTemplate
parseSegmentTemplate
(
XmlPullParser
xpp
,
SegmentTemplate
parent
,
ArrayList
<
Descriptor
>
parentSupplementalProperties
)
ArrayList
<
Descriptor
>
adaptationSetSupplementalProperties
,
ArrayList
<
Descriptor
>
representationSupplementalProperties
)
throws
XmlPullParserException
,
IOException
{
long
timescale
=
parseLong
(
xpp
,
"timescale"
,
parent
!=
null
?
parent
.
timescale
:
1
);
long
presentationTimeOffset
=
parseLong
(
xpp
,
"presentationTimeOffset"
,
...
...
@@ -793,7 +795,18 @@ public class DashManifestParser extends DefaultHandler
return
buildSegmentTemplate
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
duration
,
timeline
,
initializationTemplate
,
mediaTemplate
,
parentSupplementalProperties
);
adaptationSetSupplementalProperties
,
representationSupplementalProperties
);
}
protected
String
parseLastSegmentNumberSupplementalProperty
(
List
<
Descriptor
>
supplementalProperties
){
for
(
Descriptor
descriptor
:
supplementalProperties
)
{
if
(
descriptor
.
schemeIdUri
.
equalsIgnoreCase
(
"http://dashif.org/guidelines/last-segment-number"
))
{
return
descriptor
.
value
;
}
}
return
null
;
}
protected
SegmentTemplate
buildSegmentTemplate
(
...
...
@@ -804,16 +817,28 @@ public class DashManifestParser extends DefaultHandler
long
duration
,
List
<
SegmentTimelineElement
>
timeline
,
UrlTemplate
initializationTemplate
,
UrlTemplate
mediaTemplate
,
ArrayList
<
Descriptor
>
supplementalProperties
)
{
if
(
supplementalProperties
!=
null
)
{
for
(
Descriptor
descriptor
:
supplementalProperties
)
{
if
(
descriptor
.
schemeIdUri
.
equalsIgnoreCase
(
"http://dashif.org/guidelines/last-segment-number"
))
{
return
new
SegmentTemplate
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
Integer
.
valueOf
(
descriptor
.
value
),
duration
,
timeline
,
initializationTemplate
,
mediaTemplate
);
}
UrlTemplate
mediaTemplate
,
ArrayList
<
Descriptor
>
adaptationSetSupplementalProperties
,
ArrayList
<
Descriptor
>
representationSupplementalProperties
)
{
if
(
representationSupplementalProperties
!=
null
)
{
if
(
parseLastSegmentNumberSupplementalProperty
(
representationSupplementalProperties
)
!=
null
)
{
String
lastSegment
=
parseLastSegmentNumberSupplementalProperty
(
representationSupplementalProperties
);
return
new
SegmentTemplate
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
Integer
.
valueOf
(
lastSegment
),
duration
,
timeline
,
initializationTemplate
,
mediaTemplate
);
}
}
if
(
adaptationSetSupplementalProperties
!=
null
)
{
if
(
parseLastSegmentNumberSupplementalProperty
(
adaptationSetSupplementalProperties
)
!=
null
)
{
String
lastSegment
=
parseLastSegmentNumberSupplementalProperty
(
adaptationSetSupplementalProperties
);
return
new
SegmentTemplate
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
Integer
.
valueOf
(
lastSegment
),
duration
,
timeline
,
initializationTemplate
,
mediaTemplate
);
}
}
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SegmentBase.java
View file @
5f6a7fc7
...
...
@@ -140,7 +140,7 @@ public abstract class SegmentBase {
* division of this value and {@code timescale}.
* @param startNumber The sequence number of the first segment.
* @param endNumber The sequence number of the last segment specified by SupplementalProperty
*
schemeIdUri="http://dashif.org/guidelines/last-segment-number"
* schemeIdUri="http://dashif.org/guidelines/last-segment-number"
* @param duration The duration of each segment in the case of fixed duration segments. The
* value in seconds is the division of this value and {@code timescale}. If {@code
* segmentTimeline} is non-null then this parameter is ignored.
...
...
@@ -408,10 +408,10 @@ public abstract class SegmentBase {
@Override
public
int
getSegmentCount
(
long
periodDurationUs
)
{
if
(
endNumber
!=
C
.
INDEX_UNSET
)
{
return
endNumber
;
}
else
if
(
segmentTimeline
!=
null
)
{
if
(
segmentTimeline
!=
null
)
{
return
segmentTimeline
.
size
();
}
else
if
(
endNumber
!=
C
.
INDEX_UNSET
)
{
return
endNumber
-
(
int
)
startNumber
+
1
;
}
else
if
(
periodDurationUs
!=
C
.
TIME_UNSET
)
{
long
durationUs
=
(
duration
*
C
.
MICROS_PER_SECOND
)
/
timescale
;
return
(
int
)
Util
.
ceilDivide
(
periodDurationUs
,
durationUs
);
...
...
@@ -419,7 +419,6 @@ public abstract class SegmentBase {
return
DashSegmentIndex
.
INDEX_UNBOUNDED
;
}
}
}
/**
...
...
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