summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2017-11-30 14:53:46 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2017-11-30 14:53:46 +0800
commit33c69bb78f76721d5376ba2f9f65635e3365b656 (patch)
treedea1660550933fd13997fb654e3907f79e43a488
parentc2bc9c838943dd1aac6cdee5dc1523550b7714b0 (diff)
fixed for compiling warningslinaro-android
many warnings are reported as errors when compiling with AOSP master Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--libcamera/CameraHal_Module.cpp88
-rw-r--r--libcamera/CameraHardware.cpp32
-rw-r--r--libcamera/V4L2Camera.cpp1
-rw-r--r--libcamera/rgbconvert.c2
-rw-r--r--libcamera/webcam-tools.c10
5 files changed, 62 insertions, 71 deletions
diff --git a/libcamera/CameraHal_Module.cpp b/libcamera/CameraHal_Module.cpp
index b6a4e1b..25b35b9 100644
--- a/libcamera/CameraHal_Module.cpp
+++ b/libcamera/CameraHal_Module.cpp
@@ -50,7 +50,6 @@
#include <utils/threads.h>
#include <android/log.h>
#include "V4L2Camera.h"
-#define LOG_FUNCTION_NAME ALOGD("%d: %s() ENTER", __LINE__, __FUNCTION__);
using namespace android;
static CameraHardware *V4L2CameraHardware;
@@ -60,23 +59,23 @@ static int camera_device_close(hw_device_t* device);
static int camera_get_number_of_cameras(void);
static int camera_get_camera_info(int camera_id, struct camera_info *info);
static struct hw_module_methods_t camera_module_methods = {
- open: camera_device_open
+ .open = camera_device_open
};
camera_module_t HAL_MODULE_INFO_SYM = {
- common: {
- tag: HARDWARE_MODULE_TAG,
- version_major: 1,
- version_minor: 0,
- id: CAMERA_HARDWARE_MODULE_ID,
- name: "V4L2 CameraHal Module",
- author: "Linaro",
- methods: &camera_module_methods,
- dso: NULL, /* remove compilation warnings */
- reserved: {0}, /* remove compilation warnings */
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = CAMERA_HARDWARE_MODULE_ID,
+ .name = "V4L2 CameraHal Module",
+ .author = "Linaro",
+ .methods = &camera_module_methods,
+ .dso = NULL, /* remove compilation warnings */
+ .reserved = {0}, /* remove compilation warnings */
},
- get_number_of_cameras: camera_get_number_of_cameras,
- get_camera_info: camera_get_camera_info,
+ .get_number_of_cameras = camera_get_number_of_cameras,
+ .get_camera_info = camera_get_camera_info,
};
typedef struct V4L2_camera_device {
@@ -98,63 +97,58 @@ int camera_set_preview_window(struct camera_device * device,
if(!device)
return rv;
- if(window==NULL)
- {
+ if(window==NULL) {
ALOGW("window is NULL");
V4L2CameraHardware->setPreviewWindow(window);
return -1;
}
- V4L2CameraHardware->setPreviewWindow(window);
+ V4L2CameraHardware->setPreviewWindow(window);
ALOGD("Exiting the function");
return 0;
}
-void camera_set_callbacks(struct camera_device * device,
+void camera_set_callbacks(struct camera_device * /*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)
{
- V4l2_camera_device_t* V4l2_dev = NULL;
LOG_FUNCTION_NAME
V4L2CameraHardware->setCallbacks(notify_cb,data_cb,data_cb_timestamp,get_memory,user);
}
-void camera_enable_msg_type(struct camera_device * device, int32_t msg_type)
+void camera_enable_msg_type(struct camera_device * /*device*/, int32_t msg_type)
{
- V4l2_camera_device_t* V4l2_dev = NULL;
LOG_FUNCTION_NAME
V4L2CameraHardware->enableMsgType(msg_type);
}
-void camera_disable_msg_type(struct camera_device * device, int32_t msg_type)
+void camera_disable_msg_type(struct camera_device * /*device*/, int32_t msg_type)
{
- V4l2_camera_device_t* V4l2_dev = NULL;
LOG_FUNCTION_NAME
V4L2CameraHardware->disableMsgType(msg_type);
}
-int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type)
+int camera_msg_type_enabled(struct camera_device * /*device*/, int32_t msg_type)
{
- V4l2_camera_device_t* V4l2_dev = NULL;
LOG_FUNCTION_NAME
return V4L2CameraHardware->msgTypeEnabled(msg_type);
}
-int camera_start_preview(struct camera_device * device){
+int camera_start_preview(struct camera_device * /*device*/){
LOG_FUNCTION_NAME
return V4L2CameraHardware->startPreview();
}
-void camera_stop_preview(struct camera_device * device){
+void camera_stop_preview(struct camera_device * /*device*/){
LOG_FUNCTION_NAME
V4L2CameraHardware->stopPreview();
}
-int camera_preview_enabled(struct camera_device * device)
+int camera_preview_enabled(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
if(V4L2CameraHardware->previewEnabled()) {
@@ -166,64 +160,64 @@ int camera_preview_enabled(struct camera_device * device)
}
}
-int camera_store_meta_data_in_buffers(struct camera_device * device, int enable)
+int camera_store_meta_data_in_buffers(struct camera_device * /*device*/, int /*enable*/)
{
int rv = -EINVAL;
LOG_FUNCTION_NAME
return rv;
}
-int camera_start_recording(struct camera_device * device)
+int camera_start_recording(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
return V4L2CameraHardware->startRecording();
}
-void camera_stop_recording(struct camera_device * device)
+void camera_stop_recording(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
V4L2CameraHardware->stopRecording();
}
-int camera_recording_enabled(struct camera_device * device)
+int camera_recording_enabled(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
return V4L2CameraHardware->recordingEnabled();
}
-void camera_release_recording_frame(struct camera_device * device,
+void camera_release_recording_frame(struct camera_device * /*device*/,
const void *opaque)
{
LOG_FUNCTION_NAME
return V4L2CameraHardware->releaseRecordingFrame(opaque);
}
-int camera_auto_focus(struct camera_device * device)
+int camera_auto_focus(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
return V4L2CameraHardware->autoFocus();
}
-int camera_cancel_auto_focus(struct camera_device * device)
+int camera_cancel_auto_focus(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
return V4L2CameraHardware->cancelAutoFocus();
}
-int camera_take_picture(struct camera_device * device)
+int camera_take_picture(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
return V4L2CameraHardware->takePicture();
}
-int camera_cancel_picture(struct camera_device * device)
+int camera_cancel_picture(struct camera_device * /*device*/)
{
- int rv = 0;// -EINVAL;
+ //int rv = 0;// -EINVAL;
LOG_FUNCTION_NAME
return V4L2CameraHardware->cancelPicture();
}
-int camera_set_parameters(struct camera_device * device, const char *params)
+int camera_set_parameters(struct camera_device * /*device*/, const char *params)
{
LOG_FUNCTION_NAME
CameraParameters *camParams = new CameraParameters();
@@ -232,7 +226,7 @@ int camera_set_parameters(struct camera_device * device, const char *params)
return V4L2CameraHardware->setParameters(*camParams);
}
-char* camera_get_parameters(struct camera_device * device)
+char* camera_get_parameters(struct camera_device * /*device*/)
{
char* param = NULL ;
#if 1
@@ -246,7 +240,7 @@ char* camera_get_parameters(struct camera_device * device)
return param;
}
-static void camera_put_parameters(struct camera_device *device, char *params)
+static void camera_put_parameters(struct camera_device * /*device*/, char *params)
{
LOG_FUNCTION_NAME
CameraParameters *camParams = new CameraParameters();
@@ -255,22 +249,22 @@ static void camera_put_parameters(struct camera_device *device, char *params)
V4L2CameraHardware->setParameters(*camParams);
}
-int camera_send_command(struct camera_device * device,
- int32_t cmd, int32_t arg1, int32_t arg2)
+int camera_send_command(struct camera_device * /*device*/,
+ int32_t /*cmd*/, int32_t /*arg1*/, int32_t /*arg2*/)
{
int rv =0;// -EINVAL;
LOG_FUNCTION_NAME
return rv;
}
-void camera_release(struct camera_device * device)
+void camera_release(struct camera_device * /*device*/)
{
LOG_FUNCTION_NAME
V4L2CameraHardware->release();
}
-int camera_dump(struct camera_device * device, int fd)
+int camera_dump(struct camera_device * /*device*/, int /*fd*/)
{
int rv = 0;//-EINVAL;
LOG_FUNCTION_NAME
@@ -279,7 +273,7 @@ int camera_dump(struct camera_device * device, int fd)
extern "C" void heaptracker_free_leaked_memory(void);
-int camera_device_close(hw_device_t* device)
+int camera_device_close(hw_device_t* /*device*/)
{
int ret = 0;
LOG_FUNCTION_NAME
@@ -407,7 +401,7 @@ int camera_get_camera_info(int camera_id, struct camera_info *info)
int rv = 0;
int face_value = CAMERA_FACING_FRONT;
int orientation = 0;
- const char *valstr = NULL;
+ //const char *valstr = NULL;
if(camera_id == 0) {
info->facing = CAMERA_FACING_BACK;
ALOGD("cameraHal BACK %d",camera_id);
diff --git a/libcamera/CameraHardware.cpp b/libcamera/CameraHardware.cpp
index fb10c91..a161039 100644
--- a/libcamera/CameraHardware.cpp
+++ b/libcamera/CameraHardware.cpp
@@ -55,11 +55,11 @@ CameraHardware::CameraHardware(int cameraId)
mParameters(),
mHeap(0),
mPreviewHeap(0),
- mRecordHeap(0),
mRawHeap(0),
+ mRecordHeap(0),
+ mRecordRunning(false),
mPreviewFrameSize(0),
mCurrentPreviewFrame(0),
- mRecordRunning(false),
previewStopped(true),
nQueued(0),
nDequeued(0),
@@ -181,7 +181,6 @@ int CameraHardware::previewThread()
int width, height;
int err;
IMG_native_handle_t** hndl2hndl;
- IMG_native_handle_t* handle;
int stride;
mParameters.getPreviewSize(&width, &height);
int framesize= width * height * 1.5 ; //yuv420sp
@@ -241,9 +240,6 @@ status_t CameraHardware::startPreview()
int ret;
int width, height;
int i;
- IMG_native_handle_t** hndl2hndl;
- IMG_native_handle_t* handle;
- int stride;
char devnode[15];
Mutex::Autolock lock(mLock);
if (mPreviewThread != 0) {
@@ -269,14 +265,14 @@ status_t CameraHardware::startPreview()
mBuffer = new MemoryBase(mHeap, 0, mPreviewFrameSize);
ret = camera.Init();
- if (ret != 0) {
+ if (ret != 0) {
ALOGI("startPreview: Camera.Init failed\n");
camera.Close();
return ret;
}
ret = camera.StartStreaming();
- if (ret != 0) {
+ if (ret != 0) {
ALOGI("startPreview: Camera.StartStreaming failed\n");
camera.Uninit();
camera.Close();
@@ -345,7 +341,7 @@ bool CameraHardware::recordingEnabled()
return mRecordRunning;
}
-void CameraHardware::releaseRecordingFrame(const void *opaque)
+void CameraHardware::releaseRecordingFrame(const void * /*opaque*/)
{
}
@@ -387,15 +383,15 @@ status_t CameraHardware::cancelAutoFocus()
int CameraHardware::pictureThread()
{
ALOGD ("CameraHardware::pictureThread");
- unsigned char *frame;
- int bufferSize;
+ //unsigned char *frame;
+ //int bufferSize;
int w,h;
int ret;
- struct v4l2_buffer buffer;
- struct v4l2_format format;
- struct v4l2_buffer cfilledbuffer;
- struct v4l2_requestbuffers creqbuf;
- struct v4l2_capability cap;
+ //struct v4l2_buffer buffer;
+ //struct v4l2_format format;
+ //struct v4l2_buffer cfilledbuffer;
+ //struct v4l2_requestbuffers creqbuf;
+ //struct v4l2_capability cap;
int i;
char devnode[15];
camera_memory_t* picture = NULL;
@@ -457,7 +453,7 @@ status_t CameraHardware::cancelPicture()
return NO_ERROR;
}
-status_t CameraHardware::dump(int fd, const Vector<String16>& args) const
+status_t CameraHardware::dump(int /*fd*/, const Vector<String16>& /*args*/) const
{
return NO_ERROR;
}
@@ -538,7 +534,7 @@ status_t CameraHardware::setParameters(const CameraParameters& params)
return NO_ERROR;
}
-status_t CameraHardware::sendCommand(int32_t command, int32_t arg1, int32_t arg2)
+status_t CameraHardware::sendCommand(int32_t /*command*/, int32_t /*arg1*/, int32_t /*arg2*/)
{
return BAD_VALUE;
}
diff --git a/libcamera/V4L2Camera.cpp b/libcamera/V4L2Camera.cpp
index fdd0c41..0e60829 100644
--- a/libcamera/V4L2Camera.cpp
+++ b/libcamera/V4L2Camera.cpp
@@ -302,7 +302,6 @@ int MemoryStream::readPipe()
}
bool V4L2Camera::GrabValidFrame(){
- int ret;
unsigned int count = 5;
while(count-- > 0){
diff --git a/libcamera/rgbconvert.c b/libcamera/rgbconvert.c
index 0837a93..cfc2cea 100644
--- a/libcamera/rgbconvert.c
+++ b/libcamera/rgbconvert.c
@@ -31,7 +31,7 @@ void yuv_to_rgb16(unsigned char y, unsigned char u, unsigned char v, unsigned ch
void convertYUYVtoRGB565(unsigned char *buf, unsigned char *rgb, int width, int height)
{
- int x,y,z=0;
+ int y=0;
int blocks;
blocks = (width * height) * 2;
diff --git a/libcamera/webcam-tools.c b/libcamera/webcam-tools.c
index 01a3501..2054ba9 100644
--- a/libcamera/webcam-tools.c
+++ b/libcamera/webcam-tools.c
@@ -729,7 +729,8 @@ static inline int minmax(int min, int v, int max) {
return (v < min) ? min : (max < v) ? max : v;
}
static inline uint8_t yuv2r(int y, int u, int v) {
- int c = y-16, d = u - 128, e = v - 128;
+ (void)(u);
+ int c = y-16, /*d = u - 128,*/ e = v - 128;
// https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/1071301e-74a2-4de4-be72-81c34604cde9/program-to-translate-yuyv-to-rgbrgb?forum=windowsdirectshowdevelopment
int r = (298 * c + 409 * e + 128) >> 8;
// linaro webcam
@@ -745,7 +746,8 @@ static inline uint8_t yuv2g(int y, int u, int v) {
return minmax(0, g, 255);
}
static inline uint8_t yuv2b(int y, int u, int v) {
- int c = y - 16, d = u - 128, e = v - 128;
+ (void)(v);
+ int c = y - 16, d = u - 128 /* , e = v - 128*/;
int b = (298 * c + 516 * d + 128) >> 8;
//int b = (1.164 * c + 2.018 * d );
//int b = (y + 454 * u) >> 8;
@@ -754,8 +756,8 @@ static inline uint8_t yuv2b(int y, int u, int v) {
unsigned char* yuyv2rgb(const unsigned char* yuyv, uint32_t width, uint32_t height) {
unsigned char* rgb = calloc(width * height * 3, sizeof (unsigned char));
- for (long i = 0; i < height; i++) {
- for ( long j = 0; j < width; j += 2) {
+ for (uint32_t i = 0; i < height; i++) {
+ for ( uint32_t j = 0; j < width; j += 2) {
long indexPixel = i * width + j;
long indexYUYV = indexPixel * 2, indexRGB = indexPixel * 3;
unsigned char y0 = yuyv[indexYUYV + 0] ;