Merge pull request #2372 from wasabeef/dev-v2-cenc-clearkey
Added support for CENC ClearKey
This commit is contained in:
commit
7e02e58e16
@ -277,6 +277,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ClearKey DASH",
|
||||
"samples": [
|
||||
{
|
||||
"name": "Big Buck Bunny (CENC ClearKey)",
|
||||
"uri": "http://html5.cablelabs.com:8100/cenc/ck/dash.mpd",
|
||||
"extension": "mpd",
|
||||
"drm_scheme": "cenc",
|
||||
"drm_license_url": "https://wasabeef.jp/demos/cenc-ck-dash.json"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SmoothStreaming",
|
||||
"samples": [
|
||||
|
@ -267,6 +267,8 @@ public class SampleChooserActivity extends Activity {
|
||||
return C.WIDEVINE_UUID;
|
||||
case "playready":
|
||||
return C.PLAYREADY_UUID;
|
||||
case "cenc":
|
||||
return C.CENC_UUID;
|
||||
default:
|
||||
try {
|
||||
return UUID.fromString(typeString);
|
||||
|
@ -443,6 +443,12 @@ public final class C {
|
||||
*/
|
||||
public static final UUID UUID_NIL = new UUID(0L, 0L);
|
||||
|
||||
/**
|
||||
* UUID for the PSSH box and MPEG-DASH Content Protection.
|
||||
* <a href="https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html">W3C</a>.
|
||||
*/
|
||||
public static final UUID CENC_UUID = new UUID(0x1077EFECC0B24D02L, 0xACE33C1E52E2FB4BL);
|
||||
|
||||
/**
|
||||
* UUID for the Widevine DRM scheme.
|
||||
* <p></p>
|
||||
|
@ -35,6 +35,7 @@ import com.google.android.exoplayer2.drm.ExoMediaDrm.OnEventListener;
|
||||
import com.google.android.exoplayer2.drm.ExoMediaDrm.ProvisionRequest;
|
||||
import com.google.android.exoplayer2.extractor.mp4.PsshAtomUtil;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -102,6 +103,11 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
|
||||
/** Releases an existing offline license. */
|
||||
public static final int MODE_RELEASE = 3;
|
||||
|
||||
/**
|
||||
* The format to use when ClearKey encryption.
|
||||
*/
|
||||
private static final String CENC_INIT_DATA_FORMAT = "cenc";
|
||||
|
||||
private static final String TAG = "OfflineDrmSessionMngr";
|
||||
|
||||
private static final int MSG_PROVISION = 0;
|
||||
@ -339,6 +345,21 @@ public class DefaultDrmSessionManager<T extends ExoMediaCrypto> implements DrmSe
|
||||
schemeInitData = psshData;
|
||||
}
|
||||
}
|
||||
if (C.CENC_UUID.equals(uuid)) {
|
||||
// If "video/mp4" and "audio/mp4" are not supported as CENC schema, change it to "cenc".
|
||||
// Before 7.1.x in API 25, "video/mp4" and "audio/mp4" are not supported.
|
||||
if (MimeTypes.VIDEO_MP4.equals(schemeMimeType) || MimeTypes.AUDIO_MP4.equals(
|
||||
schemeMimeType)) {
|
||||
if (Util.SDK_INT >= 26) {
|
||||
// Nothing to do.
|
||||
} else if (Util.SDK_INT == 25 && !MediaDrm.isCryptoSchemeSupported(uuid,
|
||||
schemeMimeType)) {
|
||||
schemeMimeType = CENC_INIT_DATA_FORMAT;
|
||||
} else if (Util.SDK_INT <= 24) {
|
||||
schemeMimeType = CENC_INIT_DATA_FORMAT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
state = STATE_OPENING;
|
||||
openInternal(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user