EmulatedCamera2: Be more const, like the HAL.
Bug: 6243944 Change-Id: I01f67c22b6e54dc49f22c6bc2c665b1db4ff6680
This commit is contained in:
@@ -129,7 +129,7 @@ int EmulatedCamera2::allocateStream(
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
int format,
|
int format,
|
||||||
camera2_stream_ops_t *stream_ops,
|
const camera2_stream_ops_t *stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *format_actual,
|
uint32_t *format_actual,
|
||||||
uint32_t *usage,
|
uint32_t *usage,
|
||||||
@@ -155,7 +155,7 @@ int EmulatedCamera2::allocateReprocessStream(
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
camera2_stream_in_ops_t *reprocess_stream_ops,
|
const camera2_stream_in_ops_t *reprocess_stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *consumer_usage,
|
uint32_t *consumer_usage,
|
||||||
uint32_t *max_buffers) {
|
uint32_t *max_buffers) {
|
||||||
@@ -205,114 +205,114 @@ int EmulatedCamera2::dump(int fd) {
|
|||||||
* 'camera_device2' parameter, or set a member value in the same.
|
* 'camera_device2' parameter, or set a member value in the same.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int EmulatedCamera2::set_request_queue_src_ops(struct camera2_device *d,
|
EmulatedCamera2* getInstance(const camera2_device_t *d) {
|
||||||
camera2_request_queue_src_ops *queue_src_ops) {
|
const EmulatedCamera2* cec = static_cast<const EmulatedCamera2*>(d);
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
return const_cast<EmulatedCamera2*>(cec);
|
||||||
|
}
|
||||||
|
|
||||||
|
int EmulatedCamera2::set_request_queue_src_ops(const camera2_device_t *d,
|
||||||
|
const camera2_request_queue_src_ops *queue_src_ops) {
|
||||||
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
ec->mRequestQueueSrc = queue_src_ops;
|
ec->mRequestQueueSrc = queue_src_ops;
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::notify_request_queue_not_empty(struct camera2_device *d) {
|
int EmulatedCamera2::notify_request_queue_not_empty(const camera2_device_t *d) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
return ec->requestQueueNotify();
|
return ec->requestQueueNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::set_frame_queue_dst_ops(struct camera2_device *d,
|
int EmulatedCamera2::set_frame_queue_dst_ops(const camera2_device_t *d,
|
||||||
camera2_frame_queue_dst_ops *queue_dst_ops) {
|
const camera2_frame_queue_dst_ops *queue_dst_ops) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
ec->mFrameQueueDst = queue_dst_ops;
|
ec->mFrameQueueDst = queue_dst_ops;
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::get_in_progress_count(struct camera2_device *d) {
|
int EmulatedCamera2::get_in_progress_count(const camera2_device_t *d) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
return ec->getInProgressCount();
|
return ec->getInProgressCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::flush_captures_in_progress(struct camera2_device *d) {
|
int EmulatedCamera2::flush_captures_in_progress(const camera2_device_t *d) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
return ec->flushCapturesInProgress();
|
return ec->flushCapturesInProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::construct_default_request(struct camera2_device *d,
|
int EmulatedCamera2::construct_default_request(const camera2_device_t *d,
|
||||||
int request_template,
|
int request_template,
|
||||||
camera_metadata_t **request) {
|
camera_metadata_t **request) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
return ec->constructDefaultRequest(request_template, request);
|
return ec->constructDefaultRequest(request_template, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::allocate_stream(struct camera2_device *d,
|
int EmulatedCamera2::allocate_stream(const camera2_device_t *d,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
int format,
|
int format,
|
||||||
camera2_stream_ops_t *stream_ops,
|
const camera2_stream_ops_t *stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *format_actual,
|
uint32_t *format_actual,
|
||||||
uint32_t *usage,
|
uint32_t *usage,
|
||||||
uint32_t *max_buffers) {
|
uint32_t *max_buffers) {
|
||||||
EmulatedCamera2* ec =
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
static_cast<EmulatedCamera2*>(d);
|
|
||||||
return ec->allocateStream(width, height, format, stream_ops,
|
return ec->allocateStream(width, height, format, stream_ops,
|
||||||
stream_id, format_actual, usage, max_buffers);
|
stream_id, format_actual, usage, max_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::register_stream_buffers(struct camera2_device *d,
|
int EmulatedCamera2::register_stream_buffers(const camera2_device_t *d,
|
||||||
uint32_t stream_id,
|
uint32_t stream_id,
|
||||||
int num_buffers,
|
int num_buffers,
|
||||||
buffer_handle_t *buffers) {
|
buffer_handle_t *buffers) {
|
||||||
EmulatedCamera2* ec =
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
static_cast<EmulatedCamera2*>(d);
|
|
||||||
return ec->registerStreamBuffers(stream_id,
|
return ec->registerStreamBuffers(stream_id,
|
||||||
num_buffers,
|
num_buffers,
|
||||||
buffers);
|
buffers);
|
||||||
}
|
}
|
||||||
int EmulatedCamera2::release_stream(struct camera2_device *d,
|
int EmulatedCamera2::release_stream(const camera2_device_t *d,
|
||||||
uint32_t stream_id) {
|
uint32_t stream_id) {
|
||||||
EmulatedCamera2* ec =
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
static_cast<EmulatedCamera2*>(d);
|
|
||||||
return ec->releaseStream(stream_id);
|
return ec->releaseStream(stream_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::allocate_reprocess_stream(struct camera2_device *d,
|
int EmulatedCamera2::allocate_reprocess_stream(const camera2_device_t *d,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
camera2_stream_in_ops_t *reprocess_stream_ops,
|
const camera2_stream_in_ops_t *reprocess_stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *consumer_usage,
|
uint32_t *consumer_usage,
|
||||||
uint32_t *max_buffers) {
|
uint32_t *max_buffers) {
|
||||||
EmulatedCamera2* ec =
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
static_cast<EmulatedCamera2*>(d);
|
|
||||||
return ec->allocateReprocessStream(width, height, format,
|
return ec->allocateReprocessStream(width, height, format,
|
||||||
reprocess_stream_ops, stream_id, consumer_usage, max_buffers);
|
reprocess_stream_ops, stream_id, consumer_usage, max_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::release_reprocess_stream(struct camera2_device *d,
|
int EmulatedCamera2::release_reprocess_stream(const camera2_device_t *d,
|
||||||
uint32_t stream_id) {
|
uint32_t stream_id) {
|
||||||
EmulatedCamera2* ec =
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
static_cast<EmulatedCamera2*>(d);
|
|
||||||
return ec->releaseReprocessStream(stream_id);
|
return ec->releaseReprocessStream(stream_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::trigger_action(camera2_device_t *d,
|
int EmulatedCamera2::trigger_action(const camera2_device_t *d,
|
||||||
uint32_t trigger_id,
|
uint32_t trigger_id,
|
||||||
int ext1,
|
int ext1,
|
||||||
int ext2) {
|
int ext2) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
return ec->triggerAction(trigger_id, ext1, ext2);
|
return ec->triggerAction(trigger_id, ext1, ext2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::set_notify_callback(struct camera2_device *d,
|
int EmulatedCamera2::set_notify_callback(const camera2_device_t *d,
|
||||||
camera2_notify_callback notify_cb, void* user) {
|
camera2_notify_callback notify_cb, void* user) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
ec->mNotifyCb = notify_cb;
|
ec->mNotifyCb = notify_cb;
|
||||||
ec->mNotifyUserPtr = user;
|
ec->mNotifyUserPtr = user;
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::get_metadata_vendor_tag_ops(struct camera2_device *d,
|
int EmulatedCamera2::get_metadata_vendor_tag_ops(const camera2_device_t *d,
|
||||||
vendor_tag_query_ops_t **ops) {
|
vendor_tag_query_ops_t **ops) {
|
||||||
EmulatedCamera2* ec = static_cast<EmulatedCamera2*>(d);
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
*ops = static_cast<vendor_tag_query_ops_t*>(
|
*ops = static_cast<vendor_tag_query_ops_t*>(
|
||||||
&ec->mVendorTagOps);
|
&ec->mVendorTagOps);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
@@ -339,16 +339,15 @@ int EmulatedCamera2::get_camera_vendor_tag_type(
|
|||||||
return ec->getVendorTagType(tag);
|
return ec->getVendorTagType(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::dump(struct camera2_device *d, int fd) {
|
int EmulatedCamera2::dump(const camera2_device_t *d, int fd) {
|
||||||
EmulatedCamera2* ec =
|
EmulatedCamera2* ec = getInstance(d);
|
||||||
static_cast<EmulatedCamera2*>(d);
|
|
||||||
return ec->dump(fd);
|
return ec->dump(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmulatedCamera2::close(struct hw_device_t* device) {
|
int EmulatedCamera2::close(struct hw_device_t* device) {
|
||||||
EmulatedCamera2* ec =
|
EmulatedCamera2* ec =
|
||||||
static_cast<EmulatedCamera2*>(
|
static_cast<EmulatedCamera2*>(
|
||||||
reinterpret_cast<struct camera2_device*>(device) );
|
reinterpret_cast<camera2_device_t*>(device) );
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
ALOGE("%s: Unexpected NULL camera2 device", __FUNCTION__);
|
ALOGE("%s: Unexpected NULL camera2 device", __FUNCTION__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ protected:
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
int format,
|
int format,
|
||||||
camera2_stream_ops_t *stream_ops,
|
const camera2_stream_ops_t *stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *format_actual,
|
uint32_t *format_actual,
|
||||||
uint32_t *usage,
|
uint32_t *usage,
|
||||||
@@ -119,7 +119,7 @@ protected:
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
camera2_stream_in_ops_t *reprocess_stream_ops,
|
const camera2_stream_in_ops_t *reprocess_stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *consumer_usage,
|
uint32_t *consumer_usage,
|
||||||
uint32_t *max_buffers);
|
uint32_t *max_buffers);
|
||||||
@@ -149,68 +149,68 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/** Input request queue */
|
/** Input request queue */
|
||||||
static int set_request_queue_src_ops(camera2_device_t *,
|
static int set_request_queue_src_ops(const camera2_device_t *,
|
||||||
camera2_request_queue_src_ops *queue_src_ops);
|
const camera2_request_queue_src_ops *queue_src_ops);
|
||||||
static int notify_request_queue_not_empty(camera2_device_t *);
|
static int notify_request_queue_not_empty(const camera2_device_t *);
|
||||||
|
|
||||||
/** Output frame queue */
|
/** Output frame queue */
|
||||||
static int set_frame_queue_dst_ops(camera2_device_t *,
|
static int set_frame_queue_dst_ops(const camera2_device_t *,
|
||||||
camera2_frame_queue_dst_ops *queue_dst_ops);
|
const camera2_frame_queue_dst_ops *queue_dst_ops);
|
||||||
|
|
||||||
/** In-progress request management */
|
/** In-progress request management */
|
||||||
static int get_in_progress_count(camera2_device_t *);
|
static int get_in_progress_count(const camera2_device_t *);
|
||||||
|
|
||||||
static int flush_captures_in_progress(camera2_device_t *);
|
static int flush_captures_in_progress(const camera2_device_t *);
|
||||||
|
|
||||||
/** Request template creation */
|
/** Request template creation */
|
||||||
static int construct_default_request(camera2_device_t *,
|
static int construct_default_request(const camera2_device_t *,
|
||||||
int request_template,
|
int request_template,
|
||||||
camera_metadata_t **request);
|
camera_metadata_t **request);
|
||||||
|
|
||||||
/** Stream management */
|
/** Stream management */
|
||||||
static int allocate_stream(camera2_device_t *,
|
static int allocate_stream(const camera2_device_t *,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
int format,
|
int format,
|
||||||
camera2_stream_ops_t *stream_ops,
|
const camera2_stream_ops_t *stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *format_actual,
|
uint32_t *format_actual,
|
||||||
uint32_t *usage,
|
uint32_t *usage,
|
||||||
uint32_t *max_buffers);
|
uint32_t *max_buffers);
|
||||||
|
|
||||||
static int register_stream_buffers(camera2_device_t *,
|
static int register_stream_buffers(const camera2_device_t *,
|
||||||
uint32_t stream_id,
|
uint32_t stream_id,
|
||||||
int num_buffers,
|
int num_buffers,
|
||||||
buffer_handle_t *buffers);
|
buffer_handle_t *buffers);
|
||||||
|
|
||||||
static int release_stream(camera2_device_t *,
|
static int release_stream(const camera2_device_t *,
|
||||||
uint32_t stream_id);
|
uint32_t stream_id);
|
||||||
|
|
||||||
static int allocate_reprocess_stream(camera2_device_t *,
|
static int allocate_reprocess_stream(const camera2_device_t *,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint32_t format,
|
uint32_t format,
|
||||||
camera2_stream_in_ops_t *reprocess_stream_ops,
|
const camera2_stream_in_ops_t *reprocess_stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *consumer_usage,
|
uint32_t *consumer_usage,
|
||||||
uint32_t *max_buffers);
|
uint32_t *max_buffers);
|
||||||
|
|
||||||
static int release_reprocess_stream(camera2_device_t *,
|
static int release_reprocess_stream(const camera2_device_t *,
|
||||||
uint32_t stream_id);
|
uint32_t stream_id);
|
||||||
|
|
||||||
/** 3A triggers*/
|
/** 3A triggers*/
|
||||||
static int trigger_action(camera2_device_t *,
|
static int trigger_action(const camera2_device_t *,
|
||||||
uint32_t trigger_id,
|
uint32_t trigger_id,
|
||||||
int ext1,
|
int ext1,
|
||||||
int ext2);
|
int ext2);
|
||||||
|
|
||||||
/** Notifications to application */
|
/** Notifications to application */
|
||||||
static int set_notify_callback(camera2_device_t *,
|
static int set_notify_callback(const camera2_device_t *,
|
||||||
camera2_notify_callback notify_cb,
|
camera2_notify_callback notify_cb,
|
||||||
void *user);
|
void *user);
|
||||||
|
|
||||||
/** Vendor metadata registration */
|
/** Vendor metadata registration */
|
||||||
static int get_metadata_vendor_tag_ops(camera2_device_t *,
|
static int get_metadata_vendor_tag_ops(const camera2_device_t *,
|
||||||
vendor_tag_query_ops_t **ops);
|
vendor_tag_query_ops_t **ops);
|
||||||
// for get_metadata_vendor_tag_ops
|
// for get_metadata_vendor_tag_ops
|
||||||
static const char* get_camera_vendor_section_name(
|
static const char* get_camera_vendor_section_name(
|
||||||
@@ -223,7 +223,7 @@ private:
|
|||||||
const vendor_tag_query_ops_t *,
|
const vendor_tag_query_ops_t *,
|
||||||
uint32_t tag);
|
uint32_t tag);
|
||||||
|
|
||||||
static int dump(camera2_device_t *, int fd);
|
static int dump(const camera2_device_t *, int fd);
|
||||||
|
|
||||||
/** For hw_device_t ops */
|
/** For hw_device_t ops */
|
||||||
static int close(struct hw_device_t* device);
|
static int close(struct hw_device_t* device);
|
||||||
@@ -232,8 +232,8 @@ private:
|
|||||||
* Data members shared with implementations
|
* Data members shared with implementations
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
protected:
|
protected:
|
||||||
camera2_request_queue_src_ops *mRequestQueueSrc;
|
const camera2_request_queue_src_ops *mRequestQueueSrc;
|
||||||
camera2_frame_queue_dst_ops *mFrameQueueDst;
|
const camera2_frame_queue_dst_ops *mFrameQueueDst;
|
||||||
camera2_notify_callback mNotifyCb;
|
camera2_notify_callback mNotifyCb;
|
||||||
void* mNotifyUserPtr;
|
void* mNotifyUserPtr;
|
||||||
|
|
||||||
|
|||||||
@@ -600,7 +600,7 @@ int EmulatedFakeCamera2::allocateStream(
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
int format,
|
int format,
|
||||||
camera2_stream_ops_t *stream_ops,
|
const camera2_stream_ops_t *stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *format_actual,
|
uint32_t *format_actual,
|
||||||
uint32_t *usage,
|
uint32_t *usage,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ protected:
|
|||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
int format,
|
int format,
|
||||||
camera2_stream_ops_t *stream_ops,
|
const camera2_stream_ops_t *stream_ops,
|
||||||
uint32_t *stream_id,
|
uint32_t *stream_id,
|
||||||
uint32_t *format_actual,
|
uint32_t *format_actual,
|
||||||
uint32_t *usage,
|
uint32_t *usage,
|
||||||
@@ -100,7 +100,7 @@ protected:
|
|||||||
// uint32_t width,
|
// uint32_t width,
|
||||||
// uint32_t height,
|
// uint32_t height,
|
||||||
// uint32_t format,
|
// uint32_t format,
|
||||||
// camera2_stream_ops_t *stream_ops,
|
// const camera2_stream_ops_t *stream_ops,
|
||||||
// uint32_t *stream_id,
|
// uint32_t *stream_id,
|
||||||
// uint32_t *format_actual,
|
// uint32_t *format_actual,
|
||||||
// uint32_t *usage,
|
// uint32_t *usage,
|
||||||
@@ -238,7 +238,7 @@ private:
|
|||||||
|
|
||||||
/** Stream manipulation */
|
/** Stream manipulation */
|
||||||
uint32_t mNextStreamId;
|
uint32_t mNextStreamId;
|
||||||
camera2_stream_ops_t *mRawStreamOps;
|
const camera2_stream_ops_t *mRawStreamOps;
|
||||||
|
|
||||||
/** Simulated hardware interfaces */
|
/** Simulated hardware interfaces */
|
||||||
sp<Sensor> mSensor;
|
sp<Sensor> mSensor;
|
||||||
|
|||||||
Reference in New Issue
Block a user