From c01c2c34f731cf96baf1022e6cdbb68a9f0aca40 Mon Sep 17 00:00:00 2001 From: olly Date: Tue, 24 Jan 2017 04:41:43 -0800 Subject: [PATCH] Store full accessibility descriptors in parsed DASH manifest Issue: #2362 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145402640 --- .../drm/OfflineLicenseHelperTest.java | 2 +- .../dash/manifest/DashManifestParserTest.java | 71 ++++++--- .../source/dash/manifest/AdaptationSet.java | 12 +- .../dash/manifest/DashManifestParser.java | 149 ++++++++++-------- .../source/dash/manifest/Representation.java | 28 ++-- ...dEventStream.java => SchemeValuePair.java} | 8 +- 6 files changed, 164 insertions(+), 106 deletions(-) rename library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/{InbandEventStream.java => SchemeValuePair.java} (87%) diff --git a/library/src/androidTest/java/com/google/android/exoplayer2/drm/OfflineLicenseHelperTest.java b/library/src/androidTest/java/com/google/android/exoplayer2/drm/OfflineLicenseHelperTest.java index c7ebb22d9a..9eed8dfd3a 100644 --- a/library/src/androidTest/java/com/google/android/exoplayer2/drm/OfflineLicenseHelperTest.java +++ b/library/src/androidTest/java/com/google/android/exoplayer2/drm/OfflineLicenseHelperTest.java @@ -213,7 +213,7 @@ public class OfflineLicenseHelperTest extends InstrumentationTestCase { } private static AdaptationSet newAdaptationSets(Representation... representations) { - return new AdaptationSet(0, C.TRACK_TYPE_VIDEO, Arrays.asList(representations)); + return new AdaptationSet(0, C.TRACK_TYPE_VIDEO, Arrays.asList(representations), null); } private static Representation newRepresentations(DrmInitData drmInitData) { diff --git a/library/src/androidTest/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParserTest.java b/library/src/androidTest/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParserTest.java index 944781b890..4de0ae4081 100644 --- a/library/src/androidTest/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParserTest.java +++ b/library/src/androidTest/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParserTest.java @@ -20,6 +20,8 @@ import android.test.InstrumentationTestCase; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.testutil.TestUtil; import java.io.IOException; +import java.util.Collections; +import java.util.List; /** * Unit tests for {@link DashManifestParser}. @@ -70,34 +72,57 @@ public class DashManifestParserTest extends InstrumentationTestCase { } public void testParseCea608AccessibilityChannel() { - assertEquals(1, DashManifestParser.parseCea608AccessibilityChannel("CC1=eng")); - assertEquals(2, DashManifestParser.parseCea608AccessibilityChannel("CC2=eng")); - assertEquals(3, DashManifestParser.parseCea608AccessibilityChannel("CC3=eng")); - assertEquals(4, DashManifestParser.parseCea608AccessibilityChannel("CC4=eng")); + assertEquals(1, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors("CC1=eng"))); + assertEquals(2, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors("CC2=eng"))); + assertEquals(3, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors("CC3=eng"))); + assertEquals(4, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors("CC4=eng"))); - assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel(null)); - assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel("")); - assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel("CC0=eng")); - assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel("CC5=eng")); - assertEquals(Format.NO_VALUE, - DashManifestParser.parseCea608AccessibilityChannel("Wrong format")); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors(null))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors(""))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors("CC0=eng"))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors("CC5=eng"))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea608AccessibilityChannel( + buildCea608AccessibilityDescriptors("Wrong format"))); } public void testParseCea708AccessibilityChannel() { - assertEquals(1, DashManifestParser.parseCea708AccessibilityChannel("1=lang:eng")); - assertEquals(2, DashManifestParser.parseCea708AccessibilityChannel("2=lang:eng")); - assertEquals(3, DashManifestParser.parseCea708AccessibilityChannel("3=lang:eng")); - assertEquals(62, DashManifestParser.parseCea708AccessibilityChannel("62=lang:eng")); - assertEquals(63, DashManifestParser.parseCea708AccessibilityChannel("63=lang:eng")); + assertEquals(1, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("1=lang:eng"))); + assertEquals(2, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("2=lang:eng"))); + assertEquals(3, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("3=lang:eng"))); + assertEquals(62, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("62=lang:eng"))); + assertEquals(63, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("63=lang:eng"))); - assertEquals(Format.NO_VALUE, DashManifestParser.parseCea708AccessibilityChannel(null)); - assertEquals(Format.NO_VALUE, DashManifestParser.parseCea708AccessibilityChannel("")); - assertEquals(Format.NO_VALUE, - DashManifestParser.parseCea708AccessibilityChannel("0=lang:eng")); - assertEquals(Format.NO_VALUE, - DashManifestParser.parseCea708AccessibilityChannel("64=lang:eng")); - assertEquals(Format.NO_VALUE, - DashManifestParser.parseCea708AccessibilityChannel("Wrong format")); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors(null))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors(""))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("0=lang:eng"))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("64=lang:eng"))); + assertEquals(Format.NO_VALUE, DashManifestParser.parseCea708AccessibilityChannel( + buildCea708AccessibilityDescriptors("Wrong format"))); + } + + private static List buildCea608AccessibilityDescriptors(String value) { + return Collections.singletonList(new SchemeValuePair("urn:scte:dash:cc:cea-608:2015", value)); + } + + private static List buildCea708AccessibilityDescriptors(String value) { + return Collections.singletonList(new SchemeValuePair("urn:scte:dash:cc:cea-708:2015", value)); } } diff --git a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/AdaptationSet.java b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/AdaptationSet.java index c4a4a4446b..097676b89f 100644 --- a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/AdaptationSet.java +++ b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/AdaptationSet.java @@ -45,17 +45,27 @@ public class AdaptationSet { */ public final List representations; + /** + * The accessibility descriptors in the adaptation set. + */ + public final List accessibilityDescriptors; + /** * @param id A non-negative identifier for the adaptation set that's unique in the scope of its * containing period, or {@link #ID_UNSET} if not specified. * @param type The type of the adaptation set. One of the {@link com.google.android.exoplayer2.C} * {@code TRACK_TYPE_*} constants. * @param representations The {@link Representation}s in the adaptation set. + * @param accessibilityDescriptors The accessibility descriptors in the adaptation set. */ - public AdaptationSet(int id, int type, List representations) { + public AdaptationSet(int id, int type, List representations, + List accessibilityDescriptors) { this.id = id; this.type = type; this.representations = Collections.unmodifiableList(representations); + this.accessibilityDescriptors = accessibilityDescriptors == null + ? Collections.emptyList() + : Collections.unmodifiableList(accessibilityDescriptors); } } diff --git a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java index a9dc0a8665..1917399282 100644 --- a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java +++ b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java @@ -238,9 +238,9 @@ public class DashManifestParser extends DefaultHandler int audioChannels = Format.NO_VALUE; int audioSamplingRate = parseInt(xpp, "audioSamplingRate", Format.NO_VALUE); String language = xpp.getAttributeValue(null, "lang"); - int accessibilityChannel = Format.NO_VALUE; ArrayList drmSchemeDatas = new ArrayList<>(); - ArrayList inbandEventStreams = new ArrayList<>(); + ArrayList inbandEventStreams = new ArrayList<>(); + ArrayList accessibilityDescriptors = new ArrayList<>(); List representationInfos = new ArrayList<>(); @C.SelectionFlags int selectionFlags = 0; @@ -265,11 +265,11 @@ public class DashManifestParser extends DefaultHandler } else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) { audioChannels = parseAudioChannelConfiguration(xpp); } else if (XmlPullParserUtil.isStartTag(xpp, "Accessibility")) { - accessibilityChannel = parseAccessibilityValue(xpp); + accessibilityDescriptors.add(parseAccessibility(xpp)); } else if (XmlPullParserUtil.isStartTag(xpp, "Representation")) { RepresentationInfo representationInfo = parseRepresentation(xpp, baseUrl, mimeType, codecs, width, height, frameRate, audioChannels, audioSamplingRate, language, - accessibilityChannel, selectionFlags, segmentBase); + selectionFlags, accessibilityDescriptors, segmentBase); contentType = checkContentTypeConsistency(contentType, getContentType(representationInfo.format)); representationInfos.add(representationInfo); @@ -293,12 +293,12 @@ public class DashManifestParser extends DefaultHandler drmSchemeDatas, inbandEventStreams)); } - return buildAdaptationSet(id, contentType, representations); + return buildAdaptationSet(id, contentType, representations, accessibilityDescriptors); } protected AdaptationSet buildAdaptationSet(int id, int contentType, - List representations) { - return new AdaptationSet(id, contentType, representations); + List representations, List accessibilityDescriptors) { + return new AdaptationSet(id, contentType, representations, accessibilityDescriptors); } protected int parseContentType(XmlPullParser xpp) { @@ -367,16 +367,24 @@ public class DashManifestParser extends DefaultHandler * @param xpp The parser from which to read. * @throws XmlPullParserException If an error occurs parsing the element. * @throws IOException If an error occurs reading the element. - * @return {@link InbandEventStream} parsed from the element. + * @return A {@link SchemeValuePair} parsed from the element. */ - protected InbandEventStream parseInbandEventStream(XmlPullParser xpp) + protected SchemeValuePair parseInbandEventStream(XmlPullParser xpp) throws XmlPullParserException, IOException { - String schemeIdUri = parseString(xpp, "schemeIdUri", null); - String value = parseString(xpp, "value", null); - do { - xpp.next(); - } while (!XmlPullParserUtil.isEndTag(xpp, "InbandEventStream")); - return new InbandEventStream(schemeIdUri, value); + return parseSchemeValuePair(xpp, "InbandEventStream"); + } + + /** + * Parses an Accessibility element. + * + * @param xpp The parser from which to read. + * @throws XmlPullParserException If an error occurs parsing the element. + * @throws IOException If an error occurs reading the element. + * @return A {@link SchemeValuePair} parsed from the element. + */ + protected SchemeValuePair parseAccessibility(XmlPullParser xpp) + throws XmlPullParserException, IOException { + return parseSchemeValuePair(xpp, "Accessibility"); } /** @@ -415,8 +423,9 @@ public class DashManifestParser extends DefaultHandler String adaptationSetMimeType, String adaptationSetCodecs, int adaptationSetWidth, int adaptationSetHeight, float adaptationSetFrameRate, int adaptationSetAudioChannels, int adaptationSetAudioSamplingRate, String adaptationSetLanguage, - int adaptationSetAccessibilityChannel, @C.SelectionFlags int adaptationSetSelectionFlags, - SegmentBase segmentBase) throws XmlPullParserException, IOException { + @C.SelectionFlags int adaptationSetSelectionFlags, + List adaptationSetAccessibilityDescriptors, SegmentBase segmentBase) + throws XmlPullParserException, IOException { String id = xpp.getAttributeValue(null, "id"); int bandwidth = parseInt(xpp, "bandwidth", Format.NO_VALUE); @@ -428,7 +437,7 @@ public class DashManifestParser extends DefaultHandler int audioChannels = adaptationSetAudioChannels; int audioSamplingRate = parseInt(xpp, "audioSamplingRate", adaptationSetAudioSamplingRate); ArrayList drmSchemeDatas = new ArrayList<>(); - ArrayList inbandEventStreams = new ArrayList<>(); + ArrayList inbandEventStreams = new ArrayList<>(); boolean seenFirstBaseUrl = false; do { @@ -457,8 +466,8 @@ public class DashManifestParser extends DefaultHandler } while (!XmlPullParserUtil.isEndTag(xpp, "Representation")); Format format = buildFormat(id, mimeType, width, height, frameRate, audioChannels, - audioSamplingRate, bandwidth, adaptationSetLanguage, adaptationSetAccessibilityChannel, - adaptationSetSelectionFlags, codecs); + audioSamplingRate, bandwidth, adaptationSetLanguage, adaptationSetSelectionFlags, + adaptationSetAccessibilityDescriptors, codecs); segmentBase = segmentBase != null ? segmentBase : new SingleSegmentBase(); return new RepresentationInfo(format, baseUrl, segmentBase, drmSchemeDatas, inbandEventStreams); @@ -466,7 +475,8 @@ public class DashManifestParser extends DefaultHandler protected Format buildFormat(String id, String containerMimeType, int width, int height, float frameRate, int audioChannels, int audioSamplingRate, int bitrate, String language, - int accessiblityChannel, @C.SelectionFlags int selectionFlags, String codecs) { + @C.SelectionFlags int selectionFlags, List accessibilityDescriptors, + String codecs) { String sampleMimeType = getSampleMimeType(containerMimeType, codecs); if (sampleMimeType != null) { if (MimeTypes.isVideo(sampleMimeType)) { @@ -476,8 +486,16 @@ public class DashManifestParser extends DefaultHandler return Format.createAudioContainerFormat(id, containerMimeType, sampleMimeType, codecs, bitrate, audioChannels, audioSamplingRate, null, selectionFlags, language); } else if (mimeTypeIsRawText(sampleMimeType)) { + int accessibilityChannel; + if (MimeTypes.APPLICATION_CEA608.equals(sampleMimeType)) { + accessibilityChannel = parseCea608AccessibilityChannel(accessibilityDescriptors); + } else if (MimeTypes.APPLICATION_CEA708.equals(sampleMimeType)) { + accessibilityChannel = parseCea708AccessibilityChannel(accessibilityDescriptors); + } else { + accessibilityChannel = Format.NO_VALUE; + } return Format.createTextContainerFormat(id, containerMimeType, sampleMimeType, codecs, - bitrate, selectionFlags, language, accessiblityChannel); + bitrate, selectionFlags, language, accessibilityChannel); } } return Format.createContainerFormat(id, containerMimeType, sampleMimeType, codecs, bitrate, @@ -486,14 +504,14 @@ public class DashManifestParser extends DefaultHandler protected Representation buildRepresentation(RepresentationInfo representationInfo, String contentId, ArrayList extraDrmSchemeDatas, - ArrayList extraInbandEventStreams) { + ArrayList extraInbandEventStreams) { Format format = representationInfo.format; ArrayList drmSchemeDatas = representationInfo.drmSchemeDatas; drmSchemeDatas.addAll(extraDrmSchemeDatas); if (!drmSchemeDatas.isEmpty()) { format = format.copyWithDrmInitData(new DrmInitData(drmSchemeDatas)); } - ArrayList inbandEventStremas = representationInfo.inbandEventStreams; + ArrayList inbandEventStremas = representationInfo.inbandEventStreams; inbandEventStremas.addAll(extraInbandEventStreams); return Representation.newInstance(contentId, Representation.REVISION_ID_DEFAULT, format, representationInfo.baseUrl, representationInfo.segmentBase, inbandEventStremas); @@ -785,52 +803,57 @@ public class DashManifestParser extends DefaultHandler } } - private static int parseAccessibilityValue(XmlPullParser xpp) - throws IOException, XmlPullParserException { + /** + * Parses a {@link SchemeValuePair} from an element. + * + * @param xpp The parser from which to read. + * @param tag The tag of the element being parsed. + * @throws XmlPullParserException If an error occurs parsing the element. + * @throws IOException If an error occurs reading the element. + * @return The parsed {@link SchemeValuePair}. + */ + protected static SchemeValuePair parseSchemeValuePair(XmlPullParser xpp, String tag) + throws XmlPullParserException, IOException { String schemeIdUri = parseString(xpp, "schemeIdUri", null); - String valueString = parseString(xpp, "value", null); - int accessibilityValue; - if (schemeIdUri == null || valueString == null) { - accessibilityValue = Format.NO_VALUE; - } else if ("urn:scte:dash:cc:cea-608:2015".equals(schemeIdUri)) { - accessibilityValue = parseCea608AccessibilityChannel(valueString); - } else if ("urn:scte:dash:cc:cea-708:2015".equals(schemeIdUri)) { - accessibilityValue = parseCea708AccessibilityChannel(valueString); - } else { - accessibilityValue = Format.NO_VALUE; - } + String value = parseString(xpp, "value", null); do { xpp.next(); - } while (!XmlPullParserUtil.isEndTag(xpp, "Accessibility")); - return accessibilityValue; + } while (!XmlPullParserUtil.isEndTag(xpp, tag)); + return new SchemeValuePair(schemeIdUri, value); } - static int parseCea608AccessibilityChannel(String accessibilityValueString) { - if (accessibilityValueString == null) { - return Format.NO_VALUE; - } - Matcher accessibilityValueMatcher = - CEA_608_ACCESSIBILITY_PATTERN.matcher(accessibilityValueString); - if (accessibilityValueMatcher.matches()) { - return Integer.parseInt(accessibilityValueMatcher.group(1)); - } else { - Log.w(TAG, "Unable to parse channel number from " + accessibilityValueString); - return Format.NO_VALUE; + protected static int parseCea608AccessibilityChannel( + List accessibilityDescriptors) { + for (int i = 0; i < accessibilityDescriptors.size(); i++) { + SchemeValuePair descriptor = accessibilityDescriptors.get(i); + if ("urn:scte:dash:cc:cea-608:2015".equals(descriptor.schemeIdUri) + && descriptor.value != null) { + Matcher accessibilityValueMatcher = CEA_608_ACCESSIBILITY_PATTERN.matcher(descriptor.value); + if (accessibilityValueMatcher.matches()) { + return Integer.parseInt(accessibilityValueMatcher.group(1)); + } else { + Log.w(TAG, "Unable to parse CEA-608 channel number from: " + descriptor.value); + } + } } + return Format.NO_VALUE; } - static int parseCea708AccessibilityChannel(String accessibilityValueString) { - if (accessibilityValueString == null) { - return Format.NO_VALUE; - } - Matcher accessibilityValueMatcher = - CEA_708_ACCESSIBILITY_PATTERN.matcher(accessibilityValueString); - if (accessibilityValueMatcher.matches()) { - return Integer.parseInt(accessibilityValueMatcher.group(1)); - } else { - Log.w(TAG, "Unable to parse service block number from " + accessibilityValueString); - return Format.NO_VALUE; + protected static int parseCea708AccessibilityChannel( + List accessibilityDescriptors) { + for (int i = 0; i < accessibilityDescriptors.size(); i++) { + SchemeValuePair descriptor = accessibilityDescriptors.get(i); + if ("urn:scte:dash:cc:cea-708:2015".equals(descriptor.schemeIdUri) + && descriptor.value != null) { + Matcher accessibilityValueMatcher = CEA_708_ACCESSIBILITY_PATTERN.matcher(descriptor.value); + if (accessibilityValueMatcher.matches()) { + return Integer.parseInt(accessibilityValueMatcher.group(1)); + } else { + Log.w(TAG, "Unable to parse CEA-708 service block number from: " + descriptor.value); + } + } } + return Format.NO_VALUE; } protected static float parseFrameRate(XmlPullParser xpp, float defaultValue) { @@ -897,10 +920,10 @@ public class DashManifestParser extends DefaultHandler public final String baseUrl; public final SegmentBase segmentBase; public final ArrayList drmSchemeDatas; - public final ArrayList inbandEventStreams; + public final ArrayList inbandEventStreams; public RepresentationInfo(Format format, String baseUrl, SegmentBase segmentBase, - ArrayList drmSchemeDatas, ArrayList inbandEventStreams) { + ArrayList drmSchemeDatas, ArrayList inbandEventStreams) { this.format = format; this.baseUrl = baseUrl; this.segmentBase = segmentBase; diff --git a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/Representation.java b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/Representation.java index cdf84f5f71..4146037e1c 100644 --- a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/Representation.java +++ b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/Representation.java @@ -63,9 +63,9 @@ public abstract class Representation { */ public final long presentationTimeOffsetUs; /** - * The {@link InbandEventStream}s in the representation. Never null, but may be empty. + * The in-band event streams in the representation. Never null, but may be empty. */ - public final List inbandEventStreams; + public final List inbandEventStreams; private final RangedUri initializationUri; @@ -92,11 +92,11 @@ public abstract class Representation { * @param format The format of the representation. * @param baseUrl The base URL. * @param segmentBase A segment base element for the representation. - * @param inbandEventStreams The {@link InbandEventStream}s in the representation. May be null. + * @param inbandEventStreams The in-band event streams in the representation. May be null. * @return The constructed instance. */ public static Representation newInstance(String contentId, long revisionId, Format format, - String baseUrl, SegmentBase segmentBase, List inbandEventStreams) { + String baseUrl, SegmentBase segmentBase, List inbandEventStreams) { return newInstance(contentId, revisionId, format, baseUrl, segmentBase, inbandEventStreams, null); } @@ -109,13 +109,13 @@ public abstract class Representation { * @param format The format of the representation. * @param baseUrl The base URL of the representation. * @param segmentBase A segment base element for the representation. - * @param inbandEventStreams The {@link InbandEventStream}s in the representation. May be null. + * @param inbandEventStreams The in-band event streams in the representation. May be null. * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null. This * parameter is ignored if {@code segmentBase} consists of multiple segments. * @return The constructed instance. */ public static Representation newInstance(String contentId, long revisionId, Format format, - String baseUrl, SegmentBase segmentBase, List inbandEventStreams, + String baseUrl, SegmentBase segmentBase, List inbandEventStreams, String customCacheKey) { if (segmentBase instanceof SingleSegmentBase) { return new SingleSegmentRepresentation(contentId, revisionId, format, baseUrl, @@ -130,13 +130,13 @@ public abstract class Representation { } private Representation(String contentId, long revisionId, Format format, String baseUrl, - SegmentBase segmentBase, List inbandEventStreams) { + SegmentBase segmentBase, List inbandEventStreams) { this.contentId = contentId; this.revisionId = revisionId; this.format = format; this.baseUrl = baseUrl; this.inbandEventStreams = inbandEventStreams == null - ? Collections.emptyList() + ? Collections.emptyList() : Collections.unmodifiableList(inbandEventStreams); initializationUri = segmentBase.getInitialization(this); presentationTimeOffsetUs = segmentBase.getPresentationTimeOffsetUs(); @@ -195,13 +195,13 @@ public abstract class Representation { * @param initializationEnd The offset of the last byte of initialization data. * @param indexStart The offset of the first byte of index data. * @param indexEnd The offset of the last byte of index data. - * @param inbandEventStreams The {@link InbandEventStream}s in the representation. May be null. + * @param inbandEventStreams The in-band event streams in the representation. May be null. * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null. * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown. */ public static SingleSegmentRepresentation newInstance(String contentId, long revisionId, Format format, String uri, long initializationStart, long initializationEnd, - long indexStart, long indexEnd, List inbandEventStreams, + long indexStart, long indexEnd, List inbandEventStreams, String customCacheKey, long contentLength) { RangedUri rangedUri = new RangedUri(null, initializationStart, initializationEnd - initializationStart + 1); @@ -217,12 +217,12 @@ public abstract class Representation { * @param format The format of the representation. * @param baseUrl The base URL of the representation. * @param segmentBase The segment base underlying the representation. - * @param inbandEventStreams The {@link InbandEventStream}s in the representation. May be null. + * @param inbandEventStreams The in-band event streams in the representation. May be null. * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null. * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown. */ public SingleSegmentRepresentation(String contentId, long revisionId, Format format, - String baseUrl, SingleSegmentBase segmentBase, List inbandEventStreams, + String baseUrl, SingleSegmentBase segmentBase, List inbandEventStreams, String customCacheKey, long contentLength) { super(contentId, revisionId, format, baseUrl, segmentBase, inbandEventStreams); this.uri = Uri.parse(baseUrl); @@ -267,10 +267,10 @@ public abstract class Representation { * @param format The format of the representation. * @param baseUrl The base URL of the representation. * @param segmentBase The segment base underlying the representation. - * @param inbandEventStreams The {@link InbandEventStream}s in the representation. May be null. + * @param inbandEventStreams The in-band event streams in the representation. May be null. */ public MultiSegmentRepresentation(String contentId, long revisionId, Format format, - String baseUrl, MultiSegmentBase segmentBase, List inbandEventStreams) { + String baseUrl, MultiSegmentBase segmentBase, List inbandEventStreams) { super(contentId, revisionId, format, baseUrl, segmentBase, inbandEventStreams); this.segmentBase = segmentBase; } diff --git a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/InbandEventStream.java b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SchemeValuePair.java similarity index 87% rename from library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/InbandEventStream.java rename to library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SchemeValuePair.java index 2f24603598..470bf0f989 100644 --- a/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/InbandEventStream.java +++ b/library/src/main/java/com/google/android/exoplayer2/source/dash/manifest/SchemeValuePair.java @@ -18,14 +18,14 @@ package com.google.android.exoplayer2.source.dash.manifest; import com.google.android.exoplayer2.util.Util; /** - * Represents a DASH in-band event stream. + * A pair consisting of a scheme ID and value. */ -public class InbandEventStream { +public class SchemeValuePair { public final String schemeIdUri; public final String value; - public InbandEventStream(String schemeIdUri, String value) { + public SchemeValuePair(String schemeIdUri, String value) { this.schemeIdUri = schemeIdUri; this.value = value; } @@ -38,7 +38,7 @@ public class InbandEventStream { if (obj == null || getClass() != obj.getClass()) { return false; } - InbandEventStream other = (InbandEventStream) obj; + SchemeValuePair other = (SchemeValuePair) obj; return Util.areEqual(schemeIdUri, other.schemeIdUri) && Util.areEqual(value, other.value); }