Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b371426c authored by Gloria Wang's avatar Gloria Wang
Browse files

Add support for WV DRM

Change-Id: I0408c5e0a488f112a84337b21b0cd4613a4da461
parent a935bc46
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ extern const char *MEDIA_MIMETYPE_CONTAINER_OGG;
extern const char *MEDIA_MIMETYPE_CONTAINER_MATROSKA;
extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG2TS;

extern const char *MEDIA_MIMETYPE_CONTAINER_WVM;

}  // namespace android

#endif  // MEDIA_DEFS_H_
+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ LOCAL_SRC_FILES:= \
        TimedEventQueue.cpp               \
        Utils.cpp                         \
        WAVExtractor.cpp                  \
        WVMExtractor.cpp                  \
        avc_utils.cpp                     \
        string.cpp

+10 −3
Original line number Diff line number Diff line
@@ -416,6 +416,7 @@ void AwesomePlayer::reset_l() {
    if (mDecryptHandle != NULL) {
            mDrmManagerClient->setPlaybackStatus(mDecryptHandle,
                    Playback::STOP, 0);
            mDrmManagerClient->closeDecryptSession(mDecryptHandle);
            mDecryptHandle = NULL;
            mDrmManagerClient = NULL;
    }
@@ -1667,10 +1668,16 @@ status_t AwesomePlayer::finishSetDataSource_l() {
    }

    dataSource->getDrmInfo(&mDecryptHandle, &mDrmManagerClient);
    if (mDecryptHandle != NULL
            && RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
    if (mDecryptHandle != NULL) {
        if (RightsStatus::RIGHTS_VALID == mDecryptHandle->status) {
            if (DecryptApiType::WV_BASED == mDecryptHandle->decryptApiType) {
                LOGD("Setting mCachedSource to NULL for WVM\n");
                mCachedSource.clear();
            }
        } else {
            notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_NO_LICENSE);
        }
    }

    return setDataSource_l(extractor);
}
+9 −4
Original line number Diff line number Diff line
@@ -280,18 +280,23 @@ bool SniffDRM(
        if (gDrmManagerClient == NULL) {
            gDrmManagerClient = new DrmManagerClient();
        }

        if (gDrmManagerClient == NULL) {
            return false;
        }
    }

    DecryptHandle *decryptHandle = source->DrmInitialization(gDrmManagerClient);

    if (decryptHandle != NULL) {
        if (decryptHandle->decryptApiType == DecryptApiType::CONTAINER_BASED) {
            *mimeType = String8("drm+container_based+");
            *mimeType = String8("drm+container_based+") + decryptHandle->mimeType;
        } else if (decryptHandle->decryptApiType == DecryptApiType::ELEMENTARY_STREAM_BASED) {
            *mimeType = String8("drm+es_based+");
            *mimeType = String8("drm+es_based+") + decryptHandle->mimeType;
        } else if (decryptHandle->decryptApiType == DecryptApiType::WV_BASED) {
            *mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
            LOGW("SniffWVM: found match\n");
        }

        *mimeType += decryptHandle->mimeType;
        *confidence = 10.0f;

        return true;
+4 −3
Original line number Diff line number Diff line
@@ -55,9 +55,6 @@ FileSource::~FileSource() {
        delete[] mDrmBuf;
        mDrmBuf = NULL;
    }
    if (mDecryptHandle != NULL) {
        mDrmManagerClient->closeDecryptSession(mDecryptHandle);
    }
}

status_t FileSource::initCheck() const {
@@ -113,7 +110,11 @@ status_t FileSource::getSize(off_t *size) {
}

DecryptHandle* FileSource::DrmInitialization(DrmManagerClient* client) {
    if (client == NULL) {
        return NULL;
    }
    mDrmManagerClient = client;

    if (mDecryptHandle == NULL) {
        mDecryptHandle = mDrmManagerClient->openDecryptSession(
                mFd, mOffset, mLength);
Loading