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

Commit ff09ef8f authored by Wu-cheng Li's avatar Wu-cheng Li
Browse files

Add frame metadata parameter to camera data_callback.

bug:4460717
Change-Id: Ib47d7d7df20af8155a719f3dabefe030893bfebc
parent a3924af3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ typedef void (*notify_callback)(int32_t msgType,

typedef void (*data_callback)(int32_t msgType,
                            const sp<IMemory> &dataPtr,
                            camera_frame_metadata_t *metadata,
                            void* user);

typedef void (*data_callback_timestamp)(nsecs_t timestamp,
@@ -442,6 +443,7 @@ private:

    static void __data_cb(int32_t msg_type,
                          const camera_memory_t *data, unsigned int index,
                          camera_frame_metadata_t *metadata,
                          void *user)
    {
        LOGV("%s", __FUNCTION__);
@@ -453,7 +455,7 @@ private:
                 index, mem->mNumBufs);
            return;
        }
        __this->mDataCb(msg_type, mem->mBuffers[index], __this->mCbUser);
        __this->mDataCb(msg_type, mem->mBuffers[index], metadata, __this->mCbUser);
    }

    static void __data_cb_timestamp(nsecs_t timestamp, int32_t msg_type,
+3 −3
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ int CameraHardwareStub::previewThread()

        // Notify the client of a new frame.
        if (mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME)
            mDataCb(CAMERA_MSG_PREVIEW_FRAME, buffer, mCallbackCookie);
            mDataCb(CAMERA_MSG_PREVIEW_FRAME, buffer, NULL, mCallbackCookie);

        // Advance the buffer pointer.
        mCurrentPreviewFrame = (mCurrentPreviewFrame + 1) % kBufferCount;
@@ -290,14 +290,14 @@ int CameraHardwareStub::pictureThread()
        sp<MemoryBase> mem = new MemoryBase(mRawHeap, 0, w * h * 3 / 2);
        FakeCamera cam(w, h);
        cam.getNextFrameAsYuv420((uint8_t *)mRawHeap->base());
        mDataCb(CAMERA_MSG_RAW_IMAGE, mem, mCallbackCookie);
        mDataCb(CAMERA_MSG_RAW_IMAGE, mem, NULL, mCallbackCookie);
    }

    if (mMsgEnabled & CAMERA_MSG_COMPRESSED_IMAGE) {
        sp<MemoryHeapBase> heap = new MemoryHeapBase(kCannedJpegSize);
        sp<MemoryBase> mem = new MemoryBase(heap, 0, kCannedJpegSize);
        memcpy(heap->base(), kCannedJpeg, kCannedJpegSize);
        mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, mCallbackCookie);
        mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, NULL, mCallbackCookie);
    }
    return NO_ERROR;
}
+1 −1
Original line number Diff line number Diff line
@@ -988,7 +988,7 @@ void CameraService::Client::notifyCallback(int32_t msgType, int32_t ext1,
}

void CameraService::Client::dataCallback(int32_t msgType,
        const sp<IMemory>& dataPtr, void* user) {
        const sp<IMemory>& dataPtr, camera_frame_metadata_t *metadata, void* user) {
    LOG2("dataCallback(%d)", msgType);

    sp<Client> client = getClientFromCookie(user);
+2 −1
Original line number Diff line number Diff line
@@ -140,7 +140,8 @@ private:

        // these are static callback functions
        static void             notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2, void* user);
        static void             dataCallback(int32_t msgType, const sp<IMemory>& dataPtr, void* user);
        static void             dataCallback(int32_t msgType, const sp<IMemory>& dataPtr,
                                             camera_frame_metadata_t *metadata, void* user);
        static void             dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr, void* user);
        // convert client from cookie
        static sp<Client>       getClientFromCookie(void* user);