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

Commit e468ac57 authored by James Dong's avatar James Dong
Browse files

Application-managed callback buffer support for raw image

bug - 3292153

Change-Id: I9789f7c5cde3a3889d7375e881181e9152d95fc2
parent 8e0e1979
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -301,12 +301,12 @@ status_t Camera::cancelAutoFocus()
}

// take a picture
status_t Camera::takePicture()
status_t Camera::takePicture(int msgType)
{
    LOGV("takePicture");
    LOGV("takePicture: 0x%x", msgType);
    sp <ICamera> c = mCamera;
    if (c == 0) return NO_INIT;
    return c->takePicture();
    return c->takePicture(msgType);
}

// set preview/capture parameters - key/value pairs
+5 −3
Original line number Diff line number Diff line
@@ -223,11 +223,12 @@ public:
    }

    // take a picture - returns an IMemory (ref-counted mmap)
    status_t takePicture()
    status_t takePicture(int msgType)
    {
        LOGV("takePicture");
        LOGV("takePicture: 0x%x", msgType);
        Parcel data, reply;
        data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
        data.writeInt32(msgType);
        remote()->transact(TAKE_PICTURE, data, &reply);
        status_t ret = reply.readInt32();
        return ret;
@@ -401,7 +402,8 @@ status_t BnCamera::onTransact(
        case TAKE_PICTURE: {
            LOGV("TAKE_PICTURE");
            CHECK_INTERFACE(ICamera, data, reply);
            reply->writeInt32(takePicture());
            int msgType = data.readInt32();
            reply->writeInt32(takePicture(msgType));
            return NO_ERROR;
        } break;
        case SET_PARAMETERS: {
+12 −11
Original line number Diff line number Diff line
@@ -66,16 +66,17 @@ namespace android {

// msgType in notifyCallback and dataCallback functions
enum {
    CAMERA_MSG_ERROR            = 0x001,
    CAMERA_MSG_SHUTTER          = 0x002,
    CAMERA_MSG_FOCUS            = 0x004,
    CAMERA_MSG_ZOOM             = 0x008,
    CAMERA_MSG_PREVIEW_FRAME    = 0x010,
    CAMERA_MSG_VIDEO_FRAME      = 0x020,
    CAMERA_MSG_POSTVIEW_FRAME   = 0x040,
    CAMERA_MSG_RAW_IMAGE        = 0x080,
    CAMERA_MSG_COMPRESSED_IMAGE = 0x100,
    CAMERA_MSG_ALL_MSGS         = 0x1FF
    CAMERA_MSG_ERROR            = 0x0001,
    CAMERA_MSG_SHUTTER          = 0x0002,
    CAMERA_MSG_FOCUS            = 0x0004,
    CAMERA_MSG_ZOOM             = 0x0008,
    CAMERA_MSG_PREVIEW_FRAME    = 0x0010,
    CAMERA_MSG_VIDEO_FRAME      = 0x0020,
    CAMERA_MSG_POSTVIEW_FRAME   = 0x0040,
    CAMERA_MSG_RAW_IMAGE        = 0x0080,
    CAMERA_MSG_COMPRESSED_IMAGE = 0x0100,
    CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x0200,
    CAMERA_MSG_ALL_MSGS         = 0xFFFF
};

// cmdType in sendCommand functions
@@ -207,7 +208,7 @@ public:
            status_t    cancelAutoFocus();

            // take a picture - picture returned from callback
            status_t    takePicture();
            status_t    takePicture(int msgType);

            // set preview/capture parameters - key/value pairs
            status_t    setParameters(const String8& params);
+9 −3
Original line number Diff line number Diff line
@@ -84,8 +84,14 @@ public:
    // cancel auto focus
    virtual status_t        cancelAutoFocus() = 0;

    // take a picture
    virtual status_t        takePicture() = 0;
    /*
     * take a picture.
     * @param msgType the message type an application selectively turn on/off
     * on a photo-by-photo basis. The supported message types are:
     * CAMERA_MSG_SHUTTER, CAMERA_MSG_RAW_IMAGE, CAMERA_MSG_COMPRESSED_IMAGE,
     * and CAMERA_MSG_POSTVIEW_FRAME. Any other message types will be ignored.
     */
    virtual status_t        takePicture(int msgType) = 0;

    // set preview/capture parameters - key/value pairs
    virtual status_t        setParameters(const String8& params) = 0;
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ void CameraSourceTimeLapse::threadTimeLapseEntry() {
        // this thread as read() will make a copy of this last frame and keep
        // returning it in the quick stop mode.
        Mutex::Autolock autoLock(mQuickStopLock);
        CHECK_EQ(OK, mCamera->takePicture());
        CHECK_EQ(OK, mCamera->takePicture(CAMERA_MSG_RAW_IMAGE));
        if (mQuickStop) {
            LOGV("threadTimeLapseEntry: Exiting due to mQuickStop = true");
            return;
Loading