diff options
author | Andy McFadden <fadden@android.com> | 2012-12-18 09:48:38 -0800 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2012-12-18 11:22:21 -0800 |
commit | d47f7d8b5fe3a3861d7cbdc5f912235407823c8e (patch) | |
tree | b4c4e636bac379ded38550ade39e39c2d86467ea | |
parent | 4e7ec240cabbdf3ac9776a691be0a46ea4e2e69e (diff) | |
download | frameworks_base-d47f7d8b5fe3a3861d7cbdc5f912235407823c8e.zip frameworks_base-d47f7d8b5fe3a3861d7cbdc5f912235407823c8e.tar.gz frameworks_base-d47f7d8b5fe3a3861d7cbdc5f912235407823c8e.tar.bz2 |
Rename ISurfaceTexture and SurfaceTexture
The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.
Bug 7736700
Change-Id: I08e677faf2ebb418ef131d0a8008e01037db0e50
20 files changed, 88 insertions, 88 deletions
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp index 3315045..f8715fe 100644 --- a/core/jni/android/graphics/SurfaceTexture.cpp +++ b/core/jni/android/graphics/SurfaceTexture.cpp @@ -18,7 +18,7 @@ #include <stdio.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <gui/SurfaceTextureClient.h> #include <android_runtime/AndroidRuntime.h> @@ -48,10 +48,10 @@ static fields_t fields; // ---------------------------------------------------------------------------- static void SurfaceTexture_setSurfaceTexture(JNIEnv* env, jobject thiz, - const sp<SurfaceTexture>& surfaceTexture) + const sp<GLConsumer>& surfaceTexture) { - SurfaceTexture* const p = - (SurfaceTexture*)env->GetIntField(thiz, fields.surfaceTexture); + GLConsumer* const p = + (GLConsumer*)env->GetIntField(thiz, fields.surfaceTexture); if (surfaceTexture.get()) { surfaceTexture->incStrong(thiz); } @@ -62,10 +62,10 @@ static void SurfaceTexture_setSurfaceTexture(JNIEnv* env, jobject thiz, } static void SurfaceTexture_setFrameAvailableListener(JNIEnv* env, - jobject thiz, sp<SurfaceTexture::FrameAvailableListener> listener) + jobject thiz, sp<GLConsumer::FrameAvailableListener> listener) { - SurfaceTexture::FrameAvailableListener* const p = - (SurfaceTexture::FrameAvailableListener*) + GLConsumer::FrameAvailableListener* const p = + (GLConsumer::FrameAvailableListener*) env->GetIntField(thiz, fields.frameAvailableListener); if (listener.get()) { listener->incStrong(thiz); @@ -76,16 +76,16 @@ static void SurfaceTexture_setFrameAvailableListener(JNIEnv* env, env->SetIntField(thiz, fields.frameAvailableListener, (int)listener.get()); } -sp<SurfaceTexture> SurfaceTexture_getSurfaceTexture(JNIEnv* env, +sp<GLConsumer> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz) { - return (SurfaceTexture*)env->GetIntField(thiz, fields.surfaceTexture); + return (GLConsumer*)env->GetIntField(thiz, fields.surfaceTexture); } sp<ANativeWindow> android_SurfaceTexture_getNativeWindow( JNIEnv* env, jobject thiz) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); sp<SurfaceTextureClient> surfaceTextureClient(surfaceTexture != NULL ? new SurfaceTextureClient(surfaceTexture->getBufferQueue()) : NULL); return surfaceTextureClient; @@ -99,7 +99,7 @@ bool android_SurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz) // ---------------------------------------------------------------------------- -class JNISurfaceTextureContext : public SurfaceTexture::FrameAvailableListener +class JNISurfaceTextureContext : public GLConsumer::FrameAvailableListener { public: JNISurfaceTextureContext(JNIEnv* env, jobject weakThiz, jclass clazz); @@ -200,7 +200,7 @@ static void SurfaceTexture_classInit(JNIEnv* env, jclass clazz) static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jint texName, jobject weakThiz, jboolean allowSynchronous) { - sp<SurfaceTexture> surfaceTexture(new SurfaceTexture(texName, allowSynchronous)); + sp<GLConsumer> surfaceTexture(new GLConsumer(texName, allowSynchronous)); if (surfaceTexture == 0) { jniThrowException(env, OutOfResourcesException, "Unable to create native SurfaceTexture"); @@ -223,7 +223,7 @@ static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jint texName, static void SurfaceTexture_finalize(JNIEnv* env, jobject thiz) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); surfaceTexture->setFrameAvailableListener(0); SurfaceTexture_setFrameAvailableListener(env, thiz, 0); SurfaceTexture_setSurfaceTexture(env, thiz, 0); @@ -232,13 +232,13 @@ static void SurfaceTexture_finalize(JNIEnv* env, jobject thiz) static void SurfaceTexture_setDefaultBufferSize( JNIEnv* env, jobject thiz, jint width, jint height) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); surfaceTexture->setDefaultBufferSize(width, height); } static void SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); status_t err = surfaceTexture->updateTexImage(); if (err == INVALID_OPERATION) { jniThrowException(env, IllegalStateException, "Unable to update texture contents (see " @@ -250,20 +250,20 @@ static void SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz) static jint SurfaceTexture_detachFromGLContext(JNIEnv* env, jobject thiz) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->detachFromContext(); } static jint SurfaceTexture_attachToGLContext(JNIEnv* env, jobject thiz, jint tex) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->attachToContext((GLuint)tex); } static void SurfaceTexture_getTransformMatrix(JNIEnv* env, jobject thiz, jfloatArray jmtx) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); float* mtx = env->GetFloatArrayElements(jmtx, NULL); surfaceTexture->getTransformMatrix(mtx); env->ReleaseFloatArrayElements(jmtx, mtx, 0); @@ -271,13 +271,13 @@ static void SurfaceTexture_getTransformMatrix(JNIEnv* env, jobject thiz, static jlong SurfaceTexture_getTimestamp(JNIEnv* env, jobject thiz) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); return surfaceTexture->getTimestamp(); } static void SurfaceTexture_release(JNIEnv* env, jobject thiz) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); surfaceTexture->abandon(); } diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index d39f565c..0e0893b 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -27,7 +27,7 @@ #include <cutils/properties.h> #include <utils/Vector.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <gui/Surface.h> #include <camera/Camera.h> #include <binder/IMemory.h> @@ -555,7 +555,7 @@ static void android_hardware_Camera_setPreviewTexture(JNIEnv *env, sp<BufferQueue> bufferQueue = NULL; if (jSurfaceTexture != NULL) { - sp<SurfaceTexture> surfaceTexture = + sp<GLConsumer> surfaceTexture = SurfaceTexture_getSurfaceTexture(env, jSurfaceTexture); if (surfaceTexture != NULL) { bufferQueue = surfaceTexture->getBufferQueue(); diff --git a/core/jni/android_media_RemoteDisplay.cpp b/core/jni/android_media_RemoteDisplay.cpp index 5d24f61..a340fa1 100644 --- a/core/jni/android_media_RemoteDisplay.cpp +++ b/core/jni/android_media_RemoteDisplay.cpp @@ -27,7 +27,7 @@ #include <binder/IServiceManager.h> -#include <gui/ISurfaceTexture.h> +#include <gui/IGraphicBufferProducer.h> #include <media/IMediaPlayerService.h> #include <media/IRemoteDisplay.h> @@ -60,14 +60,14 @@ protected: } public: - virtual void onDisplayConnected(const sp<ISurfaceTexture>& surfaceTexture, + virtual void onDisplayConnected(const sp<IGraphicBufferProducer>& bufferProducer, uint32_t width, uint32_t height, uint32_t flags) { JNIEnv* env = AndroidRuntime::getJNIEnv(); - jobject surfaceObj = android_view_Surface_createFromISurfaceTexture(env, surfaceTexture); + jobject surfaceObj = android_view_Surface_createFromISurfaceTexture(env, bufferProducer); if (surfaceObj == NULL) { ALOGE("Could not create Surface from surface texture %p provided by media server.", - surfaceTexture.get()); + bufferProducer.get()); return; } diff --git a/core/jni/android_opengl_EGL14.cpp b/core/jni/android_opengl_EGL14.cpp index 2b265db..9c7124a 100644 --- a/core/jni/android_opengl_EGL14.cpp +++ b/core/jni/android_opengl_EGL14.cpp @@ -28,7 +28,7 @@ #include <EGL/egl.h> #include <gui/Surface.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <gui/SurfaceTextureClient.h> #include <ui/ANativeObjectBase.h> @@ -605,7 +605,7 @@ android_eglCreateWindowSurfaceTexture jint _remaining; EGLint *attrib_list = (EGLint *) 0; android::sp<ANativeWindow> window; - android::sp<android::SurfaceTexture> surfaceTexture; + android::sp<android::GLConsumer> surfaceTexture; if (!attrib_list_ref) { _exception = 1; diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 5d306d2..d8d55b2 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -24,7 +24,7 @@ #include <android_runtime/AndroidRuntime.h> #include <android_runtime/android_graphics_SurfaceTexture.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <androidfw/ResourceTypes.h> @@ -806,7 +806,7 @@ static void android_view_GLES20Canvas_setOpaqueLayer(JNIEnv* env, jobject clazz, static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject clazz, Layer* layer, jint width, jint height, jboolean isOpaque, jobject surface) { float transform[16]; - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface)); + sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface)); if (surfaceTexture->updateTexImage() == NO_ERROR) { surfaceTexture->getTransformMatrix(transform); diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index 2767e94..1f15370 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -28,7 +28,7 @@ #include <gui/ISurfaceComposer.h> #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <ui/DisplayInfo.h> #include <ui/Rect.h> @@ -234,7 +234,7 @@ static void setSurface(JNIEnv* env, jobject surfaceObj, const sp<Surface>& surfa } } -static sp<ISurfaceTexture> getISurfaceTexture(JNIEnv* env, jobject surfaceObj) { +static sp<IGraphicBufferProducer> getISurfaceTexture(JNIEnv* env, jobject surfaceObj) { if (surfaceObj) { sp<Surface> surface(getSurface(env, surfaceObj)); if (surface != NULL) { @@ -245,12 +245,12 @@ static sp<ISurfaceTexture> getISurfaceTexture(JNIEnv* env, jobject surfaceObj) { } jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env, - const sp<ISurfaceTexture>& surfaceTexture) { - if (surfaceTexture == NULL) { + const sp<IGraphicBufferProducer>& bufferProducer) { + if (bufferProducer == NULL) { return NULL; } - sp<Surface> surface(new Surface(surfaceTexture)); + sp<Surface> surface(new Surface(bufferProducer)); if (surface == NULL) { return NULL; } @@ -258,7 +258,7 @@ jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env, jobject surfaceObj = env->NewObject(gSurfaceClassInfo.clazz, gSurfaceClassInfo.ctor); if (surfaceObj == NULL) { if (env->ExceptionCheck()) { - ALOGE("Could not create instance of Surface from ISurfaceTexture."); + ALOGE("Could not create instance of Surface from IGraphicBufferProducer."); LOGE_EX(env); env->ExceptionClear(); } @@ -289,14 +289,14 @@ static void nativeCreate(JNIEnv* env, jobject surfaceObj, jobject sessionObj, static void nativeCreateFromSurfaceTexture(JNIEnv* env, jobject surfaceObj, jobject surfaceTextureObj) { - sp<SurfaceTexture> st(SurfaceTexture_getSurfaceTexture(env, surfaceTextureObj)); + sp<GLConsumer> st(SurfaceTexture_getSurfaceTexture(env, surfaceTextureObj)); if (st == NULL) { jniThrowException(env, "java/lang/IllegalArgumentException", "SurfaceTexture has already been released"); return; } - sp<ISurfaceTexture> bq = st->getBufferQueue(); + sp<IGraphicBufferProducer> bq = st->getBufferQueue(); sp<Surface> surface(new Surface(bq)); if (surface == NULL) { @@ -667,8 +667,8 @@ static void nativeSetDisplaySurface(JNIEnv* env, jclass clazz, sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); if (token == NULL) return; - sp<ISurfaceTexture> surfaceTexture(getISurfaceTexture(env, surfaceObj)); - SurfaceComposerClient::setDisplaySurface(token, surfaceTexture); + sp<IGraphicBufferProducer> bufferProducer(getISurfaceTexture(env, surfaceObj)); + SurfaceComposerClient::setDisplaySurface(token, bufferProducer); } static void nativeSetDisplayLayerStack(JNIEnv* env, jclass clazz, diff --git a/core/jni/android_view_TextureView.cpp b/core/jni/android_view_TextureView.cpp index 854c9ae..87b312f 100644 --- a/core/jni/android_view_TextureView.cpp +++ b/core/jni/android_view_TextureView.cpp @@ -22,7 +22,7 @@ #include <ui/Region.h> #include <ui/Rect.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <gui/SurfaceTextureClient.h> #include <SkBitmap.h> @@ -67,8 +67,8 @@ static struct { static void android_view_TextureView_setDefaultBufferSize(JNIEnv* env, jobject, jobject surface, jint width, jint height) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface)); - surfaceTexture->setDefaultBufferSize(width, height); + sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(env, surface)); + glConsumer->setDefaultBufferSize(width, height); } static inline SkBitmap::Config convertPixelFormat(int32_t format) { @@ -101,8 +101,8 @@ static int32_t native_window_unlockAndPost(ANativeWindow* window) { static void android_view_TextureView_createNativeWindow(JNIEnv* env, jobject textureView, jobject surface) { - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface)); - sp<ANativeWindow> window = new SurfaceTextureClient(surfaceTexture->getBufferQueue()); + sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(env, surface)); + sp<ANativeWindow> window = new SurfaceTextureClient(glConsumer->getBufferQueue()); window->incStrong(0); SET_INT(textureView, gTextureViewClassInfo.nativeWindow, jint(window.get())); diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp index 1c9562e..199d5bf 100644 --- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp @@ -27,7 +27,7 @@ #include <GLES/gl.h> #include <gui/Surface.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <gui/SurfaceTextureClient.h> #include <SkBitmap.h> @@ -353,9 +353,9 @@ not_valid_surface: return 0; } - sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(_env, native_window)); + sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(_env, native_window)); - window = new SurfaceTextureClient(surfaceTexture->getBufferQueue()); + window = new SurfaceTextureClient(glConsumer->getBufferQueue()); if (window == NULL) goto not_valid_surface; diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java index b919ba4..af1a447 100644 --- a/graphics/java/android/graphics/SurfaceTexture.java +++ b/graphics/java/android/graphics/SurfaceTexture.java @@ -246,7 +246,7 @@ public class SurfaceTexture { * release() frees all the buffers and puts the SurfaceTexture into the * 'abandoned' state. Once put in this state the SurfaceTexture can never * leave it. When in the 'abandoned' state, all methods of the - * ISurfaceTexture interface will fail with the NO_INIT error. + * IGraphicBufferProducer interface will fail with the NO_INIT error. * * Note that while calling this method causes all the buffers to be freed * from the perspective of the the SurfaceTexture, if there are additional diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index e0470dc..75c7903 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -42,7 +42,7 @@ #include <rs.h> #include <rsEnv.h> #include <gui/Surface.h> -#include <gui/SurfaceTexture.h> +#include <gui/GLConsumer.h> #include <gui/SurfaceTextureClient.h> #include <android_runtime/android_graphics_SurfaceTexture.h> @@ -242,7 +242,7 @@ nContextSetSurfaceTexture(JNIEnv *_env, jobject _this, RsContext con, jint width LOG_API("nContextSetSurfaceTexture, con(%p), width(%i), height(%i), surface(%p)", con, width, height, (Surface *)sur); sp<ANativeWindow> window; - sp<SurfaceTexture> st; + sp<GLConsumer> st; if (sur == 0) { } else { @@ -481,9 +481,9 @@ static void nAllocationGetSurfaceTextureID2(JNIEnv *_env, jobject _this, RsContext con, jint a, jobject jst) { LOG_API("nAllocationGetSurfaceTextureID2, con(%p), a(%p)", con, (RsAllocation)a); - sp<SurfaceTexture> st = SurfaceTexture_getSurfaceTexture(_env, jst); + sp<GLConsumer> st = SurfaceTexture_getSurfaceTexture(_env, jst); - rsAllocationGetSurfaceTextureID2(con, (RsAllocation)a, st.get(), sizeof(SurfaceTexture *)); + rsAllocationGetSurfaceTextureID2(con, (RsAllocation)a, st.get(), sizeof(GLConsumer *)); } static void diff --git a/include/android_runtime/android_graphics_SurfaceTexture.h b/include/android_runtime/android_graphics_SurfaceTexture.h index badf22c..77ccd2a 100644 --- a/include/android_runtime/android_graphics_SurfaceTexture.h +++ b/include/android_runtime/android_graphics_SurfaceTexture.h @@ -23,14 +23,14 @@ namespace android { -class SurfaceTexture; +class GLConsumer; extern sp<ANativeWindow> android_SurfaceTexture_getNativeWindow( JNIEnv* env, jobject thiz); extern bool android_SurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz); -/* Gets the underlying SurfaceTexture from a SurfaceTexture Java object. */ -extern sp<SurfaceTexture> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz); +/* Gets the underlying GLConsumer from a SurfaceTexture Java object. */ +extern sp<GLConsumer> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz); } // namespace android diff --git a/include/android_runtime/android_view_Surface.h b/include/android_runtime/android_view_Surface.h index df0fe72..b56aff8 100644 --- a/include/android_runtime/android_view_Surface.h +++ b/include/android_runtime/android_view_Surface.h @@ -24,7 +24,7 @@ namespace android { class Surface; -class ISurfaceTexture; +class IGraphicBufferProducer; /* Gets the underlying ANativeWindow for a Surface. */ extern sp<ANativeWindow> android_view_Surface_getNativeWindow( @@ -36,9 +36,9 @@ extern bool android_view_Surface_isInstanceOf(JNIEnv* env, jobject obj); /* Gets the underlying Surface from a Surface Java object. */ extern sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj); -/* Creates a Surface from an ISurfaceTexture. */ +/* Creates a Surface from an IGraphicBufferProducer. */ extern jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env, - const sp<ISurfaceTexture>& surfaceTexture); + const sp<IGraphicBufferProducer>& bufferProducer); } // namespace android diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index dab2de1..8740c08 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -111,12 +111,12 @@ JMediaCodec::~JMediaCodec() { status_t JMediaCodec::configure( const sp<AMessage> &format, - const sp<ISurfaceTexture> &surfaceTexture, + const sp<IGraphicBufferProducer> &bufferProducer, const sp<ICrypto> &crypto, int flags) { sp<SurfaceTextureClient> client; - if (surfaceTexture != NULL) { - mSurfaceTextureClient = new SurfaceTextureClient(surfaceTexture); + if (bufferProducer != NULL) { + mSurfaceTextureClient = new SurfaceTextureClient(bufferProducer); } else { mSurfaceTextureClient.clear(); } @@ -382,11 +382,11 @@ static void android_media_MediaCodec_native_configure( return; } - sp<ISurfaceTexture> surfaceTexture; + sp<IGraphicBufferProducer> bufferProducer; if (jsurface != NULL) { sp<Surface> surface(android_view_Surface_getSurface(env, jsurface)); if (surface != NULL) { - surfaceTexture = surface->getSurfaceTexture(); + bufferProducer = surface->getSurfaceTexture(); } else { jniThrowException( env, @@ -401,7 +401,7 @@ static void android_media_MediaCodec_native_configure( crypto = JCrypto::GetCrypto(env, jcrypto); } - err = codec->configure(format, surfaceTexture, crypto, flags); + err = codec->configure(format, bufferProducer, crypto, flags); throwExceptionAsNecessary(env, err); } diff --git a/media/jni/android_media_MediaCodec.h b/media/jni/android_media_MediaCodec.h index bc9ad50..a9bb9af 100644 --- a/media/jni/android_media_MediaCodec.h +++ b/media/jni/android_media_MediaCodec.h @@ -30,7 +30,7 @@ struct ALooper; struct AMessage; struct AString; struct ICrypto; -struct ISurfaceTexture; +struct IGraphicBufferProducer; struct MediaCodec; struct SurfaceTextureClient; @@ -43,7 +43,7 @@ struct JMediaCodec : public RefBase { status_t configure( const sp<AMessage> &format, - const sp<ISurfaceTexture> &surfaceTexture, + const sp<IGraphicBufferProducer> &bufferProducer, const sp<ICrypto> &crypto, int flags); diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index ad536f2..5408a1f 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -39,7 +39,7 @@ #include "android_os_Parcel.h" #include "android_util_Binder.h" #include <binder/Parcel.h> -#include <gui/ISurfaceTexture.h> +#include <gui/IGraphicBufferProducer.h> #include <gui/Surface.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> @@ -236,10 +236,10 @@ android_media_MediaPlayer_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fil process_media_player_call( env, thiz, mp->setDataSource(fd, offset, length), "java/io/IOException", "setDataSourceFD failed." ); } -static sp<ISurfaceTexture> +static sp<IGraphicBufferProducer> getVideoSurfaceTexture(JNIEnv* env, jobject thiz) { - ISurfaceTexture * const p = (ISurfaceTexture*)env->GetIntField(thiz, fields.surface_texture); - return sp<ISurfaceTexture>(p); + IGraphicBufferProducer * const p = (IGraphicBufferProducer*)env->GetIntField(thiz, fields.surface_texture); + return sp<IGraphicBufferProducer>(p); } static void @@ -250,7 +250,7 @@ decVideoSurfaceRef(JNIEnv *env, jobject thiz) return; } - sp<ISurfaceTexture> old_st = getVideoSurfaceTexture(env, thiz); + sp<IGraphicBufferProducer> old_st = getVideoSurfaceTexture(env, thiz); if (old_st != NULL) { old_st->decStrong(thiz); } @@ -269,7 +269,7 @@ setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlaye decVideoSurfaceRef(env, thiz); - sp<ISurfaceTexture> new_st; + sp<IGraphicBufferProducer> new_st; if (jsurface) { sp<Surface> surface(android_view_Surface_getSurface(env, jsurface)); if (surface != NULL) { @@ -313,7 +313,7 @@ android_media_MediaPlayer_prepare(JNIEnv *env, jobject thiz) // Handle the case where the display surface was set before the mp was // initialized. We try again to make it stick. - sp<ISurfaceTexture> st = getVideoSurfaceTexture(env, thiz); + sp<IGraphicBufferProducer> st = getVideoSurfaceTexture(env, thiz); mp->setVideoSurfaceTexture(st); process_media_player_call( env, thiz, mp->prepare(), "java/io/IOException", "Prepare failed." ); @@ -330,7 +330,7 @@ android_media_MediaPlayer_prepareAsync(JNIEnv *env, jobject thiz) // Handle the case where the display surface was set before the mp was // initialized. We try again to make it stick. - sp<ISurfaceTexture> st = getVideoSurfaceTexture(env, thiz); + sp<IGraphicBufferProducer> st = getVideoSurfaceTexture(env, thiz); mp->setVideoSurfaceTexture(st); process_media_player_call( env, thiz, mp->prepareAsync(), "java/io/IOException", "Prepare Async failed." ); diff --git a/media/mca/filterfw/jni/jni_gl_environment.cpp b/media/mca/filterfw/jni/jni_gl_environment.cpp index 3c596a4..b64004e 100644 --- a/media/mca/filterfw/jni/jni_gl_environment.cpp +++ b/media/mca/filterfw/jni/jni_gl_environment.cpp @@ -23,7 +23,7 @@ #include <media/mediarecorder.h> #include "native/core/gl_env.h" -#include <gui/ISurfaceTexture.h> +#include <gui/IGraphicBufferProducer.h> #include <gui/SurfaceTextureClient.h> #include <utils/Errors.h> #include <system/window.h> @@ -33,7 +33,7 @@ using android::filterfw::GLEnv; using android::filterfw::WindowHandle; using android::MediaRecorder; using android::sp; -using android::ISurfaceTexture; +using android::IGraphicBufferProducer; using android::SurfaceTextureClient; @@ -284,10 +284,10 @@ jint Java_android_filterfw_core_GLEnvironment_nativeAddSurfaceFromMediaRecorder( // Ask the mediarecorder to return a handle to a surfacemediasource // This will talk to the StageFrightRecorder via MediaRecorderClient // over binder calls - sp<ISurfaceTexture> surfaceMS = mr->querySurfaceMediaSourceFromMediaServer(); + sp<IGraphicBufferProducer> surfaceMS = mr->querySurfaceMediaSourceFromMediaServer(); if (surfaceMS == NULL) { ALOGE("GLEnvironment: Error- MediaRecorder returned a null \ - <ISurfaceTexture> handle."); + <IGraphicBufferProducer> handle."); return -1; } sp<SurfaceTextureClient> surfaceTC = new SurfaceTextureClient(surfaceMS); diff --git a/media/mca/filterfw/jni/jni_gl_environment.h b/media/mca/filterfw/jni/jni_gl_environment.h index af9c744..9dd7102 100644 --- a/media/mca/filterfw/jni/jni_gl_environment.h +++ b/media/mca/filterfw/jni/jni_gl_environment.h @@ -68,7 +68,7 @@ Java_android_filterfw_core_GLEnvironment_nativeAddSurfaceWidthHeight(JNIEnv* env // The call to hook up the SurfaceMediaSource (in MediaServer) to the GL. // We get a sp<ISurfaceTexure> from the MediaServer and talks to MediaServer // over a binder interface. GL hooked up to the MediaServer by using the native -// window created using the <ISurfaceTexture> handle +// window created using the <IGraphicBufferProducer> handle JNIEXPORT jint JNICALL Java_android_filterfw_core_GLEnvironment_nativeAddSurfaceFromMediaRecorder( JNIEnv* env, diff --git a/media/mca/filterfw/native/core/gl_env.cpp b/media/mca/filterfw/native/core/gl_env.cpp index 738b8e0..8ed82e2 100644 --- a/media/mca/filterfw/native/core/gl_env.cpp +++ b/media/mca/filterfw/native/core/gl_env.cpp @@ -159,9 +159,9 @@ bool GLEnv::InitWithNewContext() { return false; } - // Create dummy surface using a SurfaceTexture - surfaceTexture_ = new SurfaceTexture(0); - window_ = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >( + // Create dummy surface using a GLConsumer + surfaceTexture_ = new GLConsumer(0); + window_ = new SurfaceTextureClient(static_cast<sp<IGraphicBufferProducer> >( surfaceTexture_->getBufferQueue())); surfaces_[0] = SurfaceWindowPair(eglCreateWindowSurface(display(), config, window_.get(), NULL), NULL); diff --git a/media/mca/filterfw/native/core/gl_env.h b/media/mca/filterfw/native/core/gl_env.h index b61785f..3c87195 100644 --- a/media/mca/filterfw/native/core/gl_env.h +++ b/media/mca/filterfw/native/core/gl_env.h @@ -27,7 +27,7 @@ #include <GLES2/gl2.h> #include <EGL/egl.h> -#include <gui/ISurfaceTexture.h> +#include <gui/IGraphicBufferProducer.h> #include <gui/SurfaceTextureClient.h> namespace android { @@ -236,8 +236,8 @@ class GLEnv { // Dummy surface for context sp<ANativeWindow> window_; - // Dummy SurfaceTexture for context - sp<SurfaceTexture> surfaceTexture_; + // Dummy GLConsumer for context + sp<GLConsumer> surfaceTexture_; // The maximum surface id used. int max_surface_id_; diff --git a/media/tests/players/invoke_mock_media_player.cpp b/media/tests/players/invoke_mock_media_player.cpp index 1289dfa..a94fedb 100644 --- a/media/tests/players/invoke_mock_media_player.cpp +++ b/media/tests/players/invoke_mock_media_player.cpp @@ -26,7 +26,7 @@ using android::INVALID_OPERATION; using android::Surface; -using android::ISurfaceTexture; +using android::IGraphicBufferProducer; using android::MediaPlayerBase; using android::OK; using android::Parcel; @@ -69,7 +69,7 @@ class Player: public MediaPlayerBase virtual status_t setDataSource(int fd, int64_t offset, int64_t length) {return OK;} virtual status_t setVideoSurfaceTexture( - const sp<ISurfaceTexture>& surfaceTexture) {return OK;} + const sp<IGraphicBufferProducer>& bufferProducer) {return OK;} virtual status_t prepare() {return OK;} virtual status_t prepareAsync() {return OK;} virtual status_t start() {return OK;} |