mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add IntDef for role and accessibility descriptor's value, parse these also for video / audio tracks
This commit is contained in:
parent
43ea388098
commit
58d746ecaa
@ -976,6 +976,54 @@ public final class C {
|
|||||||
*/
|
*/
|
||||||
public static final int NETWORK_TYPE_OTHER = 8;
|
public static final int NETWORK_TYPE_OTHER = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adaptation set's role descriptor value (ISO 23009-1)
|
||||||
|
*/
|
||||||
|
@Documented
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@IntDef({
|
||||||
|
ROLE_UNSET,
|
||||||
|
ROLE_MAIN,
|
||||||
|
ROLE_ALTERNATE,
|
||||||
|
ROLE_SUPPLEMENTARY,
|
||||||
|
ROLE_COMMENTARY,
|
||||||
|
ROLE_DUB,
|
||||||
|
ROLE_EMERGENCY,
|
||||||
|
ROLE_CAPTION,
|
||||||
|
ROLE_SIGN
|
||||||
|
})
|
||||||
|
public @interface Role {}
|
||||||
|
|
||||||
|
public static final int ROLE_UNSET = -1;
|
||||||
|
public static final int ROLE_MAIN = 0;
|
||||||
|
public static final int ROLE_ALTERNATE = 1;
|
||||||
|
public static final int ROLE_SUPPLEMENTARY = 2;
|
||||||
|
public static final int ROLE_COMMENTARY = 3;
|
||||||
|
public static final int ROLE_DUB = 4;
|
||||||
|
public static final int ROLE_EMERGENCY = 5;
|
||||||
|
public static final int ROLE_CAPTION = 6;
|
||||||
|
public static final int ROLE_SIGN = 7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adaptation set's accessibility descriptor value (ISO 23009-1)
|
||||||
|
*/
|
||||||
|
@Documented
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@IntDef({
|
||||||
|
ACCESSIBILITY_UNSET,
|
||||||
|
ACCESSIBILITY_ENHANCED_AUDIO_INTELLIGIBILITY,
|
||||||
|
ACCESSIBILITY_DESCRIPTION,
|
||||||
|
ACCESSIBILITY_CAPTION,
|
||||||
|
ACCESSIBILITY_SIGN
|
||||||
|
})
|
||||||
|
public @interface Accessibility {}
|
||||||
|
|
||||||
|
public static final int ACCESSIBILITY_UNSET = -1;
|
||||||
|
public static final int ACCESSIBILITY_ENHANCED_AUDIO_INTELLIGIBILITY = 1;
|
||||||
|
public static final int ACCESSIBILITY_DESCRIPTION = 2;
|
||||||
|
public static final int ACCESSIBILITY_CAPTION = 3;
|
||||||
|
public static final int ACCESSIBILITY_SIGN = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a time in microseconds to the corresponding time in milliseconds, preserving
|
* Converts a time in microseconds to the corresponding time in milliseconds, preserving
|
||||||
* {@link #TIME_UNSET} and {@link #TIME_END_OF_SOURCE} values.
|
* {@link #TIME_UNSET} and {@link #TIME_END_OF_SOURCE} values.
|
||||||
|
@ -48,7 +48,18 @@ public final class Format implements Parcelable {
|
|||||||
public final @Nullable String id;
|
public final @Nullable String id;
|
||||||
/** The human readable label, or null if unknown or not applicable. */
|
/** The human readable label, or null if unknown or not applicable. */
|
||||||
public final @Nullable String label;
|
public final @Nullable String label;
|
||||||
|
/** Track selection flags. **/
|
||||||
|
@C.SelectionFlags
|
||||||
|
public final int selectionFlags;
|
||||||
|
/** Track role descriptor value, or {@link C#ROLE_UNSET} if unknown or not applicable. **/
|
||||||
|
@C.Role
|
||||||
|
public final int role;
|
||||||
|
/**
|
||||||
|
* Track accessibility descriptor value, or {@link C#ACCESSIBILITY_UNSET} if unknown
|
||||||
|
* or not applicable.
|
||||||
|
*/
|
||||||
|
@C.Accessibility
|
||||||
|
public final int accessibility;
|
||||||
/**
|
/**
|
||||||
* The average bandwidth in bits per second, or {@link #NO_VALUE} if unknown or not applicable.
|
* The average bandwidth in bits per second, or {@link #NO_VALUE} if unknown or not applicable.
|
||||||
*/
|
*/
|
||||||
@ -153,12 +164,6 @@ public final class Format implements Parcelable {
|
|||||||
|
|
||||||
// Audio and text specific.
|
// Audio and text specific.
|
||||||
|
|
||||||
/**
|
|
||||||
* Track selection flags.
|
|
||||||
*/
|
|
||||||
@C.SelectionFlags
|
|
||||||
public final int selectionFlags;
|
|
||||||
|
|
||||||
/** The language as ISO 639-2/T three-letter code, or null if unknown or not applicable. */
|
/** The language as ISO 639-2/T three-letter code, or null if unknown or not applicable. */
|
||||||
public final @Nullable String language;
|
public final @Nullable String language;
|
||||||
|
|
||||||
@ -167,16 +172,6 @@ public final class Format implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public final int accessibilityChannel;
|
public final int accessibilityChannel;
|
||||||
|
|
||||||
/**
|
|
||||||
* The Role descriptor value.
|
|
||||||
*/
|
|
||||||
public final String role;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Accessibility descriptor value.
|
|
||||||
*/
|
|
||||||
public final String accessibility;
|
|
||||||
|
|
||||||
// Lazily initialized hashcode.
|
// Lazily initialized hashcode.
|
||||||
private int hashCode;
|
private int hashCode;
|
||||||
|
|
||||||
@ -193,7 +188,9 @@ public final class Format implements Parcelable {
|
|||||||
int height,
|
int height,
|
||||||
float frameRate,
|
float frameRate,
|
||||||
@Nullable List<byte[]> initializationData,
|
@Nullable List<byte[]> initializationData,
|
||||||
@C.SelectionFlags int selectionFlags) {
|
@C.SelectionFlags int selectionFlags,
|
||||||
|
@C.Role int role,
|
||||||
|
@C.Accessibility int accessibility) {
|
||||||
return createVideoContainerFormat(
|
return createVideoContainerFormat(
|
||||||
id,
|
id,
|
||||||
/* label= */ null,
|
/* label= */ null,
|
||||||
@ -205,7 +202,9 @@ public final class Format implements Parcelable {
|
|||||||
height,
|
height,
|
||||||
frameRate,
|
frameRate,
|
||||||
initializationData,
|
initializationData,
|
||||||
selectionFlags);
|
selectionFlags,
|
||||||
|
role,
|
||||||
|
accessibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Format createVideoContainerFormat(
|
public static Format createVideoContainerFormat(
|
||||||
@ -219,7 +218,9 @@ public final class Format implements Parcelable {
|
|||||||
int height,
|
int height,
|
||||||
float frameRate,
|
float frameRate,
|
||||||
@Nullable List<byte[]> initializationData,
|
@Nullable List<byte[]> initializationData,
|
||||||
@C.SelectionFlags int selectionFlags) {
|
@C.SelectionFlags int selectionFlags,
|
||||||
|
@C.Role int role,
|
||||||
|
@C.Accessibility int accessibility) {
|
||||||
return new Format(
|
return new Format(
|
||||||
id,
|
id,
|
||||||
label,
|
label,
|
||||||
@ -244,8 +245,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
/* language= */ null,
|
/* language= */ null,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
role,
|
||||||
/* accessibility= */ null,
|
accessibility,
|
||||||
OFFSET_SAMPLE_RELATIVE,
|
OFFSET_SAMPLE_RELATIVE,
|
||||||
initializationData,
|
initializationData,
|
||||||
/* drmInitData= */ null,
|
/* drmInitData= */ null,
|
||||||
@ -349,8 +350,8 @@ public final class Format implements Parcelable {
|
|||||||
/* selectionFlags= */ 0,
|
/* selectionFlags= */ 0,
|
||||||
/* language= */ null,
|
/* language= */ null,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null,
|
/* accessibility= */ C.ACCESSIBILITY_UNSET,
|
||||||
OFFSET_SAMPLE_RELATIVE,
|
OFFSET_SAMPLE_RELATIVE,
|
||||||
initializationData,
|
initializationData,
|
||||||
drmInitData,
|
drmInitData,
|
||||||
@ -370,7 +371,9 @@ public final class Format implements Parcelable {
|
|||||||
int sampleRate,
|
int sampleRate,
|
||||||
@Nullable List<byte[]> initializationData,
|
@Nullable List<byte[]> initializationData,
|
||||||
@C.SelectionFlags int selectionFlags,
|
@C.SelectionFlags int selectionFlags,
|
||||||
@Nullable String language) {
|
@Nullable String language,
|
||||||
|
@C.Role int role,
|
||||||
|
@C.Accessibility int accessibility) {
|
||||||
return createAudioContainerFormat(
|
return createAudioContainerFormat(
|
||||||
id,
|
id,
|
||||||
/* label= */ null,
|
/* label= */ null,
|
||||||
@ -382,7 +385,9 @@ public final class Format implements Parcelable {
|
|||||||
sampleRate,
|
sampleRate,
|
||||||
initializationData,
|
initializationData,
|
||||||
selectionFlags,
|
selectionFlags,
|
||||||
language);
|
language,
|
||||||
|
role,
|
||||||
|
accessibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Format createAudioContainerFormat(
|
public static Format createAudioContainerFormat(
|
||||||
@ -396,7 +401,9 @@ public final class Format implements Parcelable {
|
|||||||
int sampleRate,
|
int sampleRate,
|
||||||
@Nullable List<byte[]> initializationData,
|
@Nullable List<byte[]> initializationData,
|
||||||
@C.SelectionFlags int selectionFlags,
|
@C.SelectionFlags int selectionFlags,
|
||||||
@Nullable String language) {
|
@Nullable String language,
|
||||||
|
@C.Role int role,
|
||||||
|
@C.Accessibility int accessibility) {
|
||||||
return new Format(
|
return new Format(
|
||||||
id,
|
id,
|
||||||
label,
|
label,
|
||||||
@ -421,8 +428,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
language,
|
language,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
role,
|
||||||
/* accessibility= */ null,
|
accessibility,
|
||||||
OFFSET_SAMPLE_RELATIVE,
|
OFFSET_SAMPLE_RELATIVE,
|
||||||
initializationData,
|
initializationData,
|
||||||
/* drmInitData= */ null,
|
/* drmInitData= */ null,
|
||||||
@ -527,8 +534,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
language,
|
language,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null,
|
/* accessibility= */ C.ACCESSIBILITY_UNSET,
|
||||||
OFFSET_SAMPLE_RELATIVE,
|
OFFSET_SAMPLE_RELATIVE,
|
||||||
initializationData,
|
initializationData,
|
||||||
drmInitData,
|
drmInitData,
|
||||||
@ -576,8 +583,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
language,
|
language,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null);
|
/* accessibility= */ C.ACCESSIBILITY_UNSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Format createTextContainerFormat(
|
public static Format createTextContainerFormat(
|
||||||
@ -590,8 +597,8 @@ public final class Format implements Parcelable {
|
|||||||
@C.SelectionFlags int selectionFlags,
|
@C.SelectionFlags int selectionFlags,
|
||||||
@Nullable String language,
|
@Nullable String language,
|
||||||
int accessibilityChannel,
|
int accessibilityChannel,
|
||||||
@Nullable String role,
|
@C.Role int role,
|
||||||
@Nullable String accessibility) {
|
@C.Accessibility int accessibility) {
|
||||||
return new Format(
|
return new Format(
|
||||||
id,
|
id,
|
||||||
label,
|
label,
|
||||||
@ -730,8 +737,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
language,
|
language,
|
||||||
accessibilityChannel,
|
accessibilityChannel,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null,
|
/* accessibility= */ C.ACCESSIBILITY_UNSET,
|
||||||
subsampleOffsetUs,
|
subsampleOffsetUs,
|
||||||
initializationData,
|
initializationData,
|
||||||
drmInitData,
|
drmInitData,
|
||||||
@ -773,8 +780,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
language,
|
language,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null,
|
/* accessibility= */ C.ACCESSIBILITY_UNSET,
|
||||||
OFFSET_SAMPLE_RELATIVE,
|
OFFSET_SAMPLE_RELATIVE,
|
||||||
initializationData,
|
initializationData,
|
||||||
drmInitData,
|
drmInitData,
|
||||||
@ -836,8 +843,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
language,
|
language,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null,
|
/* accessibility= */ C.ACCESSIBILITY_UNSET,
|
||||||
OFFSET_SAMPLE_RELATIVE,
|
OFFSET_SAMPLE_RELATIVE,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
/* drmInitData= */ null,
|
/* drmInitData= */ null,
|
||||||
@ -870,8 +877,8 @@ public final class Format implements Parcelable {
|
|||||||
/* selectionFlags= */ 0,
|
/* selectionFlags= */ 0,
|
||||||
/* language= */ null,
|
/* language= */ null,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null,
|
/* accessibility= */ C.ACCESSIBILITY_UNSET,
|
||||||
subsampleOffsetUs,
|
subsampleOffsetUs,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
/* drmInitData= */ null,
|
/* drmInitData= */ null,
|
||||||
@ -908,8 +915,8 @@ public final class Format implements Parcelable {
|
|||||||
/* selectionFlags= */ 0,
|
/* selectionFlags= */ 0,
|
||||||
/* language= */ null,
|
/* language= */ null,
|
||||||
/* accessibilityChannel= */ NO_VALUE,
|
/* accessibilityChannel= */ NO_VALUE,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null,
|
/* accessibility= */ C.ACCESSIBILITY_UNSET,
|
||||||
OFFSET_SAMPLE_RELATIVE,
|
OFFSET_SAMPLE_RELATIVE,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
drmInitData,
|
drmInitData,
|
||||||
@ -940,8 +947,8 @@ public final class Format implements Parcelable {
|
|||||||
@C.SelectionFlags int selectionFlags,
|
@C.SelectionFlags int selectionFlags,
|
||||||
@Nullable String language,
|
@Nullable String language,
|
||||||
int accessibilityChannel,
|
int accessibilityChannel,
|
||||||
@Nullable String role,
|
@C.Role int role,
|
||||||
@Nullable String accessibility,
|
@C.Accessibility int accessibility,
|
||||||
long subsampleOffsetUs,
|
long subsampleOffsetUs,
|
||||||
@Nullable List<byte[]> initializationData,
|
@Nullable List<byte[]> initializationData,
|
||||||
@Nullable DrmInitData drmInitData,
|
@Nullable DrmInitData drmInitData,
|
||||||
@ -1005,8 +1012,8 @@ public final class Format implements Parcelable {
|
|||||||
selectionFlags = in.readInt();
|
selectionFlags = in.readInt();
|
||||||
language = in.readString();
|
language = in.readString();
|
||||||
accessibilityChannel = in.readInt();
|
accessibilityChannel = in.readInt();
|
||||||
role = in.readString();
|
role = in.readInt();
|
||||||
accessibility = in.readString();
|
accessibility = in.readInt();
|
||||||
subsampleOffsetUs = in.readLong();
|
subsampleOffsetUs = in.readLong();
|
||||||
int initializationDataSize = in.readInt();
|
int initializationDataSize = in.readInt();
|
||||||
initializationData = new ArrayList<>(initializationDataSize);
|
initializationData = new ArrayList<>(initializationDataSize);
|
||||||
@ -1602,8 +1609,8 @@ public final class Format implements Parcelable {
|
|||||||
dest.writeInt(selectionFlags);
|
dest.writeInt(selectionFlags);
|
||||||
dest.writeString(language);
|
dest.writeString(language);
|
||||||
dest.writeInt(accessibilityChannel);
|
dest.writeInt(accessibilityChannel);
|
||||||
dest.writeString(role);
|
dest.writeInt(role);
|
||||||
dest.writeString(accessibility);
|
dest.writeInt(accessibility);
|
||||||
dest.writeLong(subsampleOffsetUs);
|
dest.writeLong(subsampleOffsetUs);
|
||||||
int initializationDataSize = initializationData.size();
|
int initializationDataSize = initializationData.size();
|
||||||
dest.writeInt(initializationDataSize);
|
dest.writeInt(initializationDataSize);
|
||||||
|
@ -302,8 +302,7 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
contentType = checkContentTypeConsistency(contentType, parseContentType(xpp));
|
contentType = checkContentTypeConsistency(contentType, parseContentType(xpp));
|
||||||
} else if (XmlPullParserUtil.isStartTag(xpp, "Role")) {
|
} else if (XmlPullParserUtil.isStartTag(xpp, "Role")) {
|
||||||
Descriptor descriptor = parseDescriptor(xpp, "Role");
|
Descriptor descriptor = parseDescriptor(xpp, "Role");
|
||||||
selectionFlags |= "urn:mpeg:dash:role:2011".equals(descriptor.schemeIdUri)
|
selectionFlags |= parseSelectionFlags(descriptor);
|
||||||
&& "main".equals(descriptor.value) ? C.SELECTION_FLAG_DEFAULT : 0;
|
|
||||||
roleDescriptors.add(descriptor);
|
roleDescriptors.add(descriptor);
|
||||||
} else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) {
|
} else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) {
|
||||||
audioChannels = parseAudioChannelConfiguration(xpp);
|
audioChannels = parseAudioChannelConfiguration(xpp);
|
||||||
@ -589,6 +588,8 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
List<Descriptor> supplementalProperties) {
|
List<Descriptor> supplementalProperties) {
|
||||||
String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
|
String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
|
||||||
if (sampleMimeType != null) {
|
if (sampleMimeType != null) {
|
||||||
|
int role = parseRole(roleDescriptors);
|
||||||
|
int accessibility = parseAccessibility(accessibilityDescriptors);
|
||||||
if (MimeTypes.AUDIO_E_AC3.equals(sampleMimeType)) {
|
if (MimeTypes.AUDIO_E_AC3.equals(sampleMimeType)) {
|
||||||
sampleMimeType = parseEac3SupplementalProperties(supplementalProperties);
|
sampleMimeType = parseEac3SupplementalProperties(supplementalProperties);
|
||||||
}
|
}
|
||||||
@ -604,7 +605,9 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
height,
|
height,
|
||||||
frameRate,
|
frameRate,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
selectionFlags);
|
selectionFlags,
|
||||||
|
role,
|
||||||
|
accessibility);
|
||||||
} else if (MimeTypes.isAudio(sampleMimeType)) {
|
} else if (MimeTypes.isAudio(sampleMimeType)) {
|
||||||
return Format.createAudioContainerFormat(
|
return Format.createAudioContainerFormat(
|
||||||
id,
|
id,
|
||||||
@ -617,7 +620,9 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
audioSamplingRate,
|
audioSamplingRate,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
selectionFlags,
|
selectionFlags,
|
||||||
language);
|
language,
|
||||||
|
role,
|
||||||
|
accessibility);
|
||||||
} else if (mimeTypeIsRawText(sampleMimeType)) {
|
} else if (mimeTypeIsRawText(sampleMimeType)) {
|
||||||
int accessibilityChannel;
|
int accessibilityChannel;
|
||||||
if (MimeTypes.APPLICATION_CEA608.equals(sampleMimeType)) {
|
if (MimeTypes.APPLICATION_CEA608.equals(sampleMimeType)) {
|
||||||
@ -627,10 +632,6 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
} else {
|
} else {
|
||||||
accessibilityChannel = Format.NO_VALUE;
|
accessibilityChannel = Format.NO_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
String role = parseRole(roleDescriptors);
|
|
||||||
String accessibility = parseAccessibility(accessibilityDescriptors);
|
|
||||||
|
|
||||||
return Format.createTextContainerFormat(
|
return Format.createTextContainerFormat(
|
||||||
id,
|
id,
|
||||||
label,
|
label,
|
||||||
@ -1060,6 +1061,77 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
return audioChannels;
|
return audioChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Selection flag parsing.
|
||||||
|
|
||||||
|
protected int parseSelectionFlags(Descriptor roleDescriptor) {
|
||||||
|
return "urn:mpeg:dash:role:2011".equals(roleDescriptor.schemeIdUri)
|
||||||
|
&& "main".equals(roleDescriptor.value) ? C.SELECTION_FLAG_DEFAULT : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Role and Accessibility parsing.
|
||||||
|
|
||||||
|
protected @C.Role int parseRole(List<Descriptor> roleDescriptors) {
|
||||||
|
for (int i = 0; i < roleDescriptors.size(); i++) {
|
||||||
|
Descriptor descriptor = roleDescriptors.get(i);
|
||||||
|
if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(descriptor.schemeIdUri) && descriptor.value != null) {
|
||||||
|
switch (descriptor.value) {
|
||||||
|
case "main":
|
||||||
|
return C.ROLE_MAIN;
|
||||||
|
case "alternate":
|
||||||
|
return C.ROLE_ALTERNATE;
|
||||||
|
case "supplementary":
|
||||||
|
return C.ROLE_SUPPLEMENTARY;
|
||||||
|
case "commentary":
|
||||||
|
return C.ROLE_COMMENTARY;
|
||||||
|
case "dub":
|
||||||
|
return C.ROLE_DUB;
|
||||||
|
case "emergency":
|
||||||
|
return C.ROLE_EMERGENCY;
|
||||||
|
case "caption":
|
||||||
|
return C.ROLE_CAPTION;
|
||||||
|
case "sign":
|
||||||
|
return C.ROLE_SIGN;
|
||||||
|
default:
|
||||||
|
return C.ROLE_UNSET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return C.ROLE_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected @C.Accessibility int parseAccessibility(List<Descriptor> accessibilityDescriptors) {
|
||||||
|
for (int i = 0; i < accessibilityDescriptors.size(); i++) {
|
||||||
|
Descriptor descriptor = accessibilityDescriptors.get(i);
|
||||||
|
if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(descriptor.schemeIdUri) && descriptor.value != null) {
|
||||||
|
switch (descriptor.value){
|
||||||
|
case "description":
|
||||||
|
return C.ACCESSIBILITY_DESCRIPTION;
|
||||||
|
case "enhanced-audio-intelligibility":
|
||||||
|
return C.ACCESSIBILITY_ENHANCED_AUDIO_INTELLIGIBILITY;
|
||||||
|
case "caption":
|
||||||
|
return C.ACCESSIBILITY_CAPTION;
|
||||||
|
case "sign":
|
||||||
|
return C.ACCESSIBILITY_SIGN;
|
||||||
|
default:
|
||||||
|
return C.ACCESSIBILITY_UNSET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("urn:tva:metadata:cs:AudioPurposeCS:2007".equalsIgnoreCase(descriptor.schemeIdUri) &&
|
||||||
|
descriptor.value != null) {
|
||||||
|
switch (descriptor.value){
|
||||||
|
case "1":
|
||||||
|
return C.ACCESSIBILITY_ENHANCED_AUDIO_INTELLIGIBILITY;
|
||||||
|
case "2":
|
||||||
|
return C.ACCESSIBILITY_CAPTION;
|
||||||
|
default:
|
||||||
|
return C.ACCESSIBILITY_UNSET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return C.ACCESSIBILITY_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
// Utility methods.
|
// Utility methods.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1262,32 +1334,6 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
return MimeTypes.AUDIO_E_AC3;
|
return MimeTypes.AUDIO_E_AC3;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String parseRole(List<Descriptor> roleDescriptors) {
|
|
||||||
for (int i = 0; i < roleDescriptors.size(); i++) {
|
|
||||||
Descriptor descriptor = roleDescriptors.get(i);
|
|
||||||
if ("urn:mpeg:dash:role:2011".equals(descriptor.schemeIdUri) && descriptor.value != null) {
|
|
||||||
return descriptor.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static String parseAccessibility(List<Descriptor> accessibilityDescriptors) {
|
|
||||||
for (int i = 0; i < accessibilityDescriptors.size(); i++) {
|
|
||||||
Descriptor descriptor = accessibilityDescriptors.get(i);
|
|
||||||
if ("urn:mpeg:dash:role:2011".equals(descriptor.schemeIdUri) && descriptor.value != null) {
|
|
||||||
return descriptor.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("urn:tva:metadata:cs:AudioPurposeCS:2007".equals(descriptor.schemeIdUri)) {
|
|
||||||
if ("1".equals(descriptor.value) || "2".equals(descriptor.value)) {
|
|
||||||
return descriptor.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static float parseFrameRate(XmlPullParser xpp, float defaultValue) {
|
protected static float parseFrameRate(XmlPullParser xpp, float defaultValue) {
|
||||||
float frameRate = defaultValue;
|
float frameRate = defaultValue;
|
||||||
String frameRateAttribute = xpp.getAttributeValue(null, "frameRate");
|
String frameRateAttribute = xpp.getAttributeValue(null, "frameRate");
|
||||||
|
@ -702,7 +702,9 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
|
|||||||
variantFormat.height,
|
variantFormat.height,
|
||||||
variantFormat.frameRate,
|
variantFormat.frameRate,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
variantFormat.selectionFlags);
|
variantFormat.selectionFlags,
|
||||||
|
/* role= */ C.ROLE_UNSET,
|
||||||
|
/* accessibility= */ C.ACCESSIBILITY_UNSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Format deriveAudioFormat(
|
private static Format deriveAudioFormat(
|
||||||
@ -740,7 +742,9 @@ public final class HlsMediaPeriod implements MediaPeriod, HlsSampleStreamWrapper
|
|||||||
/* sampleRate= */ Format.NO_VALUE,
|
/* sampleRate= */ Format.NO_VALUE,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
selectionFlags,
|
selectionFlags,
|
||||||
language);
|
language,
|
||||||
|
/* role= */ C.ROLE_UNSET,
|
||||||
|
/* accessibility= */ C.ACCESSIBILITY_UNSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,9 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
|||||||
height,
|
height,
|
||||||
frameRate,
|
frameRate,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
/* selectionFlags= */ 0);
|
/* selectionFlags= */ 0,
|
||||||
|
/* role= */ C.ROLE_UNSET,
|
||||||
|
/* accessibility= */ C.ACCESSIBILITY_UNSET);
|
||||||
variants.add(new HlsMasterPlaylist.HlsUrl(line, format, /* name= */ ""));
|
variants.add(new HlsMasterPlaylist.HlsUrl(line, format, /* name= */ ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,7 +363,9 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
|||||||
/* sampleRate= */ Format.NO_VALUE,
|
/* sampleRate= */ Format.NO_VALUE,
|
||||||
/* initializationData= */ null,
|
/* initializationData= */ null,
|
||||||
selectionFlags,
|
selectionFlags,
|
||||||
language);
|
language,
|
||||||
|
/* role= */ C.ROLE_UNSET,
|
||||||
|
/* accessibility= */ C.ACCESSIBILITY_UNSET);
|
||||||
if (isMediaTagMuxed(variants, uri)) {
|
if (isMediaTagMuxed(variants, uri)) {
|
||||||
muxedAudioFormat = format;
|
muxedAudioFormat = format;
|
||||||
} else {
|
} else {
|
||||||
@ -406,8 +410,8 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
|||||||
selectionFlags,
|
selectionFlags,
|
||||||
language,
|
language,
|
||||||
accessibilityChannel,
|
accessibilityChannel,
|
||||||
/* role= */ null,
|
/* role= */ C.ROLE_UNSET,
|
||||||
/* accessibility= */ null));
|
/* accessibility= */ C.ACCESSIBILITY_UNSET));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
@ -681,7 +681,9 @@ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> {
|
|||||||
height,
|
height,
|
||||||
/* frameRate= */ Format.NO_VALUE,
|
/* frameRate= */ Format.NO_VALUE,
|
||||||
codecSpecificData,
|
codecSpecificData,
|
||||||
/* selectionFlags= */ 0);
|
/* selectionFlags= */ 0,
|
||||||
|
/* role= */ C.ROLE_UNSET,
|
||||||
|
/* accessibility= */ C.ACCESSIBILITY_UNSET);
|
||||||
} else if (type == C.TRACK_TYPE_AUDIO) {
|
} else if (type == C.TRACK_TYPE_AUDIO) {
|
||||||
sampleMimeType = sampleMimeType == null ? MimeTypes.AUDIO_AAC : sampleMimeType;
|
sampleMimeType = sampleMimeType == null ? MimeTypes.AUDIO_AAC : sampleMimeType;
|
||||||
int channels = parseRequiredInt(parser, KEY_CHANNELS);
|
int channels = parseRequiredInt(parser, KEY_CHANNELS);
|
||||||
@ -705,7 +707,9 @@ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> {
|
|||||||
samplingRate,
|
samplingRate,
|
||||||
codecSpecificData,
|
codecSpecificData,
|
||||||
/* selectionFlags= */ 0,
|
/* selectionFlags= */ 0,
|
||||||
language);
|
language,
|
||||||
|
/* role= */ C.ROLE_UNSET,
|
||||||
|
/* accessibility= */ C.ACCESSIBILITY_UNSET);
|
||||||
} else if (type == C.TRACK_TYPE_TEXT) {
|
} else if (type == C.TRACK_TYPE_TEXT) {
|
||||||
String language = (String) getNormalizedAttribute(KEY_LANGUAGE);
|
String language = (String) getNormalizedAttribute(KEY_LANGUAGE);
|
||||||
format =
|
format =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user