コード例 #1
0
void CSurfaceTexture::NativeGetTransformMatrix(
    /* [in] */ ArrayOf<Float>* mtxArray)
{
    android::sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    float* mtx = mtxArray->GetPayload();
    surfaceTexture->getTransformMatrix(mtx);
}
コード例 #2
0
static jint jni_eglCreateWindowSurfaceTexture(JNIEnv *_env, jobject _this, jobject display,
        jobject config, jobject native_window, jintArray attrib_list) {
    if (display == NULL || config == NULL
        || !validAttribList(_env, attrib_list)) {
        jniThrowException(_env, "java/lang/IllegalArgumentException", NULL);
        return JNI_FALSE;
    }
    EGLDisplay dpy = getDisplay(_env, display);
    EGLContext cnf = getConfig(_env, config);
    sp<ANativeWindow> window;
    if (native_window == 0) {
not_valid_surface:
        jniThrowException(_env, "java/lang/IllegalArgumentException",
                "Make sure the SurfaceTexture is valid");
        return 0;
    }
    
    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(_env, native_window));

    window = new SurfaceTextureClient(surfaceTexture);
    if (window == NULL)
        goto not_valid_surface;

    jint* base = beginNativeAttribList(_env, attrib_list);
    EGLSurface sur = eglCreateWindowSurface(dpy, cnf, window.get(), base);
    endNativeAttributeList(_env, attrib_list, base);
    return (jint)sur;
}
コード例 #3
0
void CSurfaceTexture::NativeSetDefaultBufferSize(
    /* [in] */ Int32 width,
    /* [in] */ Int32 height)
{
    android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    surfaceTexture->setDefaultBufferSize(width, height);
}
コード例 #4
0
static void SurfaceTexture_finalize(JNIEnv* env, jobject thiz)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    surfaceTexture->setFrameAvailableListener(0);
    SurfaceTexture_setFrameAvailableListener(env, thiz, 0);
    SurfaceTexture_setSurfaceTexture(env, thiz, 0);
    SurfaceTexture_setProducer(env, thiz, 0);
}
コード例 #5
0
void CSurfaceTexture::NativeFinalize()
{
    android::sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    surfaceTexture->setFrameAvailableListener(0);
    SurfaceTexture_setFrameAvailableListener(this, 0);
    SurfaceTexture_setSurfaceTexture(this, 0);
    SurfaceTexture_setProducer(this, 0);
}
コード例 #6
0
sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(
        JNIEnv* env, jobject thiz)
{
    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    sp<SurfaceTextureClient> surfaceTextureClient(surfaceTexture != NULL ?
            new SurfaceTextureClient(surfaceTexture) : NULL);
    return surfaceTextureClient;
}
コード例 #7
0
static void SurfaceTexture_getTransformMatrix(JNIEnv* env, jobject thiz,
        jfloatArray jmtx)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    float* mtx = env->GetFloatArrayElements(jmtx, NULL);
    surfaceTexture->getTransformMatrix(mtx);
    env->ReleaseFloatArrayElements(jmtx, mtx, 0);
}
コード例 #8
0
static void SurfaceTexture_releaseTexImage(JNIEnv* env, jobject thiz)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    status_t err = surfaceTexture->releaseTexImage();
    if (err == INVALID_OPERATION) {
        jniThrowException(env, IllegalStateException, "Unable to release texture contents (see "
                "logcat for details)");
    } else if (err < 0) {
        jniThrowRuntimeException(env, "Error during releaseTexImage (see logcat for details)");
    }
}
コード例 #9
0
static void Surface_initFromSurfaceTexture(
        JNIEnv* env, jobject clazz, jobject jst)
{
    sp<ISurfaceTexture> st(SurfaceTexture_getSurfaceTexture(env, jst));
    sp<Surface> surface(new Surface(st));
    if (surface == NULL) {
        jniThrowException(env, OutOfResourcesException, NULL);
        return;
    }
    setSurfaceControl(env, clazz, NULL);
    setSurface(env, clazz, surface);
}
コード例 #10
0
ECode CSurfaceTexture::NativeUpdateTexImage()
{
    android::sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    android::status_t err = surfaceTexture->updateTexImage();
    if (err == android::INVALID_OPERATION) {
        // jniThrowException(env, IllegalStateException, "Unable to update texture contents (see "
        //         "logcat for details)");
        return E_ILLEGAL_STATE_EXCEPTION;
    } else if (err < 0) {
        // jniThrowRuntimeException(env, "Error during updateTexImage (see logcat for details)");
        return E_RUNTIME_EXCEPTION;
    }
    return NOERROR;
}
コード例 #11
0
Int32 CSurfaceTexture::NativeDetachFromGLContext()
{
    android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    return surfaceTexture->detachFromContext();
}
コード例 #12
0
static jint SurfaceTexture_attachToGLContext(JNIEnv* env, jobject thiz, jint tex)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    return surfaceTexture->attachToContext((GLuint)tex);
}
コード例 #13
0
static jint SurfaceTexture_detachFromGLContext(JNIEnv* env, jobject thiz)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    return surfaceTexture->detachFromContext();
}
コード例 #14
0
void CSurfaceTexture::NativeFinalize()
{
    android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    surfaceTexture->setFrameAvailableListener(0);
    SurfaceTexture_setSurfaceTexture(this, 0);
}
コード例 #15
0
static void SurfaceTexture_setDefaultBufferSize(
        JNIEnv* env, jobject thiz, jint width, jint height) {
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    surfaceTexture->setDefaultBufferSize(width, height);
}
コード例 #16
0
static jboolean SurfaceTexture_isReleased(JNIEnv* env, jobject thiz)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    return surfaceTexture->isAbandoned();
}
コード例 #17
0
sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(JNIEnv* env, jobject thiz) {
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    sp<IGraphicBufferProducer> producer(SurfaceTexture_getProducer(env, thiz));
    sp<Surface> surfaceTextureClient(surfaceTexture != NULL ? new Surface(producer) : NULL);
    return surfaceTextureClient;
}
コード例 #18
0
void CSurfaceTexture::NativeRelease()
{
    android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    surfaceTexture->abandon();
}
コード例 #19
0
static jint SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz)
{
    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    return surfaceTexture->updateTexImage();
}
コード例 #20
0
static jlong SurfaceTexture_getTimestamp(JNIEnv* env, jobject thiz)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    return surfaceTexture->getTimestamp();
}
コード例 #21
0
void CSurfaceTexture::NativeGetTransformMatrix(
    /* [in] */ const ArrayOf<Float>& mtx)
{
    android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    surfaceTexture->getTransformMatrix(mtx.GetPayload());
}
コード例 #22
0
Int64 CSurfaceTexture::NativeGetTimestamp()
{
    android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    return surfaceTexture->getTimestamp();
}
コード例 #23
0
static void SurfaceTexture_release(JNIEnv* env, jobject thiz)
{
    sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
    surfaceTexture->abandon();
}
コード例 #24
0
Int32 CSurfaceTexture::NativeAttachToGLContext(
    /* [in] */ Int32 texName)
{
    android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this));
    return surfaceTexture->attachToContext((GLuint)texName);
}