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

Commit 51538b30 authored by Iliyan Malchev's avatar Iliyan Malchev Committed by Android (Google) Code Review
Browse files

Merge "frameworks/base: some camera-interface cleanup"

parents 0c03d5c7 108dddf9
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -205,22 +205,6 @@ status_t Camera::startPreview()
    return c->startPreview();
}

int32_t Camera::getNumberOfVideoBuffers() const
{
    LOGV("getNumberOfVideoBuffers");
    sp <ICamera> c = mCamera;
    if (c == 0) return 0;
    return c->getNumberOfVideoBuffers();
}

sp<IMemory> Camera::getVideoBuffer(int32_t index) const
{
    LOGV("getVideoBuffer: %d", index);
    sp <ICamera> c = mCamera;
    if (c == 0) return 0;
    return c->getVideoBuffer(index);
}

status_t Camera::storeMetaDataInBuffers(bool enabled)
{
    LOGV("storeMetaDataInBuffers: %s",
+0 −36
Original line number Diff line number Diff line
@@ -46,8 +46,6 @@ enum {
    STOP_RECORDING,
    RECORDING_ENABLED,
    RELEASE_RECORDING_FRAME,
    GET_NUM_VIDEO_BUFFERS,
    GET_VIDEO_BUFFER,
    STORE_META_DATA_IN_BUFFERS,
};

@@ -149,27 +147,6 @@ public:
        remote()->transact(RELEASE_RECORDING_FRAME, data, &reply);
    }

    int32_t getNumberOfVideoBuffers() const
    {
        LOGV("getNumberOfVideoBuffers");
        Parcel data, reply;
        data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
        remote()->transact(GET_NUM_VIDEO_BUFFERS, data, &reply);
        return reply.readInt32();
    }

    sp<IMemory> getVideoBuffer(int32_t index) const
    {
        LOGV("getVideoBuffer: %d", index);
        Parcel data, reply;
        data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
        data.writeInt32(index);
        remote()->transact(GET_VIDEO_BUFFER, data, &reply);
        sp<IMemory> mem = interface_cast<IMemory>(
                            reply.readStrongBinder());
        return mem;
    }

    status_t storeMetaDataInBuffers(bool enabled)
    {
        LOGV("storeMetaDataInBuffers: %s", enabled? "true": "false");
@@ -355,19 +332,6 @@ status_t BnCamera::onTransact(
            releaseRecordingFrame(mem);
            return NO_ERROR;
        } break;
        case GET_NUM_VIDEO_BUFFERS: {
            LOGV("GET_NUM_VIDEO_BUFFERS");
            CHECK_INTERFACE(ICamera, data, reply);
            reply->writeInt32(getNumberOfVideoBuffers());
            return NO_ERROR;
        } break;
        case GET_VIDEO_BUFFER: {
            LOGV("GET_VIDEO_BUFFER");
            CHECK_INTERFACE(ICamera, data, reply);
            int32_t index = data.readInt32();
            reply->writeStrongBinder(getVideoBuffer(index)->asBinder());
            return NO_ERROR;
        } break;
        case STORE_META_DATA_IN_BUFFERS: {
            LOGV("STORE_META_DATA_IN_BUFFERS");
            CHECK_INTERFACE(ICamera, data, reply);
+0 −6
Original line number Diff line number Diff line
@@ -219,12 +219,6 @@ public:
            // send command to camera driver
            status_t    sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);

            // return the total number of available video buffers.
            int32_t     getNumberOfVideoBuffers() const;

            // return the individual video buffer corresponding to the given index.
            sp<IMemory> getVideoBuffer(int32_t index) const;

            // tell camera hal to store meta data or real YUV in video buffers.
            status_t    storeMetaDataInBuffers(bool enabled);

+0 −54
Original line number Diff line number Diff line
@@ -28,16 +28,6 @@

namespace android {

/**
 *  The size of image for display.
 */
typedef struct image_rect_struct
{
  uint32_t width;      /* Image width */
  uint32_t height;     /* Image height */
} image_rect_type;


typedef void (*notify_callback)(int32_t msgType,
                                int32_t ext1,
                                int32_t ext2,
@@ -90,9 +80,6 @@ public:
    /** Set the ANativeWindow to which preview frames are sent */
    virtual status_t setPreviewWindow(const sp<ANativeWindow>& buf) = 0;

    /** Return the IMemoryHeap for the raw image heap */
    virtual sp<IMemoryHeap>         getRawHeap() const = 0;

    /** Set the notification and data callbacks */
    virtual void setCallbacks(notify_callback notify_cb,
                              data_callback data_cb,
@@ -144,47 +131,6 @@ public:
     */
    virtual bool        previewEnabled() = 0;

    /**
     * Retrieve the total number of available buffers from camera hal for passing
     * video frame data in a recording session. Must be called again if a new
     * recording session is started.
     *
     * This method should be called after startRecording(), since
     * the some camera hal may choose to allocate the video buffers only after
     * recording is started.
     *
     * Some camera hal may not implement this method, and 0 can be returned to
     * indicate that this feature is not available.
     *
     * @return the number of video buffers that camera hal makes available.
     *      Zero (0) is returned to indicate that camera hal does not support
     *      this feature.
     */
    virtual int32_t     getNumberOfVideoBuffers() const { return 0; }

    /**
     * Retrieve the video buffer corresponding to the given index in a
     * recording session. Must be called again if a new recording session
     * is started.
     *
     * It allows a client to retrieve all video buffers that camera hal makes
     * available to passing video frame data by calling this method with all
     * valid index values. The valid index value ranges from 0 to n, where
     * n = getNumberOfVideoBuffers() - 1. With an index outside of the valid
     * range, 0 must be returned. This method should be called after
     * startRecording().
     *
     * The video buffers should NOT be modified/released by camera hal
     * until stopRecording() is called and all outstanding video buffers
     * previously sent out via CAMERA_MSG_VIDEO_FRAME have been released
     * via releaseVideoBuffer().
     *
     * @param index an index to retrieve the corresponding video buffer.
     *
     * @return the video buffer corresponding to the given index.
     */
    virtual sp<IMemory> getVideoBuffer(int32_t index) const { return 0; }

    /**
     * Request the camera hal to store meta data or real YUV data in
     * the video buffers send out via CAMERA_MSG_VIDEO_FRRAME for a
+0 −6
Original line number Diff line number Diff line
@@ -102,12 +102,6 @@ public:
    // send command to camera driver
    virtual status_t        sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;

    // return the total number of available video buffers
    virtual int32_t         getNumberOfVideoBuffers() const  = 0;

    // return the individual video buffer corresponding to the given index.
    virtual sp<IMemory>     getVideoBuffer(int32_t index) const = 0;

    // tell the camera hal to store meta data or real YUV data in video buffers.
    virtual status_t        storeMetaDataInBuffers(bool enabled) = 0;
};
Loading