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

Commit af42d3f9 authored by Robert Shih's avatar Robert Shih
Browse files

NdkMediaCodec: add AMediaCodec_signalEndOfInputStream

Bug: 32746065
Change-Id: I20cdb02a93dfffdb2379db885f50738fb3a502d9
parent 58207fea
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -233,6 +233,23 @@ media_status_t AMediaCodec_setInputSurface(
media_status_t AMediaCodec_setParameters(
        AMediaCodec *mData, const AMediaFormat* params);

/**
 * Signals end-of-stream on input. Equivalent to submitting an empty buffer with
 * AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM set.
 *
 * Returns AMEDIA_ERROR_INVALID_OPERATION when used with an encoder not in executing state
 * or not receiving input from a Surface created by AMediaCodec_createInputSurface or
 * AMediaCodec_createPersistentInputSurface.
 *
 * Returns the previous codec error if one exists.
 *
 * Returns AMEDIA_OK when completed succesfully.
 *
 * For more details, see the Java documentation for MediaCodec.signalEndOfInputStream.
 */
media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData);



typedef enum {
    AMEDIACODECRYPTOINFO_MODE_CLEAR = 0,
+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ typedef enum {
    AMEDIA_ERROR_UNSUPPORTED           = AMEDIA_ERROR_BASE - 2,
    AMEDIA_ERROR_INVALID_OBJECT        = AMEDIA_ERROR_BASE - 3,
    AMEDIA_ERROR_INVALID_PARAMETER     = AMEDIA_ERROR_BASE - 4,
    AMEDIA_ERROR_INVALID_OPERATION     = AMEDIA_ERROR_BASE - 5,

    AMEDIA_DRM_ERROR_BASE              = -20000,
    AMEDIA_DRM_NOT_PROVISIONED         = AMEDIA_DRM_ERROR_BASE - 1,
+16 −0
Original line number Diff line number Diff line
@@ -463,6 +463,22 @@ media_status_t AMediaCodec_setParameters(
    return translate_error(mData->mCodec->setParameters(nativeParams));
}

EXPORT
media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) {

    if (mData == NULL) {
        return AMEDIA_ERROR_INVALID_PARAMETER;
    }

    status_t err = mData->mCodec->signalEndOfInputStream();
    if (err == INVALID_OPERATION) {
        return AMEDIA_ERROR_INVALID_OPERATION;
    }

    return translate_error(err);

}

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