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

Commit 8c35da50 authored by Vineeta Srivastava's avatar Vineeta Srivastava
Browse files

NdkMediaCodec: Implement setOutputSurface

Change-Id: I9b493b4ff423685b67ee4292396b4388bb53a8da
parent f2e71d26
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -153,6 +153,18 @@ AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*);
 */
media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render);

/**
 * Dynamically sets the output surface of a codec.
 *
 *  This can only be used if the codec was configured with an output surface.  The
 *  new output surface should have a compatible usage type to the original output surface.
 *  E.g. codecs may not support switching from a SurfaceTexture (GPU readable) output
 *  to ImageReader (software readable) output.
 *
 * For more details, see the Java documentation for MediaCodec.setOutputSurface.
 */
media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface);

/**
 * If you are done with a buffer, use this call to update its surface timestamp
 * and return it to the codec to render it on the output surface. If you
@@ -164,7 +176,6 @@ media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool re
media_status_t AMediaCodec_releaseOutputBufferAtTime(
        AMediaCodec *mData, size_t idx, int64_t timestampNs);


typedef enum {
    AMEDIACODECRYPTOINFO_MODE_CLEAR = 0,
    AMEDIACODECRYPTOINFO_MODE_AES_CTR = 1
+9 −0
Original line number Diff line number Diff line
@@ -359,6 +359,15 @@ media_status_t AMediaCodec_releaseOutputBufferAtTime(
    return translate_error(mData->mCodec->renderOutputBufferAndRelease(idx, timestampNs));
}

EXPORT
media_status_t AMediaCodec_setOutputSurface(AMediaCodec *mData, ANativeWindow* window) {
    sp<Surface> surface = NULL;
    if (window != NULL) {
        surface = (Surface*) window;
    }
    return translate_error(mData->mCodec->setSurface(surface));
}

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