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

Commit e299e7c7 authored by Paramananda's avatar Paramananda Committed by Ricardo Cerqueira
Browse files

frameworks/av : Drm media file uses mm-parser sniffer

-Uses qc-extended mm-parser to sniff drm media file
-Remove OmaDrmEngine support form awesomeplayer and achive
 the same from OmaDrmEngine plugin side.

Change-Id: Iea928a02f107b467ff96efa71c8bd93a69132508
parent d2612cca
Loading
Loading
Loading
Loading
+1 −19
Original line number Diff line number Diff line
@@ -238,8 +238,7 @@ AwesomePlayer::AwesomePlayer()
#ifdef MTK_HARDWARE
      mAVSyncTimeUs(-1),
#endif
      mIsFirstFrameAfterResume(false),
      mConsumeRights(true) {
      mIsFirstFrameAfterResume(false){
    CHECK_EQ(mClient.connect(), (status_t)OK);

    DataSource::RegisterDefaultSniffers();
@@ -499,9 +498,6 @@ void AwesomePlayer::checkDrmStatus(const sp<DataSource>& dataSource) {
        CHECK(mDrmManagerClient);
        if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
            notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
        } else {
            ALOGV("awesome: calling consumeRights, fd");
            mConsumeRights = true;
        }
    }
}
@@ -1065,8 +1061,6 @@ void AwesomePlayer::onStreamDone() {

        notifyListener_l(MEDIA_PLAYBACK_COMPLETE);

        mConsumeRights = true;

        pause_l(true /* at eos */);

        // If audio hasn't completed MEDIA_SEEK_COMPLETE yet,
@@ -1086,12 +1080,6 @@ status_t AwesomePlayer::play() {

    Mutex::Autolock autoLock(mLock);

    if (mDrmManagerClient && mDecryptHandle != NULL && mConsumeRights) {
        ALOGV("awesome: calling consumeRights,ap=[%p]", this);
        mDrmManagerClient->consumeRights(mDecryptHandle, Action::PLAY, true);
        mConsumeRights = false;
    }

    modifyFlags(CACHE_UNDERRUN, CLEAR);

    return play_l();
@@ -1569,9 +1557,6 @@ status_t AwesomePlayer::pause() {
    Mutex::Autolock autoLock(mLock);

    modifyFlags(CACHE_UNDERRUN, CLEAR);
    if (mDecryptHandle != NULL) {
        mConsumeRights = false;
    }

    return pause_l();
}
@@ -1818,9 +1803,6 @@ status_t AwesomePlayer::seekTo_l(int64_t timeUs) {
    }

    if (!(mFlags & PLAYING)) {
        if (mDecryptHandle != NULL) {
            mConsumeRights = false;
        }
        ALOGV("seeking while paused, sending SEEK_COMPLETE notification"
             " immediately.");

+5 −3
Original line number Diff line number Diff line
@@ -272,14 +272,16 @@ sp<MetaData> DRMExtractor::getMetaData() {
bool SniffDRM(
    const sp<DataSource> &source, String8 *mimeType, float *confidence,
        sp<AMessage> *) {
    sp<DecryptHandle> decryptHandle = source->DrmInitialization();
    DrmManagerClient *drmManagerClient;
    sp<DecryptHandle> decryptHandle;
    source->getDrmInfo(decryptHandle, &drmManagerClient);

    if (decryptHandle != NULL) {
        if (decryptHandle->decryptApiType == DecryptApiType::CONTAINER_BASED) {
            *mimeType = String8("drm+container_based+") + decryptHandle->mimeType;
            *mimeType = String8("drm+container_based+");
            *confidence = 10.0f;
        } else if (decryptHandle->decryptApiType == DecryptApiType::ELEMENTARY_STREAM_BASED) {
            *mimeType = String8("drm+es_based+") + decryptHandle->mimeType;
            *mimeType = String8("drm+es_based+");
            *confidence = 10.0f;
        } else {
            return false;
+17 −1
Original line number Diff line number Diff line
@@ -165,6 +165,13 @@ bool Sniffer::sniff(
    *confidence = 0.0f;
    meta->clear();

    sp<DecryptHandle> decryptHandle = NULL;
    char value[PROPERTY_VALUE_MAX];
    if (property_get("drm.service.enabled", value, NULL)
            && (!strcmp(value, "1") || !strcasecmp(value, "true"))) {
         decryptHandle = source->DrmInitialization();
    }

    Mutex::Autolock autoLock(mSnifferMutex);
    for (List<SnifferFunc>::iterator it = mSniffers.begin();
         it != mSniffers.end(); ++it) {
@@ -173,7 +180,16 @@ bool Sniffer::sniff(
        sp<AMessage> newMeta;
        if ((*it)(source, &newMimeType, &newConfidence, &newMeta)) {
            if (newConfidence > *confidence) {
                if (!strncmp(newMimeType, "drm+es_based+", 13)
                        || !strncmp(newMimeType, "drm+container_based+", 20)) {
                    if (!strncmp(mimeType->string(), "", 1) && decryptHandle != NULL) {
                        *mimeType = newMimeType + decryptHandle->mimeType;
                    } else {
                        *mimeType = newMimeType + mimeType->string();
                    }
                } else {
                    *mimeType = newMimeType;
                }
                *confidence = newConfidence;
                *meta = newMeta;
            }
+9 −8
Original line number Diff line number Diff line
@@ -135,6 +135,10 @@ retry:
        ret = sPlugin.create(source, mime, meta);
    }

#ifdef QCOM_HARDWARE
    ret = ExtendedUtils::MediaExtractor_CreateIfNeeded(ret, source, mime);
#endif

    if (ret != NULL) {
        if (isDrm) {
            ret->setDrmFlag(true);
@@ -143,9 +147,6 @@ retry:
        }
    }

#ifdef QCOM_HARDWARE
    ret = ExtendedUtils::MediaExtractor_CreateIfNeeded(ret, source, mime);
#endif

    if (ret != NULL) {

+0 −1
Original line number Diff line number Diff line
@@ -404,7 +404,6 @@ private:
    bool    mAudioTearDown;
    bool    mAudioTearDownWasPlaying;
    int64_t mAudioTearDownPosition;
    bool mConsumeRights;
    status_t setVideoScalingMode(int32_t mode);
    status_t setVideoScalingMode_l(int32_t mode);
    status_t getTrackInfo(Parcel* reply) const;