Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ba01021 authored by Andy McFadden's avatar Andy McFadden
Browse files

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: I64520a55f8c09fe6215382ea361c539a9940cba5
parent 53bc0a2f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include <camera/ICameraRecordingProxyListener.h>
#include <camera/ICameraService.h>

#include <gui/ISurfaceTexture.h>
#include <gui/IGraphicBufferProducer.h>
#include <gui/Surface.h>

namespace android {
@@ -184,14 +184,14 @@ status_t Camera::setPreviewDisplay(const sp<Surface>& surface)
    }
}

// pass the buffered ISurfaceTexture to the camera service
status_t Camera::setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture)
// pass the buffered IGraphicBufferProducer to the camera service
status_t Camera::setPreviewTexture(const sp<IGraphicBufferProducer>& bufferProducer)
{
    ALOGV("setPreviewTexture(%p)", surfaceTexture.get());
    ALOGV("setPreviewTexture(%p)", bufferProducer.get());
    sp <ICamera> c = mCamera;
    if (c == 0) return NO_INIT;
    if (surfaceTexture != 0) {
        return c->setPreviewTexture(surfaceTexture);
    if (bufferProducer != 0) {
        return c->setPreviewTexture(bufferProducer);
    } else {
        ALOGD("app passed NULL surface");
        return c->setPreviewTexture(0);
+6 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#include <sys/types.h>
#include <binder/Parcel.h>
#include <camera/ICamera.h>
#include <gui/ISurfaceTexture.h>
#include <gui/IGraphicBufferProducer.h>
#include <gui/Surface.h>

namespace android {
@@ -79,13 +79,13 @@ public:
        return reply.readInt32();
    }

    // pass the buffered SurfaceTexture to the camera service
    status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture)
    // pass the buffered IGraphicBufferProducer to the camera service
    status_t setPreviewTexture(const sp<IGraphicBufferProducer>& bufferProducer)
    {
        ALOGV("setPreviewTexture");
        Parcel data, reply;
        data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
        sp<IBinder> b(surfaceTexture->asBinder());
        sp<IBinder> b(bufferProducer->asBinder());
        data.writeStrongBinder(b);
        remote()->transact(SET_PREVIEW_TEXTURE, data, &reply);
        return reply.readInt32();
@@ -292,7 +292,8 @@ status_t BnCamera::onTransact(
        case SET_PREVIEW_TEXTURE: {
            ALOGV("SET_PREVIEW_TEXTURE");
            CHECK_INTERFACE(ICamera, data, reply);
            sp<ISurfaceTexture> st = interface_cast<ISurfaceTexture>(data.readStrongBinder());
            sp<IGraphicBufferProducer> st =
                interface_cast<IGraphicBufferProducer>(data.readStrongBinder());
            reply->writeInt32(setPreviewTexture(st));
            return NO_ERROR;
        } break;
+3 −3
Original line number Diff line number Diff line
@@ -64,12 +64,12 @@ status_t SimplePlayer::setDataSource(const char *path) {
    return PostAndAwaitResponse(msg, &response);
}

status_t SimplePlayer::setSurface(const sp<ISurfaceTexture> &surfaceTexture) {
status_t SimplePlayer::setSurface(const sp<IGraphicBufferProducer> &bufferProducer) {
    sp<AMessage> msg = new AMessage(kWhatSetSurface, id());

    sp<SurfaceTextureClient> surfaceTextureClient;
    if (surfaceTexture != NULL) {
        surfaceTextureClient = new SurfaceTextureClient(surfaceTexture);
    if (bufferProducer != NULL) {
        surfaceTextureClient = new SurfaceTextureClient(bufferProducer);
    }

    msg->setObject(
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ namespace android {
struct ABuffer;
struct ALooper;
struct AudioTrack;
struct ISurfaceTexture;
struct IGraphicBufferProducer;
struct MediaCodec;
struct NativeWindowWrapper;
struct NuMediaExtractor;
@@ -32,7 +32,7 @@ struct SimplePlayer : public AHandler {
    SimplePlayer();

    status_t setDataSource(const char *path);
    status_t setSurface(const sp<ISurfaceTexture> &surfaceTexture);
    status_t setSurface(const sp<IGraphicBufferProducer> &bufferProducer);
    status_t prepare();
    status_t start();
    status_t stop();
+1 −1
Original line number Diff line number Diff line
@@ -940,7 +940,7 @@ int main(int argc, char **argv) {
        } else {
            CHECK(useSurfaceTexAlloc);

            sp<SurfaceTexture> texture = new SurfaceTexture(0 /* tex */);
            sp<GLConsumer> texture = new GLConsumer(0 /* tex */);
            gSurface = new SurfaceTextureClient(texture->getBufferQueue());
        }

Loading