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

Commit b811816e authored by Praveen Chavan's avatar Praveen Chavan Committed by Linux Build Service Account
Browse files

stagefright: Expose decoder extradata via native MediaCodec

Stash GraphicBuffer in filled output so the clients of
native MediaCodec (during surface-mode playback) can retrieve
buffer information; not limited to dimensions, color-
format, decoded YUV data (including trailing extradata)...

User Extradata can be requested by setting
"enable-extradata-user" in the configuration format.

Change-Id: Iaa49f448a9692e1c1dfe037ea71ddeef73d14d66
parent f8e6c453
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ struct MediaCodec : public AHandler {
        BUFFER_FLAG_SYNCFRAME   = 1,
        BUFFER_FLAG_CODECCONFIG = 2,
        BUFFER_FLAG_EOS         = 4,
        BUFFER_FLAG_EXTRADATA   = 0x1000,
    };

    enum {
+1 −0
Original line number Diff line number Diff line
@@ -4348,6 +4348,7 @@ bool ACodec::BaseState::onOMXFillBufferDone(

                mCodec->mPortEOS[kPortIndexOutput] = true;
            }
            info->mData->meta()->setObject("graphic-buffer", info->mGraphicBuffer);
            break;
        }

+18 −0
Original line number Diff line number Diff line
@@ -586,6 +586,24 @@ void ExtendedCodec::configureVideoDecoder(
        ALOGI("Thumbnail mode enabled.");
    }

    // MediaCodec clients can request decoder extradata by setting
    // "enable-extradata-<type>" in MediaFormat.
    // Following <type>s are supported:
    //    "user" => user-extradata
    int extraDataRequested = 0;
    if (msg->findInt32("enable-extradata-user", &extraDataRequested) &&
            extraDataRequested == 1) {
        ALOGI("[%s] User-extradata requested", componentName);
        QOMX_ENABLETYPE enableType;
        enableType.bEnable = OMX_TRUE;

        status_t err = OMXhandle->setParameter(
                nodeID, (OMX_INDEXTYPE)OMX_QcomIndexEnableExtnUserData,
                (OMX_PTR)&enableType, sizeof(enableType));
        if (err != OK) {
            ALOGW("[%s] Failed to enable user-extradata", componentName);
        }
    }
}

void ExtendedCodec::configureVideoDecoder(
+3 −0
Original line number Diff line number Diff line
@@ -712,6 +712,9 @@ bool MediaCodec::handleDequeueOutputBuffer(uint32_t replyID, bool newRequest) {
        if (omxFlags & OMX_BUFFERFLAG_EOS) {
            flags |= BUFFER_FLAG_EOS;
        }
        if (omxFlags & OMX_BUFFERFLAG_EXTRADATA) {
            flags |= BUFFER_FLAG_EXTRADATA;
        }

        response->setInt32("flags", flags);
    }