aboutsummaryrefslogtreecommitdiff
path: root/camera/usbcamcore/inc
diff options
context:
space:
mode:
authorPrateek Chaubey <chaubeyprateek@gmail.com>2018-01-07 20:55:14 +0530
committerDavide Garberi <dade.garberi@gmail.com>2018-01-19 14:09:15 +0100
commit6616278131edd80a12545085e06ee6b0e0a0a788 (patch)
tree0aef88ed11809a9d67f6abe4dc2ff782a14737e2 /camera/usbcamcore/inc
parentcc4ccf34871da343111bf68d16ba4e4c67cac1dc (diff)
msm8996-common: zuk: Import OSS Camera HAL
Tag: LA.HB.1.3.2-32600-8x96.0 Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
Diffstat (limited to 'camera/usbcamcore/inc')
-rwxr-xr-xcamera/usbcamcore/inc/QCameraMjpegDecode.h49
-rwxr-xr-xcamera/usbcamcore/inc/QCameraUsbParm.h178
-rwxr-xr-xcamera/usbcamcore/inc/QCameraUsbPriv.h202
-rwxr-xr-xcamera/usbcamcore/inc/QualcommUsbCamera.h243
4 files changed, 672 insertions, 0 deletions
diff --git a/camera/usbcamcore/inc/QCameraMjpegDecode.h b/camera/usbcamcore/inc/QCameraMjpegDecode.h
new file mode 100755
index 0000000..b04182b
--- /dev/null
+++ b/camera/usbcamcore/inc/QCameraMjpegDecode.h
@@ -0,0 +1,49 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __QCAMERA_MJPEG_DECODE_H
+#define __QCAMERA_MJPEG_DECODE_H
+
+typedef int MJPEGD_ERR;
+#define MJPEGD_NO_ERROR 0
+#define MJPEGD_ERROR -1
+#define MJPEGD_INSUFFICIENT_MEM -2
+
+MJPEGD_ERR mjpegDecoderInit(void**);
+
+MJPEGD_ERR mjpegDecoderDestroy(void* mjpegd);
+
+MJPEGD_ERR mjpegDecode(
+ void* mjpegd,
+ char* mjpegBuffer,
+ int mjpegBufferSize,
+ char* outputYptr,
+ char* outputUVptr,
+ int outputFormat);
+
+#endif /* __QCAMERA_MJPEG_DECODE_H */
diff --git a/camera/usbcamcore/inc/QCameraUsbParm.h b/camera/usbcamcore/inc/QCameraUsbParm.h
new file mode 100755
index 0000000..595bf42
--- /dev/null
+++ b/camera/usbcamcore/inc/QCameraUsbParm.h
@@ -0,0 +1,178 @@
+/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ANDROID_HARDWARE_QCAMERA_USB_PARM_H
+#define ANDROID_HARDWARE_QCAMERA_USB_PARM_H
+
+
+#include <utils/threads.h>
+#include <hardware/camera.h>
+#include <binder/MemoryBase.h>
+#include <binder/MemoryHeapBase.h>
+#include <utils/threads.h>
+#include <cutils/properties.h>
+#include <camera/Camera.h>
+#include <camera/QCameraParameters.h>
+#include <system/window.h>
+#include <system/camera.h>
+#include <hardware/camera.h>
+#include <gralloc_priv.h>
+#include <hardware/power.h>
+
+extern "C" {
+#include <linux/android_pmem.h>
+#include <linux/msm_ion.h>
+#include <camera.h>
+#include <camera_defs_i.h>
+} //extern C
+
+//Error codes
+#define NOT_FOUND -1
+
+/******************************************************************************
+* Macro definitions
+******************************************************************************/
+/* enum definitions for picture formats */
+static const int PICTURE_FORMAT_JPEG = 1;
+static const int PICTURE_FORMAT_RAW = 2;
+
+/* Default preview width in pixels */
+#define DEFAULT_USBCAM_PRVW_WD 1280//640
+
+/* Default preview height in pixels */
+#define DEFAULT_USBCAM_PRVW_HT 720//480
+
+/* Default picture format */
+#define DEFAULT_USBCAM_PICT_FMT PICTURE_FORMAT_JPEG
+
+/* Default picture width in pixels */
+#define DEFAULT_USBCAM_PICT_WD 640
+
+/* Default picture height in pixels */
+#define DEFAULT_USBCAM_PICT_HT 480
+
+/* Default picture JPEG quality 0-100 */
+#define DEFAULT_USBCAM_PICT_QLTY 85
+
+/* Default thumbnail width in pixels */
+#define DEFAULT_USBCAM_THUMBNAIL_WD 432
+
+/* Default thumbnail height in pixels */
+#define DEFAULT_USBCAM_THUMBNAIL_HT 288
+
+/* Default thumbnail JPEG quality 0-100 */
+#define DEFAULT_USBCAM_THUMBNAIL_QLTY 85
+
+/* Default preview format */
+#define DEFAULT_USBCAM_PRVW_FMT HAL_PIXEL_FORMAT_YCrCb_420_SP
+
+/* minimum of the default preview fps range in milli-Hz */
+#define MIN_PREV_FPS 5000
+
+/* maximum of the default preview fps range in milli-Hz */
+#define MAX_PREV_FPS 121000
+
+//for histogram stats
+#define HISTOGRAM_STATS_SIZE 257
+#define NUM_HISTOGRAM_BUFFERS 3
+
+namespace android {
+
+/******************************************************************************
+* Structure definitions
+******************************************************************************/
+typedef struct {
+ uint32_t aspect_ratio;
+ uint32_t width;
+ uint32_t height;
+} thumbnail_size_type;
+
+/******************************************************************************
+ * Function: usbCamInitDefaultParameters
+ * Description: This function sets default parameters to camera HAL context
+ *
+ * Input parameters:
+ * camHal - camera HAL handle
+ *
+ * Return values:
+ * 0 No error
+ * -1 Error
+ *
+ * Notes: none
+ *****************************************************************************/
+int usbCamInitDefaultParameters(camera_hardware_t *camHal);
+
+/******************************************************************************
+ * Function: usbCamSetParameters
+ * Description: This function parses the parameter string and stores the
+ * parameters in the camera HAL handle
+ *
+ * Input parameters:
+ * camHal - camera HAL handle
+ * params - pointer to parameter string
+ *
+ * Return values:
+ * 0 Success
+ * -1 Error
+ * Notes: none
+ *****************************************************************************/
+int usbCamSetParameters(camera_hardware_t *camHal, const char *params);
+
+/******************************************************************************
+ * Function: usbCamGetParameters
+ * Description: This function allocates memory for parameter string,
+ * composes and returns the parameter string
+ *
+ * Input parameters:
+ * camHal - camera HAL handle
+ *
+ * Return values:
+ * Address to the parameter string
+ *
+ * Notes: none
+ *****************************************************************************/
+char* usbCamGetParameters(camera_hardware_t *camHal);
+
+/******************************************************************************
+ * Function: usbCamPutParameters
+ * Description: This function frees the memory allocated for parameter string
+ *
+ * Input parameters:
+ * camHal - camera HAL handle
+ * parms - Parameter string
+ *
+ * Return values:
+ * 0 Success
+ * -1 Error
+ * Notes: none
+ *****************************************************************************/
+void usbCamPutParameters(camera_hardware_t *camHal, char *parms);
+
+}; // namespace android
+
+#endif /* ANDROID_HARDWARE_QCAMERA_USB_PARM_H */
diff --git a/camera/usbcamcore/inc/QCameraUsbPriv.h b/camera/usbcamcore/inc/QCameraUsbPriv.h
new file mode 100755
index 0000000..9b60c11
--- /dev/null
+++ b/camera/usbcamcore/inc/QCameraUsbPriv.h
@@ -0,0 +1,202 @@
+/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ANDROID_HARDWARE_QCAMERA_USB_PRIV_H
+#define ANDROID_HARDWARE_QCAMERA_USB_PRIV_H
+
+namespace android {
+
+/* File name length in number of characters */
+#define FILENAME_LENGTH (256)
+
+/* Number of display buffers (in addition to minimum number of undequed buffers */
+#define PRVW_DISP_BUF_CNT 2
+
+/* Number of V4L2 capture buffers. */
+#define PRVW_CAP_BUF_CNT 4
+
+/* Maximum buffer size for JPEG output in number of bytes */
+#define MAX_JPEG_BUFFER_SIZE (1024 * 1024)
+
+/* Preview loop commands */
+#define USB_CAM_PREVIEW_EXIT (0x100)
+#define USB_CAM_PREVIEW_PAUSE (0x101)
+#define USB_CAM_PREVIEW_TAKEPIC (0x200)
+
+/******************************************************************************
+ * Macro function to input validate device handle
+ *****************************************************************************/
+#define VALIDATE_DEVICE_HDL(camHal, device, ret_err_code) {\
+ if(device && device->priv){\
+ camHal = (camera_hardware_t *)device->priv;\
+ }else{\
+ ALOGE("%s: Null device or device->priv", __func__);\
+ return ret_err_code;\
+ }\
+}\
+
+/******************************************************************************
+ * Macro function to check return status of a function, log and exit the thread
+ *****************************************************************************/
+#define ERROR_CHECK_EXIT_THREAD(rc, string) {\
+ if(rc < 0) {\
+ ALOGE("%s: Error %s", __func__, string);\
+ return (void *)-1;\
+ }\
+}
+
+/******************************************************************************
+ * Macro function to check return status of a function, log and exit
+ *****************************************************************************/
+#define ERROR_CHECK_EXIT(rc, string) {\
+ if(rc < 0) {\
+ ALOGE("%s: Error %s", __func__, string);\
+ return -1;\
+ }\
+}
+
+/******************************************************************************
+* Macro function to Print the parameter string 1000 characters at a time
+******************************************************************************/
+#define PRINT_PARAM_STR(parms) {\
+ char temp[1001] = {0};\
+ int n=0;\
+ while(1) {\
+ strlcpy(temp,parms+n,1000);\
+ ALOGD("parms = %s", temp);\
+ if (strlen(temp) < 1000) break;\
+ n += 1000;\
+ }\
+ }\
+
+/******************************************************************************
+ * Macro function to open camera
+ *****************************************************************************/
+#define USB_CAM_OPEN(camHal) {\
+ camHal->fd = open(camHal->dev_name, O_RDWR | O_NONBLOCK, 0);\
+ if(!camHal->fd)\
+ ALOGE("%s: Error in open", __func__);\
+ else\
+ ALOGD("%s: Successfully opened", __func__);\
+ }\
+
+/******************************************************************************
+ * Macro function to close camera
+ *****************************************************************************/
+#define USB_CAM_CLOSE(camHal) {\
+ int rc;\
+ if(camHal->fd){\
+ rc = close(camHal->fd);\
+ if(0 > rc){\
+ ALOGE("%s: close failed ", __func__);\
+ }\
+ else{\
+ camHal->fd = 0;\
+ ALOGD("%s: close successful", __func__);\
+ }\
+ }\
+ }\
+
+struct bufObj {
+ void *data;
+ int len;
+};
+
+typedef struct {
+ camera_device hw_dev;
+ Mutex lock;
+ int previewEnabledFlag;
+ int prvwStoppedForPicture;
+ int msgEnabledFlag;
+ volatile int prvwCmdPending;
+ volatile int prvwCmd;
+ pthread_t previewThread;
+ pthread_t takePictureThread;
+
+ camera_notify_callback notify_cb;
+ camera_data_callback data_cb;
+ camera_data_timestamp_callback data_cb_timestamp;
+ camera_request_memory get_memory;
+ void* cb_ctxt;
+
+ /* capture related members */
+ /* prevFormat is pixel format of preview buffers that are exported */
+ int prevFormat;
+ int prevFps;
+ int prevWidth;
+ int prevHeight;
+ /* captureFormat is internal setting for USB camera buffers */
+ int captureFormat;
+ char dev_name[FILENAME_LENGTH];
+ int fd;
+ unsigned int n_buffers;
+ struct v4l2_buffer curCaptureBuf;
+ struct bufObj *buffers;
+
+ /* Display related members */
+ preview_stream_ops* window;
+ QCameraHalMemory_t previewMem;
+ /* dispFormat is preview display format.Same as preview buffer format*/
+ int dispFormat;
+ int dispWidth;
+ int dispHeight;
+
+ /* MJPEG decoder related members */
+ /* MJPEG decoder object */
+ void* mjpegd;
+
+ /* JPEG picture and thumbnail related members */
+ int pictFormat;
+ int pictWidth;
+ int pictHeight;
+ int pictJpegQlty;
+ int thumbnailWidth;
+ int thumbnailHeight;
+ int thumbnailJpegQlty;
+ QCameraHalMemory_t pictMem;
+ int takePictInProgress;
+ int jpegEncInProgress;
+ pthread_mutex_t jpegEncMutex;
+ pthread_cond_t jpegEncCond;
+
+ /* */
+ QCameraParameters qCamParams;
+ String8 prevSizeValues;
+ String8 pictSizeValues;
+ String8 thumbnailSizeValues;
+ String8 vidSizeValues;
+ String8 pictFormatValues;
+ String8 prevFormatValues;
+ String8 prevFpsRangesValues;
+
+} camera_hardware_t;
+
+
+}; // namespace android
+
+#endif /* ANDROID_HARDWARE_QCAMERA_USB_PRIV_H */
diff --git a/camera/usbcamcore/inc/QualcommUsbCamera.h b/camera/usbcamcore/inc/QualcommUsbCamera.h
new file mode 100755
index 0000000..e389c76
--- /dev/null
+++ b/camera/usbcamcore/inc/QualcommUsbCamera.h
@@ -0,0 +1,243 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ANDROID_HARDWARE_QUALCOMM_CAMERA_USBCAM_H
+#define ANDROID_HARDWARE_QUALCOMM_CAMERA_USBCAM_H
+
+extern "C" {
+#include <sys/time.h>
+}
+
+#include "QCameraHWI.h"
+
+extern "C" {
+
+/*#include <hardware/camera.h>*/
+
+ int usbcam_get_number_of_cameras();
+ int usbcam_get_camera_info(int camera_id, struct camera_info *info);
+
+ int usbcam_camera_device_open(const struct hw_module_t* module, const char* id,
+ struct hw_device_t** device);
+
+ hw_device_t * usbcam_open_camera_device(int cameraId);
+
+ int usbcam_close_camera_device( hw_device_t *);
+
+namespace android {
+
+ /** Set the ANativeWindow to which preview frames are sent */
+ int usbcam_set_preview_window(struct camera_device *,
+ struct preview_stream_ops *window);
+
+ /** Set the notification and data callbacks */
+ void usbcam_set_CallBacks(struct camera_device *,
+ camera_notify_callback notify_cb,
+ camera_data_callback data_cb,
+ camera_data_timestamp_callback data_cb_timestamp,
+ camera_request_memory get_memory,
+ void *user);
+
+ /**
+ * The following three functions all take a msg_type, which is a bitmask of
+ * the messages defined in include/ui/Camera.h
+ */
+
+ /**
+ * Enable a message, or set of messages.
+ */
+ void usbcam_enable_msg_type(struct camera_device *, int32_t msg_type);
+
+ /**
+ * Disable a message, or a set of messages.
+ *
+ * Once received a call to disableMsgType(CAMERA_MSG_VIDEO_FRAME), camera
+ * HAL should not rely on its client to call releaseRecordingFrame() to
+ * release video recording frames sent out by the cameral HAL before and
+ * after the disableMsgType(CAMERA_MSG_VIDEO_FRAME) call. Camera HAL
+ * clients must not modify/access any video recording frame after calling
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME).
+ */
+ void usbcam_disable_msg_type(struct camera_device *, int32_t msg_type);
+
+ /**
+ * Query whether a message, or a set of messages, is enabled. Note that
+ * this is operates as an AND, if any of the messages queried are off, this
+ * will return false.
+ */
+ int usbcam_msg_type_enabled(struct camera_device *, int32_t msg_type);
+
+ /**
+ * Start preview mode.
+ */
+ int usbcam_start_preview(struct camera_device *);
+
+ /**
+ * Stop a previously started preview.
+ */
+ void usbcam_stop_preview(struct camera_device *);
+
+ /**
+ * Returns true if preview is enabled.
+ */
+ int usbcam_preview_enabled(struct camera_device *);
+
+ /**
+ * Request the camera HAL to store meta data or real YUV data in the video
+ * buffers sent out via CAMERA_MSG_VIDEO_FRAME for a recording session. If
+ * it is not called, the default camera HAL behavior is to store real YUV
+ * data in the video buffers.
+ *
+ * This method should be called before startRecording() in order to be
+ * effective.
+ *
+ * If meta data is stored in the video buffers, it is up to the receiver of
+ * the video buffers to interpret the contents and to find the actual frame
+ * data with the help of the meta data in the buffer. How this is done is
+ * outside of the scope of this method.
+ *
+ * Some camera HALs may not support storing meta data in the video buffers,
+ * but all camera HALs should support storing real YUV data in the video
+ * buffers. If the camera HAL does not support storing the meta data in the
+ * video buffers when it is requested to do do, INVALID_OPERATION must be
+ * returned. It is very useful for the camera HAL to pass meta data rather
+ * than the actual frame data directly to the video encoder, since the
+ * amount of the uncompressed frame data can be very large if video size is
+ * large.
+ *
+ * @param enable if true to instruct the camera HAL to store
+ * meta data in the video buffers; false to instruct
+ * the camera HAL to store real YUV data in the video
+ * buffers.
+ *
+ * @return OK on success.
+ */
+ int usbcam_store_meta_data_in_buffers(struct camera_device *, int enable);
+
+ /**
+ * Start record mode. When a record image is available, a
+ * CAMERA_MSG_VIDEO_FRAME message is sent with the corresponding
+ * frame. Every record frame must be released by a camera HAL client via
+ * releaseRecordingFrame() before the client calls
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME). After the client calls
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
+ * responsibility to manage the life-cycle of the video recording frames,
+ * and the client must not modify/access any video recording frames.
+ */
+ int usbcam_start_recording(struct camera_device *);
+
+ /**
+ * Stop a previously started recording.
+ */
+ void usbcam_stop_recording(struct camera_device *);
+
+ /**
+ * Returns true if recording is enabled.
+ */
+ int usbcam_recording_enabled(struct camera_device *);
+
+ /**
+ * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME.
+ *
+ * It is camera HAL client's responsibility to release video recording
+ * frames sent out by the camera HAL before the camera HAL receives a call
+ * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to
+ * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
+ * responsibility to manage the life-cycle of the video recording frames.
+ */
+ void usbcam_release_recording_frame(struct camera_device *,
+ const void *opaque);
+
+ /**
+ * Start auto focus, the notification callback routine is called with
+ * CAMERA_MSG_FOCUS once when focusing is complete. autoFocus() will be
+ * called again if another auto focus is needed.
+ */
+ int usbcam_auto_focus(struct camera_device *);
+
+ /**
+ * Cancels auto-focus function. If the auto-focus is still in progress,
+ * this function will cancel it. Whether the auto-focus is in progress or
+ * not, this function will return the focus position to the default. If
+ * the camera does not support auto-focus, this is a no-op.
+ */
+ int usbcam_cancel_auto_focus(struct camera_device *);
+
+ /**
+ * Take a picture.
+ */
+ int usbcam_take_picture(struct camera_device *);
+
+ /**
+ * Cancel a picture that was started with takePicture. Calling this method
+ * when no picture is being taken is a no-op.
+ */
+ int usbcam_cancel_picture(struct camera_device *);
+
+ /**
+ * Set the camera parameters. This returns BAD_VALUE if any parameter is
+ * invalid or not supported.
+ */
+ int usbcam_set_parameters(struct camera_device *, const char *parms);
+
+ //status_t setParameters(const QCameraParameters& params);
+ /** Retrieve the camera parameters. The buffer returned by the camera HAL
+ must be returned back to it with put_parameters, if put_parameters
+ is not NULL.
+ */
+ char* usbcam_get_parameters(struct camera_device *);
+
+ /** The camera HAL uses its own memory to pass us the parameters when we
+ call get_parameters. Use this function to return the memory back to
+ the camera HAL, if put_parameters is not NULL. If put_parameters
+ is NULL, then you have to use free() to release the memory.
+ */
+ void usbcam_put_parameters(struct camera_device *, char *);
+
+ /**
+ * Send command to camera driver.
+ */
+ int usbcam_send_command(struct camera_device *,
+ int32_t cmd, int32_t arg1, int32_t arg2);
+
+ /**
+ * Release the hardware resources owned by this object. Note that this is
+ * *not* done in the destructor.
+ */
+ void usbcam_release(struct camera_device *);
+
+ /**
+ * Dump state of the camera hardware
+ */
+ int usbcam_dump(struct camera_device *, int fd);
+
+}; // namespace android
+
+} //extern "C"
+
+#endif