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

Commit 28e0dfc9 authored by Emilio López's avatar Emilio López Committed by Steve Kondik
Browse files

Support Motorola Custom libcamera Parameters

This commit adds support for get/setCustomParameters, two functions
used on Motorola Tegra 2 libcameras to pass special values like
usenvbuffer, video size, etc. It also adds some required keys and
functions to CameraParameters.

Change-Id: I30bfc02862972a9437e925322ab0e7ea89d4a767
parent eb0e3d32
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -210,9 +210,19 @@ public:
            // set preview/capture parameters - key/value pairs
            status_t    setParameters(const String8& params);

            #ifdef MOTO_CUSTOM_PARAMETERS
            // set preview/capture parameters - key/value pairs
            status_t    setCustomParameters(const String8& params);
            #endif

            // get preview/capture parameters - key/value pairs
            String8     getParameters() const;

            #ifdef MOTO_CUSTOM_PARAMETERS
            // get preview/capture parameters - key/value pairs
            String8     getCustomParameters() const;
            #endif

            // send command to camera driver
            status_t    sendCommand(int32_t cmd, int32_t arg1, int32_t arg2);

+22 −0
Original line number Diff line number Diff line
@@ -59,6 +59,21 @@ public:
    void setPreviewSize(int width, int height);
    void getPreviewSize(int *width, int *height) const;
    void getSupportedPreviewSizes(Vector<Size> &sizes) const;

    // Set the dimensions in pixels to the given width and height
    // for video frames. The given width and height must be one
    // of the supported dimensions returned from
    // getSupportedVideoSizes(). Must not be called if
    // getSupportedVideoSizes() returns an empty Vector of Size.
    void setVideoSize(int width, int height);

    // Retrieve the current dimensions (width and height)
    // in pixels for video frames, which must be one of the
    // supported dimensions returned from getSupportedVideoSizes().
    // Must not be called if getSupportedVideoSizes() returns an
    // empty Vector of Size.
    void getVideoSize(int *width, int *height) const;

    void setPreviewFrameRate(int fps);
    int getPreviewFrameRate() const;
    void getPreviewFpsRange(int *min_fps, int *max_fps) const;
@@ -333,6 +348,12 @@ public:
    // Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only.
    static const char KEY_FOCUS_DISTANCES[];

    // The current dimensions in pixels (width x height) for video frames.
    // The width and height must be one of the supported sizes retrieved
    // via KEY_SUPPORTED_VIDEO_SIZES.
    // Example value: "1280x720". Read/write.
    static const char KEY_VIDEO_SIZE[];

    // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in
    // frameworks/base/include/camera/Camera.h.
    // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only.
@@ -419,6 +440,7 @@ public:
    // Formats for setPreviewFormat and setPictureFormat.
    static const char PIXEL_FORMAT_YUV422SP[];
    static const char PIXEL_FORMAT_YUV420SP[]; // NV21
    static const char PIXEL_FORMAT_YUV420P[];
    static const char PIXEL_FORMAT_YUV422I[]; // YUY2
    static const char PIXEL_FORMAT_RGB565[];
    static const char PIXEL_FORMAT_JPEG[];
+8 −0
Original line number Diff line number Diff line
@@ -94,6 +94,14 @@ public:
    // get preview/capture parameters - key/value pairs
    virtual String8         getParameters() const = 0;

    #ifdef MOTO_CUSTOM_PARAMETERS
    // set preview/capture custom parameters - key/value pairs
    virtual status_t        setCustomParameters(const String8& params) = 0;

    // get preview/capture custom parameters - key/value pairs
    virtual String8         getCustomParameters() const = 0;
    #endif

    // send command to camera driver
    virtual status_t        sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;

+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@ ifeq ($(BOARD_CAMERA_USE_GETBUFFERINFO),true)
    LOCAL_CFLAGS += -DUSE_GETBUFFERINFO
endif

ifeq ($(TARGET_USE_MOTO_CUSTOM_CAMERA_PARAMETERS),true)
    LOCAL_CFLAGS += -DMOTO_CUSTOM_PARAMETERS
endif

ifeq ($(TARGET_SIMULATOR),true)
    LOCAL_LDLIBS += -lpthread
endif
+24 −1
Original line number Diff line number Diff line
@@ -305,7 +305,18 @@ status_t Camera::setParameters(const String8& params)
    return c->setParameters(params);
}

// get preview/capture parameters - key/value pairs
#ifdef MOTO_CUSTOM_PARAMETERS
// set preview/capture custom parameters - key/value pairs
status_t Camera::setCustomParameters(const String8& params)
{
    LOGV("setCustomParameters");
    sp <ICamera> c = mCamera;
    if (c == 0) return NO_INIT;
    return c->setCustomParameters(params);
}
#endif

// get preview/capture custom parameters - key/value pairs
String8 Camera::getParameters() const
{
    LOGV("getParameters");
@@ -315,6 +326,18 @@ String8 Camera::getParameters() const
    return params;
}

#ifdef MOTO_CUSTOM_PARAMETERS
// get preview/capture parameters - key/value pairs
String8 Camera::getCustomParameters() const
{
    LOGV("getCustomParameters");
    String8 params;
    sp <ICamera> c = mCamera;
    if (c != 0) params = mCamera->getCustomParameters();
    return params;
}
#endif

// send command to camera driver
status_t Camera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
{
Loading