com.google.android.exoplayer2.source.dash.manifest.Descriptor Java Examples
The following examples show how to use
com.google.android.exoplayer2.source.dash.manifest.Descriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DashMediaPeriod.java From MediaSDK with Apache License 2.0 | 5 votes |
private static Descriptor findAdaptationSetSwitchingProperty(List<Descriptor> descriptors) { for (int i = 0; i < descriptors.size(); i++) { Descriptor descriptor = descriptors.get(i); if ("urn:mpeg:dash:adaptation-set-switching:2016".equals(descriptor.schemeIdUri)) { return descriptor; } } return null; }
Example #2
Source File: DashMediaPeriod.java From MediaSDK with Apache License 2.0 | 5 votes |
private static Format[] getCea608TrackFormats( List<AdaptationSet> adaptationSets, int[] adaptationSetIndices) { for (int i : adaptationSetIndices) { AdaptationSet adaptationSet = adaptationSets.get(i); List<Descriptor> descriptors = adaptationSets.get(i).accessibilityDescriptors; for (int j = 0; j < descriptors.size(); j++) { Descriptor descriptor = descriptors.get(j); if ("urn:scte:dash:cc:cea-608:2015".equals(descriptor.schemeIdUri)) { String value = descriptor.value; if (value == null) { // There are embedded CEA-608 tracks, but service information is not declared. return new Format[] {buildCea608TrackFormat(adaptationSet.id)}; } String[] services = Util.split(value, ";"); Format[] formats = new Format[services.length]; for (int k = 0; k < services.length; k++) { Matcher matcher = CEA608_SERVICE_DESCRIPTOR_REGEX.matcher(services[k]); if (!matcher.matches()) { // If we can't parse service information for all services, assume a single track. return new Format[] {buildCea608TrackFormat(adaptationSet.id)}; } formats[k] = buildCea608TrackFormat( adaptationSet.id, /* language= */ matcher.group(2), /* accessibilityChannel= */ Integer.parseInt(matcher.group(1))); } return formats; } } } return new Format[0]; }
Example #3
Source File: DashMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static int[][] getGroupedAdaptationSetIndices(List<AdaptationSet> adaptationSets) { int adaptationSetCount = adaptationSets.size(); SparseIntArray idToIndexMap = new SparseIntArray(adaptationSetCount); for (int i = 0; i < adaptationSetCount; i++) { idToIndexMap.put(adaptationSets.get(i).id, i); } int[][] groupedAdaptationSetIndices = new int[adaptationSetCount][]; boolean[] adaptationSetUsedFlags = new boolean[adaptationSetCount]; int groupCount = 0; for (int i = 0; i < adaptationSetCount; i++) { if (adaptationSetUsedFlags[i]) { // This adaptation set has already been included in a group. continue; } adaptationSetUsedFlags[i] = true; Descriptor adaptationSetSwitchingProperty = findAdaptationSetSwitchingProperty( adaptationSets.get(i).supplementalProperties); if (adaptationSetSwitchingProperty == null) { groupedAdaptationSetIndices[groupCount++] = new int[] {i}; } else { String[] extraAdaptationSetIds = adaptationSetSwitchingProperty.value.split(","); int[] adaptationSetIndices = new int[1 + extraAdaptationSetIds.length]; adaptationSetIndices[0] = i; for (int j = 0; j < extraAdaptationSetIds.length; j++) { int extraIndex = idToIndexMap.get(Integer.parseInt(extraAdaptationSetIds[j])); adaptationSetUsedFlags[extraIndex] = true; adaptationSetIndices[1 + j] = extraIndex; } groupedAdaptationSetIndices[groupCount++] = adaptationSetIndices; } } return groupCount < adaptationSetCount ? Arrays.copyOf(groupedAdaptationSetIndices, groupCount) : groupedAdaptationSetIndices; }
Example #4
Source File: DashMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static Descriptor findAdaptationSetSwitchingProperty(List<Descriptor> descriptors) { for (int i = 0; i < descriptors.size(); i++) { Descriptor descriptor = descriptors.get(i); if ("urn:mpeg:dash:adaptation-set-switching:2016".equals(descriptor.schemeIdUri)) { return descriptor; } } return null; }
Example #5
Source File: DashMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static boolean hasCea608Track(List<AdaptationSet> adaptationSets, int[] adaptationSetIndices) { for (int i : adaptationSetIndices) { List<Descriptor> descriptors = adaptationSets.get(i).accessibilityDescriptors; for (int j = 0; j < descriptors.size(); j++) { Descriptor descriptor = descriptors.get(j); if ("urn:scte:dash:cc:cea-608:2015".equals(descriptor.schemeIdUri)) { return true; } } } return false; }
Example #6
Source File: DashMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static int[][] getGroupedAdaptationSetIndices(List<AdaptationSet> adaptationSets) { int adaptationSetCount = adaptationSets.size(); SparseIntArray idToIndexMap = new SparseIntArray(adaptationSetCount); for (int i = 0; i < adaptationSetCount; i++) { idToIndexMap.put(adaptationSets.get(i).id, i); } int[][] groupedAdaptationSetIndices = new int[adaptationSetCount][]; boolean[] adaptationSetUsedFlags = new boolean[adaptationSetCount]; int groupCount = 0; for (int i = 0; i < adaptationSetCount; i++) { if (adaptationSetUsedFlags[i]) { // This adaptation set has already been included in a group. continue; } adaptationSetUsedFlags[i] = true; Descriptor adaptationSetSwitchingProperty = findAdaptationSetSwitchingProperty( adaptationSets.get(i).supplementalProperties); if (adaptationSetSwitchingProperty == null) { groupedAdaptationSetIndices[groupCount++] = new int[] {i}; } else { String[] extraAdaptationSetIds = adaptationSetSwitchingProperty.value.split(","); int[] adaptationSetIndices = new int[1 + extraAdaptationSetIds.length]; adaptationSetIndices[0] = i; for (int j = 0; j < extraAdaptationSetIds.length; j++) { int extraIndex = idToIndexMap.get(Integer.parseInt(extraAdaptationSetIds[j])); adaptationSetUsedFlags[extraIndex] = true; adaptationSetIndices[1 + j] = extraIndex; } groupedAdaptationSetIndices[groupCount++] = adaptationSetIndices; } } return groupCount < adaptationSetCount ? Arrays.copyOf(groupedAdaptationSetIndices, groupCount) : groupedAdaptationSetIndices; }
Example #7
Source File: DashMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static Descriptor findAdaptationSetSwitchingProperty(List<Descriptor> descriptors) { for (int i = 0; i < descriptors.size(); i++) { Descriptor descriptor = descriptors.get(i); if ("urn:mpeg:dash:adaptation-set-switching:2016".equals(descriptor.schemeIdUri)) { return descriptor; } } return null; }
Example #8
Source File: DashMediaPeriod.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static boolean hasCea608Track(List<AdaptationSet> adaptationSets, int[] adaptationSetIndices) { for (int i : adaptationSetIndices) { List<Descriptor> descriptors = adaptationSets.get(i).accessibilityDescriptors; for (int j = 0; j < descriptors.size(); j++) { Descriptor descriptor = descriptors.get(j); if ("urn:scte:dash:cc:cea-608:2015".equals(descriptor.schemeIdUri)) { return true; } } } return false; }
Example #9
Source File: DashMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private static Descriptor findAdaptationSetSwitchingProperty(List<Descriptor> descriptors) { for (int i = 0; i < descriptors.size(); i++) { Descriptor descriptor = descriptors.get(i); if ("urn:mpeg:dash:adaptation-set-switching:2016".equals(descriptor.schemeIdUri)) { return descriptor; } } return null; }
Example #10
Source File: DashMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private static Format[] getCea608TrackFormats( List<AdaptationSet> adaptationSets, int[] adaptationSetIndices) { for (int i : adaptationSetIndices) { AdaptationSet adaptationSet = adaptationSets.get(i); List<Descriptor> descriptors = adaptationSets.get(i).accessibilityDescriptors; for (int j = 0; j < descriptors.size(); j++) { Descriptor descriptor = descriptors.get(j); if ("urn:scte:dash:cc:cea-608:2015".equals(descriptor.schemeIdUri)) { String value = descriptor.value; if (value == null) { // There are embedded CEA-608 tracks, but service information is not declared. return new Format[] {buildCea608TrackFormat(adaptationSet.id)}; } String[] services = Util.split(value, ";"); Format[] formats = new Format[services.length]; for (int k = 0; k < services.length; k++) { Matcher matcher = CEA608_SERVICE_DESCRIPTOR_REGEX.matcher(services[k]); if (!matcher.matches()) { // If we can't parse service information for all services, assume a single track. return new Format[] {buildCea608TrackFormat(adaptationSet.id)}; } formats[k] = buildCea608TrackFormat( adaptationSet.id, /* language= */ matcher.group(2), /* accessibilityChannel= */ Integer.parseInt(matcher.group(1))); } return formats; } } } return new Format[0]; }
Example #11
Source File: DashMediaPeriod.java From Telegram with GNU General Public License v2.0 | 5 votes |
private static Descriptor findAdaptationSetSwitchingProperty(List<Descriptor> descriptors) { for (int i = 0; i < descriptors.size(); i++) { Descriptor descriptor = descriptors.get(i); if ("urn:mpeg:dash:adaptation-set-switching:2016".equals(descriptor.schemeIdUri)) { return descriptor; } } return null; }
Example #12
Source File: DashMediaPeriod.java From Telegram with GNU General Public License v2.0 | 5 votes |
private static Format[] getCea608TrackFormats( List<AdaptationSet> adaptationSets, int[] adaptationSetIndices) { for (int i : adaptationSetIndices) { AdaptationSet adaptationSet = adaptationSets.get(i); List<Descriptor> descriptors = adaptationSets.get(i).accessibilityDescriptors; for (int j = 0; j < descriptors.size(); j++) { Descriptor descriptor = descriptors.get(j); if ("urn:scte:dash:cc:cea-608:2015".equals(descriptor.schemeIdUri)) { String value = descriptor.value; if (value == null) { // There are embedded CEA-608 tracks, but service information is not declared. return new Format[] {buildCea608TrackFormat(adaptationSet.id)}; } String[] services = Util.split(value, ";"); Format[] formats = new Format[services.length]; for (int k = 0; k < services.length; k++) { Matcher matcher = CEA608_SERVICE_DESCRIPTOR_REGEX.matcher(services[k]); if (!matcher.matches()) { // If we can't parse service information for all services, assume a single track. return new Format[] {buildCea608TrackFormat(adaptationSet.id)}; } formats[k] = buildCea608TrackFormat( adaptationSet.id, /* language= */ matcher.group(2), /* accessibilityChannel= */ Integer.parseInt(matcher.group(1))); } return formats; } } } return new Format[0]; }
Example #13
Source File: DashMediaPeriod.java From MediaSDK with Apache License 2.0 | 4 votes |
private static int[][] getGroupedAdaptationSetIndices(List<AdaptationSet> adaptationSets) { int adaptationSetCount = adaptationSets.size(); SparseIntArray idToIndexMap = new SparseIntArray(adaptationSetCount); for (int i = 0; i < adaptationSetCount; i++) { idToIndexMap.put(adaptationSets.get(i).id, i); } int[][] groupedAdaptationSetIndices = new int[adaptationSetCount][]; boolean[] adaptationSetUsedFlags = new boolean[adaptationSetCount]; int groupCount = 0; for (int i = 0; i < adaptationSetCount; i++) { if (adaptationSetUsedFlags[i]) { // This adaptation set has already been included in a group. continue; } adaptationSetUsedFlags[i] = true; Descriptor adaptationSetSwitchingProperty = findAdaptationSetSwitchingProperty( adaptationSets.get(i).supplementalProperties); if (adaptationSetSwitchingProperty == null) { groupedAdaptationSetIndices[groupCount++] = new int[] {i}; } else { String[] extraAdaptationSetIds = Util.split(adaptationSetSwitchingProperty.value, ","); int[] adaptationSetIndices = new int[1 + extraAdaptationSetIds.length]; adaptationSetIndices[0] = i; int outputIndex = 1; for (String adaptationSetId : extraAdaptationSetIds) { int extraIndex = idToIndexMap.get(Integer.parseInt(adaptationSetId), /* valueIfKeyNotFound= */ -1); if (extraIndex != -1) { adaptationSetUsedFlags[extraIndex] = true; adaptationSetIndices[outputIndex] = extraIndex; outputIndex++; } } if (outputIndex < adaptationSetIndices.length) { adaptationSetIndices = Arrays.copyOf(adaptationSetIndices, outputIndex); } groupedAdaptationSetIndices[groupCount++] = adaptationSetIndices; } } return groupCount < adaptationSetCount ? Arrays.copyOf(groupedAdaptationSetIndices, groupCount) : groupedAdaptationSetIndices; }
Example #14
Source File: DashMediaPeriod.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private static int[][] getGroupedAdaptationSetIndices(List<AdaptationSet> adaptationSets) { int adaptationSetCount = adaptationSets.size(); SparseIntArray idToIndexMap = new SparseIntArray(adaptationSetCount); for (int i = 0; i < adaptationSetCount; i++) { idToIndexMap.put(adaptationSets.get(i).id, i); } int[][] groupedAdaptationSetIndices = new int[adaptationSetCount][]; boolean[] adaptationSetUsedFlags = new boolean[adaptationSetCount]; int groupCount = 0; for (int i = 0; i < adaptationSetCount; i++) { if (adaptationSetUsedFlags[i]) { // This adaptation set has already been included in a group. continue; } adaptationSetUsedFlags[i] = true; Descriptor adaptationSetSwitchingProperty = findAdaptationSetSwitchingProperty( adaptationSets.get(i).supplementalProperties); if (adaptationSetSwitchingProperty == null) { groupedAdaptationSetIndices[groupCount++] = new int[] {i}; } else { String[] extraAdaptationSetIds = Util.split(adaptationSetSwitchingProperty.value, ","); int[] adaptationSetIndices = new int[1 + extraAdaptationSetIds.length]; adaptationSetIndices[0] = i; int outputIndex = 1; for (int j = 0; j < extraAdaptationSetIds.length; j++) { int extraIndex = idToIndexMap.get( Integer.parseInt(extraAdaptationSetIds[j]), /* valueIfKeyNotFound= */ -1); if (extraIndex != -1) { adaptationSetUsedFlags[extraIndex] = true; adaptationSetIndices[outputIndex] = extraIndex; outputIndex++; } } if (outputIndex < adaptationSetIndices.length) { adaptationSetIndices = Arrays.copyOf(adaptationSetIndices, outputIndex); } groupedAdaptationSetIndices[groupCount++] = adaptationSetIndices; } } return groupCount < adaptationSetCount ? Arrays.copyOf(groupedAdaptationSetIndices, groupCount) : groupedAdaptationSetIndices; }
Example #15
Source File: DashMediaPeriod.java From Telegram with GNU General Public License v2.0 | 4 votes |
private static int[][] getGroupedAdaptationSetIndices(List<AdaptationSet> adaptationSets) { int adaptationSetCount = adaptationSets.size(); SparseIntArray idToIndexMap = new SparseIntArray(adaptationSetCount); for (int i = 0; i < adaptationSetCount; i++) { idToIndexMap.put(adaptationSets.get(i).id, i); } int[][] groupedAdaptationSetIndices = new int[adaptationSetCount][]; boolean[] adaptationSetUsedFlags = new boolean[adaptationSetCount]; int groupCount = 0; for (int i = 0; i < adaptationSetCount; i++) { if (adaptationSetUsedFlags[i]) { // This adaptation set has already been included in a group. continue; } adaptationSetUsedFlags[i] = true; Descriptor adaptationSetSwitchingProperty = findAdaptationSetSwitchingProperty( adaptationSets.get(i).supplementalProperties); if (adaptationSetSwitchingProperty == null) { groupedAdaptationSetIndices[groupCount++] = new int[] {i}; } else { String[] extraAdaptationSetIds = Util.split(adaptationSetSwitchingProperty.value, ","); int[] adaptationSetIndices = new int[1 + extraAdaptationSetIds.length]; adaptationSetIndices[0] = i; int outputIndex = 1; for (int j = 0; j < extraAdaptationSetIds.length; j++) { int extraIndex = idToIndexMap.get( Integer.parseInt(extraAdaptationSetIds[j]), /* valueIfKeyNotFound= */ -1); if (extraIndex != -1) { adaptationSetUsedFlags[extraIndex] = true; adaptationSetIndices[outputIndex] = extraIndex; outputIndex++; } } if (outputIndex < adaptationSetIndices.length) { adaptationSetIndices = Arrays.copyOf(adaptationSetIndices, outputIndex); } groupedAdaptationSetIndices[groupCount++] = adaptationSetIndices; } } return groupCount < adaptationSetCount ? Arrays.copyOf(groupedAdaptationSetIndices, groupCount) : groupedAdaptationSetIndices; }