DASH: Support mspr:pro element
Issue: #2386 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=147725616
This commit is contained in:
parent
65d4b1cf5c
commit
0d468ca7bf
@ -335,30 +335,35 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
*/
|
*/
|
||||||
protected SchemeData parseContentProtection(XmlPullParser xpp) throws XmlPullParserException,
|
protected SchemeData parseContentProtection(XmlPullParser xpp) throws XmlPullParserException,
|
||||||
IOException {
|
IOException {
|
||||||
|
String schemeIdUri = xpp.getAttributeValue(null, "schemeIdUri");
|
||||||
|
boolean isPlayReady = "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95".equals(schemeIdUri);
|
||||||
byte[] data = null;
|
byte[] data = null;
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
boolean seenPsshElement = false;
|
|
||||||
boolean requiresSecureDecoder = false;
|
boolean requiresSecureDecoder = false;
|
||||||
do {
|
do {
|
||||||
xpp.next();
|
xpp.next();
|
||||||
|
if (data == null && XmlPullParserUtil.isStartTag(xpp, "cenc:pssh")
|
||||||
|
&& xpp.next() == XmlPullParser.TEXT) {
|
||||||
// The cenc:pssh element is defined in 23001-7:2015.
|
// The cenc:pssh element is defined in 23001-7:2015.
|
||||||
if (XmlPullParserUtil.isStartTag(xpp, "cenc:pssh") && xpp.next() == XmlPullParser.TEXT) {
|
|
||||||
seenPsshElement = true;
|
|
||||||
data = Base64.decode(xpp.getText(), Base64.DEFAULT);
|
|
||||||
uuid = PsshAtomUtil.parseUuid(data);
|
uuid = PsshAtomUtil.parseUuid(data);
|
||||||
|
if (uuid == null) {
|
||||||
|
Log.w(TAG, "Skipping malformed cenc:pssh data");
|
||||||
|
} else {
|
||||||
|
data = Base64.decode(xpp.getText(), Base64.DEFAULT);
|
||||||
|
}
|
||||||
|
} else if (data == null && isPlayReady && XmlPullParserUtil.isStartTag(xpp, "mspr:pro")
|
||||||
|
&& xpp.next() == XmlPullParser.TEXT) {
|
||||||
|
// The mspr:pro element is defined in DASH Content Protection using Microsoft PlayReady.
|
||||||
|
uuid = C.PLAYREADY_UUID;
|
||||||
|
data = PsshAtomUtil.buildPsshAtom(C.PLAYREADY_UUID,
|
||||||
|
Base64.decode(xpp.getText(), Base64.DEFAULT));
|
||||||
} else if (XmlPullParserUtil.isStartTag(xpp, "widevine:license")) {
|
} else if (XmlPullParserUtil.isStartTag(xpp, "widevine:license")) {
|
||||||
String robustnessLevel = xpp.getAttributeValue(null, "robustness_level");
|
String robustnessLevel = xpp.getAttributeValue(null, "robustness_level");
|
||||||
requiresSecureDecoder = robustnessLevel != null && robustnessLevel.startsWith("HW");
|
requiresSecureDecoder = robustnessLevel != null && robustnessLevel.startsWith("HW");
|
||||||
}
|
}
|
||||||
} while (!XmlPullParserUtil.isEndTag(xpp, "ContentProtection"));
|
} while (!XmlPullParserUtil.isEndTag(xpp, "ContentProtection"));
|
||||||
if (!seenPsshElement) {
|
return data != null ? new SchemeData(uuid, MimeTypes.VIDEO_MP4, data, requiresSecureDecoder)
|
||||||
return null;
|
: null;
|
||||||
} else if (uuid != null) {
|
|
||||||
return new SchemeData(uuid, MimeTypes.VIDEO_MP4, data, requiresSecureDecoder);
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Skipped unsupported ContentProtection element");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user