Search in sources :

Example 11 with DrmInitData

use of com.google.android.exoplayer2.drm.DrmInitData in project ExoPlayer by google.

the class DefaultDrmSessionManager method acquireSession.

// DrmSessionManager implementation.
@Override
public DrmSession<T> acquireSession(Looper playbackLooper, DrmInitData drmInitData) {
    Assertions.checkState(this.playbackLooper == null || this.playbackLooper == playbackLooper);
    if (++openCount != 1) {
        return this;
    }
    if (this.playbackLooper == null) {
        this.playbackLooper = playbackLooper;
        mediaDrmHandler = new MediaDrmHandler(playbackLooper);
        postResponseHandler = new PostResponseHandler(playbackLooper);
    }
    requestHandlerThread = new HandlerThread("DrmRequestHandler");
    requestHandlerThread.start();
    postRequestHandler = new PostRequestHandler(requestHandlerThread.getLooper());
    if (offlineLicenseKeySetId == null) {
        SchemeData schemeData = drmInitData.get(uuid);
        if (schemeData == null) {
            onError(new IllegalStateException("Media does not support uuid: " + uuid));
            return this;
        }
        schemeInitData = schemeData.data;
        schemeMimeType = schemeData.mimeType;
        if (Util.SDK_INT < 21) {
            // Prior to L the Widevine CDM required data to be extracted from the PSSH atom.
            byte[] psshData = PsshAtomUtil.parseSchemeSpecificData(schemeInitData, C.WIDEVINE_UUID);
            if (psshData == null) {
            // Extraction failed. schemeData isn't a Widevine PSSH atom, so leave it unchanged.
            } else {
                schemeInitData = psshData;
            }
        }
        if (Util.SDK_INT < 26 && C.CLEARKEY_UUID.equals(uuid) && (MimeTypes.VIDEO_MP4.equals(schemeMimeType) || MimeTypes.AUDIO_MP4.equals(schemeMimeType))) {
            // Prior to API level 26 the ClearKey CDM only accepted "cenc" as the scheme for MP4.
            schemeMimeType = CENC_SCHEME_MIME_TYPE;
        }
    }
    state = STATE_OPENING;
    openInternal(true);
    return this;
}
Also used : HandlerThread(android.os.HandlerThread) SchemeData(com.google.android.exoplayer2.drm.DrmInitData.SchemeData)

Example 12 with DrmInitData

use of com.google.android.exoplayer2.drm.DrmInitData in project ExoPlayer by google.

the class OfflineLicenseHelper method blockingKeyRequest.

private void blockingKeyRequest(@Mode int licenseMode, byte[] offlineLicenseKeySetId, DrmInitData drmInitData) throws DrmSessionException {
    DrmSession<T> session = openBlockingKeyRequest(licenseMode, offlineLicenseKeySetId, drmInitData);
    DrmSessionException error = session.getError();
    if (error != null) {
        throw error;
    }
    drmSessionManager.releaseSession(session);
}
Also used : DrmSessionException(com.google.android.exoplayer2.drm.DrmSession.DrmSessionException)

Example 13 with DrmInitData

use of com.google.android.exoplayer2.drm.DrmInitData in project ExoPlayer by google.

the class Format method copyWithManifestFormatInfo.

public Format copyWithManifestFormatInfo(Format manifestFormat) {
    if (this == manifestFormat) {
        // No need to copy from ourselves.
        return this;
    }
    String id = manifestFormat.id;
    String codecs = this.codecs == null ? manifestFormat.codecs : this.codecs;
    int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
    float frameRate = this.frameRate == NO_VALUE ? manifestFormat.frameRate : this.frameRate;
    @C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
    String language = this.language == null ? manifestFormat.language : this.language;
    DrmInitData drmInitData = manifestFormat.drmInitData != null ? manifestFormat.drmInitData : this.drmInitData;
    return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, projectionData, stereoMode, channelCount, sampleRate, pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, accessibilityChannel, subsampleOffsetUs, initializationData, drmInitData, metadata);
}
Also used : DrmInitData(com.google.android.exoplayer2.drm.DrmInitData) MediaFormat(android.media.MediaFormat) SuppressLint(android.annotation.SuppressLint)

Aggregations

DrmInitData (com.google.android.exoplayer2.drm.DrmInitData)8 SchemeData (com.google.android.exoplayer2.drm.DrmInitData.SchemeData)4 SuppressLint (android.annotation.SuppressLint)2 MediaFormat (android.media.MediaFormat)2 Format (com.google.android.exoplayer2.Format)2 LeafAtom (com.google.android.exoplayer2.extractor.mp4.Atom.LeafAtom)2 Point (android.graphics.Point)1 HandlerThread (android.os.HandlerThread)1 Parcel (android.os.Parcel)1 SparseArray (android.util.SparseArray)1 ParserException (com.google.android.exoplayer2.ParserException)1 DrmSessionException (com.google.android.exoplayer2.drm.DrmSession.DrmSessionException)1 ContainerAtom (com.google.android.exoplayer2.extractor.mp4.Atom.ContainerAtom)1 MediaCodecInfo (com.google.android.exoplayer2.mediacodec.MediaCodecInfo)1 Metadata (com.google.android.exoplayer2.metadata.Metadata)1 TextInformationFrame (com.google.android.exoplayer2.metadata.id3.TextInformationFrame)1 AdaptationSet (com.google.android.exoplayer2.source.dash.manifest.AdaptationSet)1 Period (com.google.android.exoplayer2.source.dash.manifest.Period)1 Representation (com.google.android.exoplayer2.source.dash.manifest.Representation)1 ParsableBitArray (com.google.android.exoplayer2.util.ParsableBitArray)1