void CSurfaceTexture::NativeGetTransformMatrix( /* [in] */ ArrayOf<Float>* mtxArray) { android::sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); float* mtx = mtxArray->GetPayload(); surfaceTexture->getTransformMatrix(mtx); }
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; }
void CSurfaceTexture::NativeSetDefaultBufferSize( /* [in] */ Int32 width, /* [in] */ Int32 height) { android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); surfaceTexture->setDefaultBufferSize(width, height); }
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); }
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); }
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; }
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); }
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)"); } }
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); }
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; }
Int32 CSurfaceTexture::NativeDetachFromGLContext() { android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); return surfaceTexture->detachFromContext(); }
static jint SurfaceTexture_attachToGLContext(JNIEnv* env, jobject thiz, jint tex) { sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->attachToContext((GLuint)tex); }
static jint SurfaceTexture_detachFromGLContext(JNIEnv* env, jobject thiz) { sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->detachFromContext(); }
void CSurfaceTexture::NativeFinalize() { android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); surfaceTexture->setFrameAvailableListener(0); SurfaceTexture_setSurfaceTexture(this, 0); }
static void SurfaceTexture_setDefaultBufferSize( JNIEnv* env, jobject thiz, jint width, jint height) { sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); surfaceTexture->setDefaultBufferSize(width, height); }
static jboolean SurfaceTexture_isReleased(JNIEnv* env, jobject thiz) { sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->isAbandoned(); }
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; }
void CSurfaceTexture::NativeRelease() { android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); surfaceTexture->abandon(); }
static jint SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz) { sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->updateTexImage(); }
static jlong SurfaceTexture_getTimestamp(JNIEnv* env, jobject thiz) { sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->getTimestamp(); }
void CSurfaceTexture::NativeGetTransformMatrix( /* [in] */ const ArrayOf<Float>& mtx) { android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); surfaceTexture->getTransformMatrix(mtx.GetPayload()); }
Int64 CSurfaceTexture::NativeGetTimestamp() { android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); return surfaceTexture->getTimestamp(); }
static void SurfaceTexture_release(JNIEnv* env, jobject thiz) { sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); surfaceTexture->abandon(); }
Int32 CSurfaceTexture::NativeAttachToGLContext( /* [in] */ Int32 texName) { android::sp<android::SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(this)); return surfaceTexture->attachToContext((GLuint)texName); }