camera: cleanup makefiles, build with -Wall -Werror, fix warnings

Change-Id: I06de62e53e95e5f6dbc19773fec0d4070c839c96
This commit is contained in:
Ziyan 2017-04-16 20:55:07 +02:00 committed by Artem Borisov
parent 762539b3d4
commit a6ff72a04a
17 changed files with 55 additions and 112 deletions

View File

@ -1,9 +1 @@
ifeq ($(strip $(USE_DEVICE_SPECIFIC_CAMERA)),true)
ifneq ($(filter msm8960 msm8226 msm8974,$(TARGET_BOARD_PLATFORM)),)
ifneq ($(USE_CAMERA_STUB),true)
ifneq ($(BUILD_TINY_ANDROID),true)
include $(call all-subdir-makefiles)
endif
endif
endif
endif
include $(call all-subdir-makefiles)

View File

@ -1,3 +1 @@
ifeq ($(TARGET_ARCH),arm)
include $(call all-subdir-makefiles)
endif
include $(call all-subdir-makefiles)

View File

@ -13,7 +13,7 @@ LOCAL_SRC_FILES := \
../util/QCameraCmdThread.cpp \
../util/QCameraQueue.cpp
LOCAL_CFLAGS := -Wall
LOCAL_CFLAGS := -Wall -Werror
LOCAL_CFLAGS += -DHAS_MULTIMEDIA_HINTS
LOCAL_C_INCLUDES := \
@ -38,11 +38,7 @@ LOCAL_SHARED_LIBRARIES := libcamera_client liblog libhardware libutils libcutils
LOCAL_SHARED_LIBRARIES += libmmcamera_interface libmmjpeg_interface libui libcamera_metadata
LOCAL_MODULE_RELATIVE_PATH := hw
#LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE := camera.$(TARGET_DEVICE)
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_SHARED_LIBRARY)
#include $(LOCAL_PATH)/test/Android.mk

View File

@ -50,8 +50,6 @@ using namespace android;
namespace qcamera {
static const char ExifAsciiPrefix[] =
{ 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 }; // "ASCII\0\0\0"
static const char ExifUndefinedPrefix[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // "\0\0\0\0\0\0\0\0"
#define GPS_PROCESSING_METHOD_SIZE 101
#define EXIF_ASCII_PREFIX_SIZE 8 //(sizeof(ExifAsciiPrefix))
@ -774,7 +772,7 @@ int32_t QCamera3MetadataChannel::registerBuffers(uint32_t /*num_buffers*/,
void QCamera3MetadataChannel::streamCbRoutine(
mm_camera_super_buf_t *super_frame,
QCamera3Stream *stream)
QCamera3Stream *stream __unused)
{
uint32_t requestNumber = 0;
if (super_frame == NULL || super_frame->num_bufs != 1) {
@ -1648,20 +1646,16 @@ QCamera3Exif *QCamera3PicChannel::getExifData()
1,
(void *)&(isoSpeed));
rat_t sensorExpTime, temp;
rat_t sensorExpTime;
rc = getExifExpTimeInfo(&sensorExpTime, (int64_t)mJpegSettings->sensor_exposure_time);
if(sensorExpTime.denom <= 0) {// avoid zero-divide problem
sensorExpTime.denom = 0.01668; // expoure time will be 1/60 s
uint16_t temp2 = (uint16_t)(sensorExpTime.denom <= 0 * 100000);
temp2 = (uint16_t)(100000 / temp2);
temp.num = 1;
temp.denom = temp2;
memcpy(&sensorExpTime, &temp, sizeof(sensorExpTime));
if (rc == NO_ERROR) {
exif->addEntry(EXIFTAGID_EXPOSURE_TIME,
EXIF_LONG,
1,
(void *) &(sensorExpTime.denom));
} else {
ALOGE("%s: getExifExpTimeInfo failed", __func__);
}
exif->addEntry(EXIFTAGID_EXPOSURE_TIME,
EXIF_LONG,
1,
(void *) &(sensorExpTime.denom));
if (strlen(mJpegSettings->gps_processing_method) > 0) {
char gpsProcessingMethod[EXIF_ASCII_PREFIX_SIZE + GPS_PROCESSING_METHOD_SIZE];
@ -1977,7 +1971,8 @@ QCamera3ReprocessChannel::QCamera3ReprocessChannel() :
*
* RETURN : none
*==========================================================================*/
int32_t QCamera3ReprocessChannel::registerBuffers(uint32_t num_buffers, buffer_handle_t **buffers)
int32_t QCamera3ReprocessChannel::registerBuffers(uint32_t num_buffers __unused,
buffer_handle_t **buffers __unused)
{
return 0;
}

View File

@ -205,7 +205,7 @@ int QCamera3Factory::camera_device_open(
}
struct hw_module_methods_t QCamera3Factory::mModuleMethods = {
open: QCamera3Factory::camera_device_open,
.open = QCamera3Factory::camera_device_open,
};
}; // namespace qcamera

View File

@ -130,13 +130,13 @@ const int32_t available_thumbnail_sizes[] = {512, 288, 480, 288, 256, 154, 432,
320, 240, 176, 144, 0, 0};
camera3_device_ops_t QCamera3HardwareInterface::mCameraOps = {
initialize: QCamera3HardwareInterface::initialize,
configure_streams: QCamera3HardwareInterface::configure_streams,
register_stream_buffers: QCamera3HardwareInterface::register_stream_buffers,
construct_default_request_settings: QCamera3HardwareInterface::construct_default_request_settings,
process_capture_request: QCamera3HardwareInterface::process_capture_request,
get_metadata_vendor_tag_ops: QCamera3HardwareInterface::get_metadata_vendor_tag_ops,
dump: QCamera3HardwareInterface::dump,
.initialize = QCamera3HardwareInterface::initialize,
.configure_streams = QCamera3HardwareInterface::configure_streams,
.register_stream_buffers = QCamera3HardwareInterface::register_stream_buffers,
.construct_default_request_settings = QCamera3HardwareInterface::construct_default_request_settings,
.process_capture_request = QCamera3HardwareInterface::process_capture_request,
.get_metadata_vendor_tag_ops = QCamera3HardwareInterface::get_metadata_vendor_tag_ops,
.dump = QCamera3HardwareInterface::dump,
};

View File

@ -30,25 +30,25 @@
#include "QCamera3Factory.h"
static hw_module_t camera_common = {
tag: HARDWARE_MODULE_TAG,
module_api_version: CAMERA_MODULE_API_VERSION_2_0,
hal_api_version: HARDWARE_HAL_API_VERSION,
id: CAMERA_HARDWARE_MODULE_ID,
name: "QCamera Module",
author: "Qualcomm Innovation Center Inc",
methods: &qcamera::QCamera3Factory::mModuleMethods,
dso: NULL,
reserved: {0},
.tag = HARDWARE_MODULE_TAG,
.module_api_version = CAMERA_MODULE_API_VERSION_2_0,
.hal_api_version = HARDWARE_HAL_API_VERSION,
.id = CAMERA_HARDWARE_MODULE_ID,
.name = "QCamera Module",
.author = "Qualcomm Innovation Center Inc",
.methods = &qcamera::QCamera3Factory::mModuleMethods,
.dso = NULL,
.reserved = {0},
};
camera_module_t HAL_MODULE_INFO_SYM = {
common: camera_common,
get_number_of_cameras: qcamera::QCamera3Factory::get_number_of_cameras,
get_camera_info: qcamera::QCamera3Factory::get_camera_info,
set_callbacks: NULL,
get_vendor_tag_ops: NULL,
open_legacy: NULL,
set_torch_mode: NULL,
init: NULL,
reserved: {0}
.common = camera_common,
.get_number_of_cameras = qcamera::QCamera3Factory::get_number_of_cameras,
.get_camera_info = qcamera::QCamera3Factory::get_camera_info,
.set_callbacks = NULL,
.get_vendor_tag_ops = NULL,
.open_legacy = NULL,
.set_torch_mode = NULL,
.init = NULL,
.reserved = {0}
};

View File

@ -1,5 +1,3 @@
LOCAL_PATH:= $(call my-dir)
include $(LOCAL_PATH)/mm-camera-interface/Android.mk
include $(LOCAL_PATH)/mm-jpeg-interface/Android.mk
include $(LOCAL_PATH)/mm-jpeg-interface/test/Android.mk
include $(LOCAL_PATH)/mm-camera-test/Android.mk

View File

@ -15,10 +15,6 @@ ifeq ($(strip $(TARGET_USES_ION)),true)
LOCAL_CFLAGS += -DUSE_ION
endif
ifeq ($(call is-board-platform-in-list,msm8974 msm8226),true)
LOCAL_CFLAGS += -DVENUS_PRESENT
endif
LOCAL_CFLAGS += -D_ANDROID_
LOCAL_COPY_HEADERS_TO := mm-camera-interface
LOCAL_COPY_HEADERS += ../common/cam_intf.h

View File

@ -26,6 +26,8 @@ LOCAL_SRC_FILES := \
src/mm_jpeg.c \
src/mm_jpeg_interface.c
LOCAL_CFLAGS += -Wall -Werror
LOCAL_MODULE := libmmjpeg_interface
LOCAL_SHARED_LIBRARIES := libdl libcutils liblog libqomx_core
LOCAL_MODULE_TAGS := optional

View File

@ -29,6 +29,7 @@
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -264,7 +265,6 @@ OMX_ERRORTYPE mm_jpeg_session_send_buffers(void *data)
OMX_ERRORTYPE ret = OMX_ErrorNone;
QOMX_BUFFER_INFO lbuffer_info;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
memset(&lbuffer_info, 0x0, sizeof(QOMX_BUFFER_INFO));
for (i = 0; i < p_params->num_src_bufs; i++) {
@ -324,7 +324,6 @@ OMX_ERRORTYPE mm_jpeg_session_free_buffers(void *data)
uint32_t i = 0;
mm_jpeg_job_session_t* p_session = (mm_jpeg_job_session_t *)data;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
for (i = 0; i < p_params->num_src_bufs; i++) {
CDBG("%s:%d] Source buffer %d", __func__, __LINE__, i);
@ -442,7 +441,6 @@ OMX_ERRORTYPE mm_jpeg_session_change_state(mm_jpeg_job_session_t* p_session,
OMX_ERRORTYPE mm_jpeg_session_create(mm_jpeg_job_session_t* p_session)
{
OMX_ERRORTYPE rc = OMX_ErrorNone;
mm_jpeg_cirq_t *p_cirq = NULL;
pthread_mutex_init(&p_session->lock, NULL);
pthread_cond_init(&p_session->cond, NULL);
@ -534,7 +532,6 @@ OMX_ERRORTYPE mm_jpeg_session_config_main_buffer_offset(
mm_jpeg_job_session_t* p_session)
{
OMX_ERRORTYPE rc = 0;
int32_t i = 0;
OMX_INDEXTYPE buffer_index;
QOMX_YUV_FRAME_INFO frame_info;
int32_t totalSize = 0;
@ -594,12 +591,8 @@ OMX_ERRORTYPE mm_jpeg_encoding_mode(
mm_jpeg_job_session_t* p_session)
{
OMX_ERRORTYPE rc = 0;
int32_t i = 0;
OMX_INDEXTYPE indextype;
QOMX_ENCODING_MODE encoding_mode;
int32_t totalSize = 0;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
rc = OMX_GetExtensionIndex(p_session->omx_handle,
QOMX_IMAGE_EXT_ENCODING_MODE_NAME, &indextype);
@ -795,7 +788,6 @@ OMX_ERRORTYPE mm_jpeg_session_config_thumbnail(mm_jpeg_job_session_t* p_session)
OMX_ERRORTYPE ret = OMX_ErrorNone;
QOMX_THUMBNAIL_INFO thumbnail_info;
OMX_INDEXTYPE thumb_indextype;
OMX_BOOL encode_thumbnail = OMX_FALSE;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
mm_jpeg_dim_t *p_thumb_dim = &p_jobparams->thumb_dim;
@ -926,7 +918,6 @@ OMX_ERRORTYPE mm_jpeg_session_config_main_crop(mm_jpeg_job_session_t *p_session)
{
OMX_CONFIG_RECTTYPE rect_type_in, rect_type_out;
OMX_ERRORTYPE ret = OMX_ErrorNone;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
mm_jpeg_dim_t *dim = &p_jobparams->main_dim;
@ -1011,7 +1002,6 @@ OMX_ERRORTYPE mm_jpeg_session_config_main(mm_jpeg_job_session_t *p_session)
OMX_ERRORTYPE rc = OMX_ErrorNone;
OMX_IMAGE_PARAM_QFACTORTYPE q_factor;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
/* config port */
CDBG("%s:%d] config port", __func__, __LINE__);
@ -1066,7 +1056,6 @@ OMX_ERRORTYPE mm_jpeg_session_config_main(mm_jpeg_job_session_t *p_session)
OMX_ERRORTYPE mm_jpeg_session_config_common(mm_jpeg_job_session_t *p_session)
{
OMX_ERRORTYPE rc = OMX_ErrorNone;
int i;
OMX_INDEXTYPE exif_idx;
OMX_CONFIG_ROTATIONTYPE rotate;
mm_jpeg_encode_params_t *p_params = &p_session->params;
@ -1272,9 +1261,6 @@ inline mm_jpeg_job_session_t *mm_jpeg_get_session(mm_jpeg_obj *my_obj, uint32_t
static OMX_ERRORTYPE mm_jpeg_session_configure(mm_jpeg_job_session_t *p_session)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
mm_jpeg_obj *my_obj = (mm_jpeg_obj *)p_session->jpeg_obj;
CDBG("%s:%d] E ", __func__, __LINE__);
@ -1374,10 +1360,7 @@ static inline void mm_jpeg_job_done(mm_jpeg_job_session_t *p_session)
static OMX_ERRORTYPE mm_jpeg_session_encode(mm_jpeg_job_session_t *p_session)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
mm_jpeg_encode_params_t *p_params = &p_session->params;
mm_jpeg_encode_job_t *p_jobparams = &p_session->encode_job;
int dest_idx = 0;
mm_jpeg_obj *my_obj = (mm_jpeg_obj *)p_session->jpeg_obj;
pthread_mutex_lock(&p_session->lock);
p_session->abort_flag = OMX_FALSE;
@ -1454,7 +1437,6 @@ int32_t mm_jpeg_process_encoding_job(mm_jpeg_obj *my_obj, mm_jpeg_job_q_node_t*
int32_t rc = 0;
OMX_ERRORTYPE ret = OMX_ErrorNone;
mm_jpeg_job_session_t *p_session = NULL;
mm_jpeg_job_q_node_t *node = NULL;
/* check if valid session */
p_session = mm_jpeg_get_session(my_obj, job_node->enc_info.job_id);
@ -1863,9 +1845,7 @@ int32_t mm_jpeg_abort_job(mm_jpeg_obj *my_obj,
uint32_t jobId)
{
int32_t rc = -1;
uint8_t clnt_idx = 0;
mm_jpeg_job_q_node_t *node = NULL;
OMX_BOOL ret = OMX_FALSE;
mm_jpeg_job_session_t *p_session = NULL;
CDBG("%s:%d] ", __func__, __LINE__);
@ -1919,7 +1899,6 @@ int32_t mm_jpeg_create_session(mm_jpeg_obj *my_obj,
mm_jpeg_encode_params_t *p_params,
uint32_t* p_session_id)
{
int32_t rc = 0;
OMX_ERRORTYPE ret = OMX_ErrorNone;
uint8_t clnt_idx = 0;
int session_idx = -1;
@ -1982,9 +1961,7 @@ int32_t mm_jpeg_destroy_session(mm_jpeg_obj *my_obj,
mm_jpeg_job_session_t *p_session)
{
int32_t rc = 0;
uint8_t clnt_idx = 0;
mm_jpeg_job_q_node_t *node = NULL;
OMX_BOOL ret = OMX_FALSE;
uint32_t session_id = p_session->sessionId;
if (NULL == p_session) {
@ -2040,9 +2017,7 @@ int32_t mm_jpeg_destroy_session_unlocked(mm_jpeg_obj *my_obj,
mm_jpeg_job_session_t *p_session)
{
int32_t rc = -1;
uint8_t clnt_idx = 0;
mm_jpeg_job_q_node_t *node = NULL;
OMX_BOOL ret = OMX_FALSE;
uint32_t session_id = p_session->sessionId;
if (NULL == p_session) {
@ -2110,8 +2085,6 @@ int32_t mm_jpeg_close(mm_jpeg_obj *my_obj, uint32_t client_hdl)
{
int32_t rc = -1;
uint8_t clnt_idx = 0;
mm_jpeg_job_q_node_t *node = NULL;
OMX_BOOL ret = OMX_FALSE;
int i = 0;
/* check if valid client */
@ -2148,11 +2121,10 @@ int32_t mm_jpeg_close(mm_jpeg_obj *my_obj, uint32_t client_hdl)
return rc;
}
OMX_ERRORTYPE mm_jpeg_ebd(OMX_HANDLETYPE hComponent,
OMX_ERRORTYPE mm_jpeg_ebd(OMX_HANDLETYPE hComponent __unused,
OMX_PTR pAppData,
OMX_BUFFERHEADERTYPE *pBuffer)
OMX_BUFFERHEADERTYPE *pBuffer __unused)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
mm_jpeg_job_session_t *p_session = (mm_jpeg_job_session_t *) pAppData;
CDBG("%s:%d] count %d ", __func__, __LINE__, p_session->ebd_count);
@ -2162,14 +2134,12 @@ OMX_ERRORTYPE mm_jpeg_ebd(OMX_HANDLETYPE hComponent,
return 0;
}
OMX_ERRORTYPE mm_jpeg_fbd(OMX_HANDLETYPE hComponent,
OMX_ERRORTYPE mm_jpeg_fbd(OMX_HANDLETYPE hComponent __unused,
OMX_PTR pAppData,
OMX_BUFFERHEADERTYPE *pBuffer)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
mm_jpeg_job_session_t *p_session = (mm_jpeg_job_session_t *) pAppData;
uint32_t i = 0;
int rc = 0;
mm_jpeg_output_t output_buf;
CDBG("%s:%d] count %d ", __func__, __LINE__, p_session->fbd_count);
@ -2203,17 +2173,16 @@ OMX_ERRORTYPE mm_jpeg_fbd(OMX_HANDLETYPE hComponent,
return ret;
}
OMX_ERRORTYPE mm_jpeg_event_handler(OMX_HANDLETYPE hComponent,
OMX_ERRORTYPE mm_jpeg_event_handler(OMX_HANDLETYPE hComponent __unused,
OMX_PTR pAppData,
OMX_EVENTTYPE eEvent,
OMX_U32 nData1,
OMX_U32 nData2,
OMX_PTR pEventData)
OMX_U32 nData1 __unused,
OMX_U32 nData2 __unused,
OMX_PTR pEventData __unused)
{
mm_jpeg_job_session_t *p_session = (mm_jpeg_job_session_t *) pAppData;
CDBG("%s:%d] %d %d %d", __func__, __LINE__, eEvent, (int)nData1,
(int)nData2);
CDBG("%s:%d] event %d", __func__, __LINE__, eEvent);
pthread_mutex_lock(&p_session->lock);

View File

@ -30,6 +30,7 @@
#include "mm_jpeg_dbg.h"
#include "mm_jpeg.h"
#include <errno.h>
#include <stdlib.h>
#define LOWER(a) ((a) & 0xFFFF)

View File

@ -29,6 +29,7 @@
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -28,6 +28,7 @@
*/
#include <pthread.h>
#include <stdlib.h>
#include "mm_jpeg_dbg.h"
#include "mm_jpeg.h"
@ -107,7 +108,6 @@ int32_t mm_jpeg_queue_deinit(mm_jpeg_queue_t* queue)
int32_t mm_jpeg_queue_flush(mm_jpeg_queue_t* queue)
{
mm_jpeg_q_node_t* node = NULL;
void* data = NULL;
struct cam_list *head = NULL;
struct cam_list *pos = NULL;

View File

@ -1,3 +1 @@
ifeq ($(TARGET_ARCH),arm)
include $(call all-subdir-makefiles)
endif

View File

@ -8,7 +8,7 @@ include $(CLEAR_VARS)
LOCAL_PATH := $(OMX_CORE_PATH)
LOCAL_MODULE_TAGS := optional
omx_core_defines:= -Werror \
omx_core_defines:= -Wall -Werror \
-g -O0
LOCAL_CFLAGS := $(omx_core_defines)

View File

@ -32,8 +32,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
#include "qomx_core.h"
#define BUFF_SIZE 255
static omx_core_t *g_omxcore;
//Map the library name with the component name
@ -159,7 +157,6 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
{
OMX_ERRORTYPE rc = OMX_ErrorNone;
int comp_idx = 0, inst_idx = 0;
char libName[BUFF_SIZE] = {0};
void *p_obj = NULL;
OMX_COMPONENTTYPE *p_comp = NULL;
omx_core_component_t *p_core_comp = NULL;