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

Commit f373e84c authored by Praveen Chavan's avatar Praveen Chavan Committed by Lajos Molnar
Browse files

NdkMediaCodec: implement setParameters to signal dynamic parameters

Add setParameters to communicate parameter changes when the codec
is in running state.

Bug: 32746065
Change-Id: I223041bebadedfb09848315a360b5efaae451c14
parent 85a53633
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -222,6 +222,16 @@ media_status_t AMediaCodec_createPersistentInputSurface(
media_status_t AMediaCodec_setInputSurface(
        AMediaCodec *mData, ANativeWindow *surface);

/**
 * Signal additional parameters to the codec instance.
 *
 * Parameters can be communicated only when the codec is running, i.e
 * after AMediaCodec_start() has been called.
 *
 * NOTE: Some of these parameter changes may silently fail to apply.
 */
media_status_t AMediaCodec_setParameters(
        AMediaCodec *mData, const AMediaFormat* params);


typedef enum {
+13 −0
Original line number Diff line number Diff line
@@ -450,6 +450,19 @@ media_status_t AMediaCodec_setInputSurface(
            aMediaPersistentSurface->mPersistentSurface));
}

EXPORT
media_status_t AMediaCodec_setParameters(
        AMediaCodec *mData, const AMediaFormat* params) {
    if (params == NULL || mData == NULL) {
        return AMEDIA_ERROR_INVALID_PARAMETER;
    }
    sp<AMessage> nativeParams;
    AMediaFormat_getFormat(params, &nativeParams);
    ALOGV("setParameters: %s", nativeParams->debugString(0).c_str());

    return translate_error(mData->mCodec->setParameters(nativeParams));
}

//EXPORT
media_status_t AMediaCodec_setNotificationCallback(AMediaCodec *mData, OnCodecEvent callback,
        void *userdata) {