diff options
author | Tyler Luu <tluu@ti.com> | 2012-08-02 19:02:02 -0500 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-10-10 18:55:47 +0300 |
commit | f2892abee8eaa9c656ff206bd7a8ca6c2a81566b (patch) | |
tree | c9b4c5aa8e8629db32fdabc04f9fa616117cc251 | |
parent | 5e4549a19a15425af8f95c4260c19818ed789caa (diff) | |
download | hardware_ti_omap4-f2892abee8eaa9c656ff206bd7a8ca6c2a81566b.zip hardware_ti_omap4-f2892abee8eaa9c656ff206bd7a8ca6c2a81566b.tar.gz hardware_ti_omap4-f2892abee8eaa9c656ff206bd7a8ca6c2a81566b.tar.bz2 |
CPCam: Change setBufferSource to use CPCamMetadata
This patch changes setBufferSource to take CPCamMetadata as input
instead of SurfaceTexture. As a result, since SurfaceTexture will no
longer be used, we are also removing CPCamSurfaceTextureCreator
Change-Id: I2d196b9d76f848c1fe274e980d013fd5ca8c82ac
Signed-off-by: Tyler Luu <tluu@ti.com>
-rw-r--r-- | cpcam/java/com/ti/omap/android/cpcam/CPCam.java | 2 | ||||
-rw-r--r-- | cpcam/java/com/ti/omap/android/cpcam/CPCamSurfaceTextureCreator.java | 43 | ||||
-rw-r--r-- | cpcam/jni/com_ti_omap_android_cpcam_CPCam.cpp | 16 |
3 files changed, 14 insertions, 47 deletions
diff --git a/cpcam/java/com/ti/omap/android/cpcam/CPCam.java b/cpcam/java/com/ti/omap/android/cpcam/CPCam.java index 140903f..fde817b 100644 --- a/cpcam/java/com/ti/omap/android/cpcam/CPCam.java +++ b/cpcam/java/com/ti/omap/android/cpcam/CPCam.java @@ -413,7 +413,7 @@ public class CPCam { * @throws IOException if the method fails (for example, if the surface * texture is unavailable or unsuitable). */ - public native final void setBufferSource(SurfaceTexture tapIn, SurfaceTexture tapOut) throws IOException; + public native final void setBufferSource(CPCamBufferQueue tapIn, CPCamBufferQueue tapOut) throws IOException; /** * Sets the {@link SurfaceTexture} to be used for tap-out. diff --git a/cpcam/java/com/ti/omap/android/cpcam/CPCamSurfaceTextureCreator.java b/cpcam/java/com/ti/omap/android/cpcam/CPCamSurfaceTextureCreator.java deleted file mode 100644 index ad37d6a..0000000 --- a/cpcam/java/com/ti/omap/android/cpcam/CPCamSurfaceTextureCreator.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.ti.omap.android.cpcam; - -import android.graphics.SurfaceTexture; -import javax.microedition.khronos.egl.EGL10; - -public class CPCamSurfaceTextureCreator { - - public static SurfaceTexture createCPCamSurfaceTexture(int texName) { - return new SurfaceTexture(texName, false, EGL10.EGL_NONE); - } -} diff --git a/cpcam/jni/com_ti_omap_android_cpcam_CPCam.cpp b/cpcam/jni/com_ti_omap_android_cpcam_CPCam.cpp index 4a7ddf6..bd2105a 100644 --- a/cpcam/jni/com_ti_omap_android_cpcam_CPCam.cpp +++ b/cpcam/jni/com_ti_omap_android_cpcam_CPCam.cpp @@ -81,6 +81,7 @@ struct fields_t { jfieldID analog_gain; jfieldID faces; jmethodID metadata_constructor; + jfieldID bufferQueue; }; static fields_t fields; @@ -545,6 +546,15 @@ static void com_ti_omap_android_cpcam_CPCam_native_setup(JNIEnv *env, jobject th // save context in opaque field env->SetIntField(thiz, fields.context, (int)context.get()); + + // Fill bufferQueue field since CPCamBufferQueue should be loaded by now + clazz = env->FindClass("com/ti/omap/android/cpcam/CPCamBufferQueue"); + fields.bufferQueue = env->GetFieldID(clazz, "mBufferQueue", "I"); + if (fields.bufferQueue == NULL) { + CAMHAL_LOGE("Can't find com/ti/omap/android/cpcam/CPCamBufferQueue.mBufferQueue"); + jniThrowRuntimeException(env, "Can't find com/ti/omap/android/cpcam/CPCamBufferQueue.mBufferQueue"); + } + } // disconnect from camera service @@ -637,7 +647,7 @@ static void com_ti_omap_android_cpcam_CPCam_setBufferSource(JNIEnv *env, sp<PREVIEW_TEXTURE_TYPE> tapOut = NULL; if (jTapOut!= NULL) { tapOut = reinterpret_cast<PREVIEW_TEXTURE_TYPE *>(env->GetIntField( - jTapOut, fields.surfaceTexture)); + jTapOut, fields.bufferQueue)); if (tapOut == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", "SurfaceTexture already released in setPreviewTexture"); @@ -648,7 +658,7 @@ static void com_ti_omap_android_cpcam_CPCam_setBufferSource(JNIEnv *env, sp<PREVIEW_TEXTURE_TYPE> tapIn = NULL; if (jTapIn != NULL) { tapIn = reinterpret_cast<PREVIEW_TEXTURE_TYPE *>(env->GetIntField( - jTapIn, fields.surfaceTexture)); + jTapIn, fields.bufferQueue)); if (tapIn == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", "SurfaceTexture already released in setPreviewTexture"); @@ -962,7 +972,7 @@ static JNINativeMethod cpcamMethods[] = { "(Landroid/graphics/SurfaceTexture;)V", (void *)com_ti_omap_android_cpcam_CPCam_setPreviewTexture }, { "setBufferSource", - "(Landroid/graphics/SurfaceTexture;Landroid/graphics/SurfaceTexture;)V", + "(Lcom/ti/omap/android/cpcam/CPCamBufferQueue;Lcom/ti/omap/android/cpcam/CPCamBufferQueue;)V", (void *)com_ti_omap_android_cpcam_CPCam_setBufferSource }, { "native_reprocess", "(ILjava/lang/String;)V", |