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
ec6604b4
authored
Jun 26, 2019
by
sr1990
Committed by
sanil
Jun 26, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
[Patch V4] Support signalling of last segment number via supplemental descriptor in mpd.
parent
5f6a7fc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
74 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 @
ec6604b4
...
...
@@ -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
,
null
);
segmentBase
=
parseSegmentTemplate
(
xpp
,
null
,
null
);
}
else
{
maybeSkipTag
(
xpp
);
}
...
...
@@ -323,8 +323,8 @@ public class DashManifestParser extends DefaultHandler
language
,
roleDescriptors
,
accessibilityDescriptors
,
s
egmentBase
,
s
upplementalProperties
);
s
upplementalProperties
,
s
egmentBase
);
contentType
=
checkContentTypeConsistency
(
contentType
,
getContentType
(
representationInfo
.
format
));
representationInfos
.
add
(
representationInfo
);
...
...
@@ -334,7 +334,7 @@ public class DashManifestParser extends DefaultHandler
segmentBase
=
parseSegmentList
(
xpp
,
(
SegmentList
)
segmentBase
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SegmentTemplate"
))
{
segmentBase
=
parseSegmentTemplate
(
xpp
,
(
SegmentTemplate
)
segmentBase
,
supplementalProperties
,
null
);
supplementalProperties
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"InbandEventStream"
))
{
inbandEventStreams
.
add
(
parseDescriptor
(
xpp
,
"InbandEventStream"
));
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
))
{
...
...
@@ -487,8 +487,8 @@ public class DashManifestParser extends DefaultHandler
String
adaptationSetLanguage
,
List
<
Descriptor
>
adaptationSetRoleDescriptors
,
List
<
Descriptor
>
adaptationSetAccessibilityDescriptors
,
SegmentBase
segmentBase
,
ArrayList
<
Descriptor
>
adaptationSetSupplementalProperties
)
List
<
Descriptor
>
adaptationSetSupplementalProperties
,
SegmentBase
segmentBase
)
throws
XmlPullParserException
,
IOException
{
String
id
=
xpp
.
getAttributeValue
(
null
,
"id"
);
int
bandwidth
=
parseInt
(
xpp
,
"bandwidth"
,
Format
.
NO_VALUE
);
...
...
@@ -521,7 +521,7 @@ public class DashManifestParser extends DefaultHandler
segmentBase
=
parseSegmentList
(
xpp
,
(
SegmentList
)
segmentBase
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"SegmentTemplate"
))
{
segmentBase
=
parseSegmentTemplate
(
xpp
,
(
SegmentTemplate
)
segmentBase
,
adaptationSetSupplementalProperties
,
supplementalProperties
);
adaptationSetSupplementalProperties
);
}
else
if
(
XmlPullParserUtil
.
isStartTag
(
xpp
,
"ContentProtection"
))
{
Pair
<
String
,
SchemeData
>
contentProtection
=
parseContentProtection
(
xpp
);
if
(
contentProtection
.
first
!=
null
)
{
...
...
@@ -761,8 +761,7 @@ public class DashManifestParser extends DefaultHandler
}
protected
SegmentTemplate
parseSegmentTemplate
(
XmlPullParser
xpp
,
SegmentTemplate
parent
,
ArrayList
<
Descriptor
>
adaptationSetSupplementalProperties
,
ArrayList
<
Descriptor
>
representationSupplementalProperties
)
List
<
Descriptor
>
adaptationSetSupplementalProperties
)
throws
XmlPullParserException
,
IOException
{
long
timescale
=
parseLong
(
xpp
,
"timescale"
,
parent
!=
null
?
parent
.
timescale
:
1
);
long
presentationTimeOffset
=
parseLong
(
xpp
,
"presentationTimeOffset"
,
...
...
@@ -793,20 +792,27 @@ public class DashManifestParser extends DefaultHandler
timeline
=
timeline
!=
null
?
timeline
:
parent
.
segmentTimeline
;
}
long
endNumber
=
C
.
INDEX_UNSET
;
if
(
adaptationSetSupplementalProperties
!=
null
)
{
endNumber
=
parseLastSegmentNumberSupplementalProperty
(
adaptationSetSupplementalProperties
);
}
return
buildSegmentTemplate
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
duration
,
timeline
,
initializationTemplate
,
mediaTemplate
,
adaptationSetSupplementalProperties
,
representationSupplementalProperties
);
endNumber
);
}
protected
Stri
ng
parseLastSegmentNumberSupplementalProperty
protected
lo
ng
parseLastSegmentNumberSupplementalProperty
(
List
<
Descriptor
>
supplementalProperties
){
for
(
Descriptor
descriptor
:
supplementalProperties
)
{
if
(
descriptor
.
schemeIdUri
.
equalsIgnoreCase
(
"http://dashif.org/guidelines/last-segment-number"
))
{
return
descriptor
.
value
;
if
(
"http://dashif.org/guidelines/last-segment-number"
.
equalsIgnoreCase
(
descriptor
.
schemeIdUri
))
{
return
Long
.
parseLong
(
descriptor
.
value
)
;
}
}
return
null
;
return
C
.
INDEX_UNSET
;
}
protected
SegmentTemplate
buildSegmentTemplate
(
...
...
@@ -817,29 +823,11 @@ public class DashManifestParser extends DefaultHandler
long
duration
,
List
<
SegmentTimelineElement
>
timeline
,
UrlTemplate
initializationTemplate
,
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
);
}
}
UrlTemplate
mediaTemplate
,
long
endNumber
)
{
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
);
}
if
(
endNumber
!=
C
.
INDEX_UNSET
)
{
return
new
SegmentTemplate
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
endNumber
,
duration
,
timeline
,
initializationTemplate
,
mediaTemplate
);
}
return
new
SegmentTemplate
(
initialization
,
timescale
,
presentationTimeOffset
,
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SegmentBase.java
View file @
ec6604b4
...
...
@@ -102,7 +102,6 @@ public abstract class SegmentBase {
/* package */
final
long
startNumber
;
/* package */
final
long
duration
;
/* package */
final
List
<
SegmentTimelineElement
>
segmentTimeline
;
/* package */
final
int
endNumber
;
/**
* @param initialization A {@link RangedUri} corresponding to initialization data, if such data
...
...
@@ -129,38 +128,6 @@ public abstract class SegmentBase {
this
.
startNumber
=
startNumber
;
this
.
duration
=
duration
;
this
.
segmentTimeline
=
segmentTimeline
;
this
.
endNumber
=
C
.
INDEX_UNSET
;
}
/**
* @param initialization A {@link RangedUri} corresponding to initialization data, if such data
* exists.
* @param timescale The timescale in units per second.
* @param presentationTimeOffset The presentation time offset. The value in seconds is the
* 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"
* @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.
* @param segmentTimeline A segment timeline corresponding to the segments. If null, then
* segments are assumed to be of fixed duration as specified by the {@code duration}
* parameter.
*/
public
MultiSegmentBase
(
RangedUri
initialization
,
long
timescale
,
long
presentationTimeOffset
,
long
startNumber
,
int
endNumber
,
long
duration
,
List
<
SegmentTimelineElement
>
segmentTimeline
)
{
super
(
initialization
,
timescale
,
presentationTimeOffset
);
this
.
startNumber
=
startNumber
;
this
.
duration
=
duration
;
this
.
segmentTimeline
=
segmentTimeline
;
this
.
endNumber
=
endNumber
;
}
/** @see DashSegmentIndex#getSegmentNum(long, long) */
...
...
@@ -310,6 +277,7 @@ public abstract class SegmentBase {
/* package */
final
UrlTemplate
initializationTemplate
;
/* package */
final
UrlTemplate
mediaTemplate
;
/* package */
final
long
endNumber
;
/**
* @param initialization A {@link RangedUri} corresponding to initialization data, if such data
...
...
@@ -343,6 +311,7 @@ public abstract class SegmentBase {
duration
,
segmentTimeline
);
this
.
initializationTemplate
=
initializationTemplate
;
this
.
mediaTemplate
=
mediaTemplate
;
this
.
endNumber
=
C
.
INDEX_UNSET
;
}
/**
...
...
@@ -371,15 +340,16 @@ public abstract class SegmentBase {
long
timescale
,
long
presentationTimeOffset
,
long
startNumber
,
int
endNumber
,
long
endNumber
,
long
duration
,
List
<
SegmentTimelineElement
>
segmentTimeline
,
UrlTemplate
initializationTemplate
,
UrlTemplate
mediaTemplate
)
{
super
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
endNumber
,
duration
,
segmentTimeline
);
super
(
initialization
,
timescale
,
presentationTimeOffset
,
startNumber
,
duration
,
segmentTimeline
);
this
.
initializationTemplate
=
initializationTemplate
;
this
.
mediaTemplate
=
mediaTemplate
;
this
.
endNumber
=
endNumber
;
}
@Override
...
...
@@ -411,7 +381,7 @@ public abstract class SegmentBase {
if
(
segmentTimeline
!=
null
)
{
return
segmentTimeline
.
size
();
}
else
if
(
endNumber
!=
C
.
INDEX_UNSET
)
{
return
endNumber
-
(
int
)
startNumber
+
1
;
return
(
int
)
(
endNumber
-
startNumber
+
1
)
;
}
else
if
(
periodDurationUs
!=
C
.
TIME_UNSET
)
{
long
durationUs
=
(
duration
*
C
.
MICROS_PER_SECOND
)
/
timescale
;
return
(
int
)
Util
.
ceilDivide
(
periodDurationUs
,
durationUs
);
...
...
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