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

Commit 5494cdc6 authored by Igor Murashkin's avatar Igor Murashkin
Browse files

Camera: Change ProCamera to take IGraphicBufferProducer

Change-Id: Iec62eead6d179aa5486f7719143340976bb76e7d
parent 9fb7fa15
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ public:
    }

    virtual status_t createStream(int width, int height, int format,
                          const sp<Surface>& surface,
                          const sp<IGraphicBufferProducer>& bufferProducer,
                          /*out*/
                          int* streamId)
    {
@@ -229,7 +229,9 @@ public:
        data.writeInt32(height);
        data.writeInt32(format);

        Surface::writeToParcel(surface, &data);
        sp<IBinder> b(bufferProducer->asBinder());
        data.writeStrongBinder(b);

        remote()->transact(CREATE_STREAM, data, &reply);

        int sId = reply.readInt32();
@@ -340,11 +342,12 @@ status_t BnProCameraUser::onTransact(
            height = data.readInt32();
            format = data.readInt32();

            sp<Surface> surface = Surface::readFromParcel(data);
            sp<IGraphicBufferProducer> bp =
               interface_cast<IGraphicBufferProducer>(data.readStrongBinder());

            int streamId = -1;
            status_t ret;
            ret = createStream(width, height, format, surface, &streamId);
            ret = createStream(width, height, format, bp, &streamId);

            reply->writeInt32(streamId);
            reply->writeInt32(ret);
+5 −4
Original line number Diff line number Diff line
@@ -278,7 +278,8 @@ status_t ProCamera::createStream(int width, int height, int format,
    sp <IProCameraUser> c = mCamera;
    if (c == 0) return NO_INIT;

    return c->createStream(width, height, format, surface, streamId);
    return c->createStream(width, height, format, surface->getIGraphicBufferProducer(),
                           streamId);
}

status_t ProCamera::createStream(int width, int height, int format,
@@ -293,10 +294,10 @@ status_t ProCamera::createStream(int width, int height, int format,
    status_t stat = INVALID_OPERATION;

    if (bufferProducer != 0) {
        binder = bufferProducer->asBinder();
        sp <IProCameraUser> c = mCamera;
        if (c == 0) return NO_INIT;

        ALOGV("%s: createStreamT END (%d), StreamID = %d", __FUNCTION__, stat,
                                                                    *streamId);
        return c->createStream(width, height, format, bufferProducer, streamId);
    }
    else {
        *streamId = -1;
+5 −4
Original line number Diff line number Diff line
@@ -63,8 +63,9 @@ public:

    virtual status_t        requestStream(int streamId) = 0;
    virtual status_t        cancelStream(int streamId) = 0;
    virtual status_t        createStream(int width, int height, int format,
                                         const sp<Surface>& surface,
    virtual status_t        createStream(
                                      int width, int height, int format,
                                      const sp<IGraphicBufferProducer>& bufferProducer,
                                      /*out*/
                                      int* streamId) = 0;

+10 −2
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ status_t ProCamera2Client::cancelStream(int streamId) {
}

status_t ProCamera2Client::createStream(int width, int height, int format,
                      const sp<Surface>& surface,
                      const sp<IGraphicBufferProducer>& bufferProducer,
                      /*out*/
                      int* streamId)
{
@@ -254,7 +254,15 @@ status_t ProCamera2Client::createStream(int width, int height, int format,

    Mutex::Autolock icl(mIProCameraUserLock);

    return mDevice->createStream(surface, width, height, format, /*size*/1, streamId);
    sp<IBinder> binder;
    sp<ANativeWindow> window;
    if (bufferProducer != 0) {
        binder = bufferProducer->asBinder();
        window = new Surface(bufferProducer);
    }

    return mDevice->createStream(window, width, height, format, /*size*/1,
                                 streamId);
}

// Create a request object from a template.
+3 −3
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ public:
    virtual status_t      cancelStream(int streamId);

    virtual status_t      createStream(int width, int height, int format,
                                       const sp<Surface>& surface,
                                      const sp<IGraphicBufferProducer>& bufferProducer,
                                      /*out*/
                                      int* streamId);