summaryrefslogtreecommitdiffstats
path: root/core/jni/android
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2011-02-18 11:02:42 -0800
committerEino-Ville Talvala <etalvala@google.com>2011-03-17 13:10:03 -0700
commitc5f94d8a4779050125145396ca83fbc862c7ed6b (patch)
tree83d016c9670032683faa39fda755b236a9010954 /core/jni/android
parent262564df9613e8950fb3828ecc6dfffe79cc1b31 (diff)
downloadframeworks_base-c5f94d8a4779050125145396ca83fbc862c7ed6b.zip
frameworks_base-c5f94d8a4779050125145396ca83fbc862c7ed6b.tar.gz
frameworks_base-c5f94d8a4779050125145396ca83fbc862c7ed6b.tar.bz2
Add support for timestamps into SurfaceTexture.
API addition: The timestamps are represented as nanoseconds from some arbitrary time point. Like the SurfaceTexture transform matrix, the timestamp retrieved by getTimestamp is for the last frame sent to the GL texture using updateTexImage(). Camera HAL change: Expect vendors to set these timestamps using native_window_set_buffers_timestamp(). For now, they are autogenerated by SurfaceTextureClient if set_buffers_timestamp() is never called, but such timing is likely not accurate enough to pass a CTS test. bug:3300707 Change-Id: Ife131a0c2a826ac27342e11b8a6c42ff49e1bea7
Diffstat (limited to 'core/jni/android')
-rw-r--r--core/jni/android/graphics/SurfaceTexture.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp
index c4e5878..2f70190 100644
--- a/core/jni/android/graphics/SurfaceTexture.cpp
+++ b/core/jni/android/graphics/SurfaceTexture.cpp
@@ -171,6 +171,12 @@ static void SurfaceTexture_getTransformMatrix(JNIEnv* env, jobject thiz,
env->ReleaseFloatArrayElements(jmtx, mtx, 0);
}
+static jlong SurfaceTexture_getTimestamp(JNIEnv* env, jobject thiz)
+{
+ sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ return surfaceTexture->getTimestamp();
+}
+
// ----------------------------------------------------------------------------
const char* const kSurfaceTextureClassPathName = "android/graphics/SurfaceTexture";
@@ -178,9 +184,10 @@ const char* const kSurfaceTextureClassPathName = "android/graphics/SurfaceTextur
static JNINativeMethod gSurfaceTextureMethods[] = {
{"nativeClassInit", "()V", (void*)SurfaceTexture_classInit },
{"nativeInit", "(ILjava/lang/Object;)V", (void*)SurfaceTexture_init },
- {"nativeFinalize", "()V", (void*)SurfaceTexture_finalize },
+ {"nativeFinalize", "()V", (void*)SurfaceTexture_finalize },
{"nativeUpdateTexImage", "()V", (void*)SurfaceTexture_updateTexImage },
{"nativeGetTransformMatrix", "([F)V", (void*)SurfaceTexture_getTransformMatrix },
+ {"nativeGetTimestamp", "()J", (void*)SurfaceTexture_getTimestamp }
};
int register_android_graphics_SurfaceTexture(JNIEnv* env)