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

Commit 40c36413 authored by Iliyan Malchev's avatar Iliyan Malchev
Browse files

frameworks/base: some camera-interface cleanup



Methods getNumberOfVideoBuffers() and getVideoBuffer() as well as struct
image_rect_struct are no longer used (instead, the necessary information is
passed through ANativeWindow.)

Change-Id: If4b11446fc9ccbde1f6b45bc70c0d0b8e54376eb
Signed-off-by: default avatarIliyan Malchev <malchev@google.com>
parent 45538666
Loading
Loading
Loading
Loading
+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;
};
+0 −28
Original line number Diff line number Diff line
@@ -98,34 +98,6 @@ public:
     */
    virtual sp<MetaData> getFormat();

    /**
     * Retrieve the total number of video buffers available from
     * this source.
     *
     * This method is useful if these video buffers are used
     * for passing video frame data to other media components,
     * such as OMX video encoders, in order to eliminate the
     * memcpy of the data.
     *
     * @return the total numbner of video buffers. Returns 0 to
     *      indicate that this source does not make the video
     *      buffer information availalble.
     */
    size_t getNumberOfVideoBuffers() const;

    /**
     * Retrieve the individual video buffer available from
     * this source.
     *
     * @param index the index corresponding to the video buffer.
     *      Valid range of the index is [0, n], where n =
     *      getNumberOfVideoBuffers() - 1.
     *
     * @return the video buffer corresponding to the given index.
     *      If index is out of range, 0 should be returned.
     */
    sp<IMemory> getVideoBuffer(size_t index) const;

    /**
     * Tell whether this camera source stores meta data or real YUV
     * frame data in video buffers.
+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",
Loading