diff options
author | Ted Bonkenburg <tedbo@google.com> | 2011-07-26 09:51:18 -0700 |
---|---|---|
committer | Ted Bonkenburg <tedbo@google.com> | 2011-08-11 19:58:25 -0700 |
commit | 1ee60119c4fa51ebfa781cf5fdc33f192e8551b8 (patch) | |
tree | 2fb0ce22107a1d3f0c73f3bd5d63a877f5a16d44 /core/jni/android | |
parent | 61bb11cfa03abc345f27ec14f63929b6f600edff (diff) | |
download | frameworks_base-1ee60119c4fa51ebfa781cf5fdc33f192e8551b8.zip frameworks_base-1ee60119c4fa51ebfa781cf5fdc33f192e8551b8.tar.gz frameworks_base-1ee60119c4fa51ebfa781cf5fdc33f192e8551b8.tar.bz2 |
Remove ParcelSurfaceTexture and update MediaPlayer
This removes the ParcelSurfaceTexture class since that functionality has been
folded into Surface.java. The change also updates the MediaPlayer to get rid
of setParcelSurfaceTexture() and modifies setTexture() to use the new Surface
functionality in order to simplify the code.
Change-Id: Iafa75ea3188263928128325d8a726786971b4de4
Diffstat (limited to 'core/jni/android')
-rw-r--r-- | core/jni/android/graphics/ParcelSurfaceTexture.cpp | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/core/jni/android/graphics/ParcelSurfaceTexture.cpp b/core/jni/android/graphics/ParcelSurfaceTexture.cpp deleted file mode 100644 index 754485f..0000000 --- a/core/jni/android/graphics/ParcelSurfaceTexture.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "ParcelSurfaceTexture" - -#include <gui/SurfaceTextureClient.h> -#include <surfaceflinger/Surface.h> - -#include <android_runtime/AndroidRuntime.h> -#include <android_runtime/android_graphics_SurfaceTexture.h> -#include <android_runtime/android_view_Surface.h> - -#include <utils/Log.h> - -#include <binder/Parcel.h> - -#include "android_util_Binder.h" -#include "jni.h" -#include "JNIHelp.h" - -// ---------------------------------------------------------------------------- - -namespace android { - -const char* const kParcelSurfaceTextureClassPathName = - "android/graphics/ParcelSurfaceTexture"; - -struct fields_t { - jfieldID iSurfaceTexture; -}; -static fields_t fields; - -#define ANDROID_GRAPHICS_ISURFACETEXTURE_JNI_ID "mISurfaceTexture" - -// ---------------------------------------------------------------------------- - -static void ParcelSurfaceTexture_setISurfaceTexture( - JNIEnv* env, jobject thiz, const sp<ISurfaceTexture>& iSurfaceTexture) -{ - ISurfaceTexture* const p = - (ISurfaceTexture*)env->GetIntField(thiz, fields.iSurfaceTexture); - if (iSurfaceTexture.get()) { - iSurfaceTexture->incStrong(thiz); - } - if (p) { - p->decStrong(thiz); - } - env->SetIntField(thiz, fields.iSurfaceTexture, (int)iSurfaceTexture.get()); -} - -sp<ISurfaceTexture> ParcelSurfaceTexture_getISurfaceTexture( - JNIEnv* env, jobject thiz) -{ - sp<ISurfaceTexture> iSurfaceTexture( - (ISurfaceTexture*)env->GetIntField(thiz, fields.iSurfaceTexture)); - return iSurfaceTexture; -} - -sp<ANativeWindow> android_ParcelSurfaceTexture_getNativeWindow( - JNIEnv* env, jobject thiz) -{ - sp<ISurfaceTexture> iSurfaceTexture( - ParcelSurfaceTexture_getISurfaceTexture(env, thiz)); - sp<SurfaceTextureClient> surfaceTextureClient(iSurfaceTexture != NULL ? - new SurfaceTextureClient(iSurfaceTexture) : NULL); - return surfaceTextureClient; -} - -bool android_ParcelSurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz) -{ - jclass parcelSurfaceTextureClass = env->FindClass( - kParcelSurfaceTextureClassPathName); - return env->IsInstanceOf(thiz, parcelSurfaceTextureClass); -} - -// ---------------------------------------------------------------------------- - -static void ParcelSurfaceTexture_classInit(JNIEnv* env, jclass clazz) -{ - fields.iSurfaceTexture = - env->GetFieldID(clazz, ANDROID_GRAPHICS_ISURFACETEXTURE_JNI_ID, "I"); - if (fields.iSurfaceTexture == NULL) { - LOGE("can't find android/graphics/ParcelSurfaceTexture.%s", - ANDROID_GRAPHICS_ISURFACETEXTURE_JNI_ID); - } -} - -static void ParcelSurfaceTexture_initFromSurface( - JNIEnv* env, jobject thiz, jobject jSurface) -{ - sp<Surface> surface(Surface_getSurface(env, jSurface)); - sp<ISurfaceTexture> iSurfaceTexture(surface->getSurfaceTexture()); - ParcelSurfaceTexture_setISurfaceTexture(env, thiz, iSurfaceTexture); -} - -static void ParcelSurfaceTexture_initFromSurfaceTexture( - JNIEnv* env, jobject thiz, jobject jSurfaceTexture) -{ - sp<ISurfaceTexture> iSurfaceTexture( - SurfaceTexture_getSurfaceTexture(env, jSurfaceTexture)); - ParcelSurfaceTexture_setISurfaceTexture(env, thiz, iSurfaceTexture); -} - -static void ParcelSurfaceTexture_finalize(JNIEnv* env, jobject thiz) -{ - ParcelSurfaceTexture_setISurfaceTexture(env, thiz, 0); -} - -static void ParcelSurfaceTexture_writeToParcel( - JNIEnv* env, jobject thiz, jobject jParcel, jint flags) -{ - Parcel* parcel = parcelForJavaObject(env, jParcel); - sp<ISurfaceTexture> iSurfaceTexture( - ParcelSurfaceTexture_getISurfaceTexture(env, thiz)); - sp<IBinder> b(iSurfaceTexture->asBinder()); - parcel->writeStrongBinder(b); -} - -static void ParcelSurfaceTexture_readFromParcel( - JNIEnv* env, jobject thiz, jobject jParcel) -{ - Parcel* parcel = parcelForJavaObject(env, jParcel); - sp<ISurfaceTexture> iSurfaceTexture( - interface_cast<ISurfaceTexture>(parcel->readStrongBinder())); - ParcelSurfaceTexture_setISurfaceTexture(env, thiz, iSurfaceTexture); -} - -// ---------------------------------------------------------------------------- - -static JNINativeMethod gParcelSurfaceTextureMethods[] = { - {"nativeClassInit", "()V", (void*)ParcelSurfaceTexture_classInit }, - {"nativeInitFromSurface", "(Landroid/view/Surface;)V", - (void *)ParcelSurfaceTexture_initFromSurface }, - {"nativeInitFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)V", - (void *)ParcelSurfaceTexture_initFromSurfaceTexture }, - { "nativeFinalize", "()V", (void *)ParcelSurfaceTexture_finalize }, - { "nativeWriteToParcel", "(Landroid/os/Parcel;I)V", - (void *)ParcelSurfaceTexture_writeToParcel }, - { "nativeReadFromParcel", "(Landroid/os/Parcel;)V", - (void *)ParcelSurfaceTexture_readFromParcel }, -}; - - -int register_android_graphics_ParcelSurfaceTexture(JNIEnv* env) -{ - int err = 0; - err = AndroidRuntime::registerNativeMethods(env, kParcelSurfaceTextureClassPathName, - gParcelSurfaceTextureMethods, NELEM(gParcelSurfaceTextureMethods)); - return err; -} - -} // namespace android |