libcamera: cleanup unused variables

This commit is contained in:
raghu447 2020-06-15 17:45:01 +05:30
parent 7c05a7f7b4
commit 9c631842cb
5 changed files with 5 additions and 33 deletions

View file

@ -64,7 +64,6 @@ struct impl {
static int emit_object_info(struct impl *this, uint32_t id) static int emit_object_info(struct impl *this, uint32_t id)
{ {
struct spa_device_object_info info; struct spa_device_object_info info;
const char *str;
struct spa_dict_item items[20]; struct spa_dict_item items[20];
uint32_t n_items = 0; uint32_t n_items = 0;
@ -113,7 +112,6 @@ static int
impl_device_add_listener(void *object, struct spa_hook *listener, impl_device_add_listener(void *object, struct spa_hook *listener,
const struct spa_device_events *events, void *data) const struct spa_device_events *events, void *data)
{ {
int res;
struct impl *this = object; struct impl *this = object;
struct spa_hook_list save; struct spa_hook_list save;

View file

@ -75,12 +75,12 @@ struct impl {
static int emit_info(struct impl *this, bool full) static int emit_info(struct impl *this, bool full)
{ {
int res, err, fd; int res, err;
struct spa_dict_item items[10]; struct spa_dict_item items[10];
uint32_t n_items = 0; uint32_t n_items = 0;
struct spa_device_info info; struct spa_device_info info;
struct spa_param_info params[2]; struct spa_param_info params[2];
char path[128], version[16], capabilities[16], device_caps[16]; char path[128], version[16];
if ((res = spa_libcamera_open(&this->dev)) < 0) if ((res = spa_libcamera_open(&this->dev)) < 0)
return res; return res;
@ -88,7 +88,6 @@ static int emit_info(struct impl *this, bool full)
info = SPA_DEVICE_INFO_INIT(); info = SPA_DEVICE_INFO_INIT();
info.change_mask = SPA_DEVICE_CHANGE_MASK_PROPS; info.change_mask = SPA_DEVICE_CHANGE_MASK_PROPS;
fd = get_dev_fd(&this->dev);
do { do {
err = ioctl(this->dev.fd, MEDIA_IOC_DEVICE_INFO, &this->dev.dev_info); err = ioctl(this->dev.fd, MEDIA_IOC_DEVICE_INFO, &this->dev.dev_info);
@ -233,7 +232,6 @@ impl_init(const struct spa_handle_factory *factory,
{ {
struct impl *this; struct impl *this;
const char *str; const char *str;
int res;
spa_return_val_if_fail(factory != NULL, -EINVAL); spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL); spa_return_val_if_fail(handle != NULL, -EINVAL);

View file

@ -927,7 +927,6 @@ impl_init(const struct spa_handle_factory *factory,
const char *str; const char *str;
struct port *port; struct port *port;
int res; int res;
int err;
spa_return_val_if_fail(factory != NULL, -EINVAL); spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL); spa_return_val_if_fail(handle != NULL, -EINVAL);

View file

@ -47,8 +47,6 @@ int get_dev_fd(struct spa_libcamera_device *dev) {
int spa_libcamera_open(struct spa_libcamera_device *dev) int spa_libcamera_open(struct spa_libcamera_device *dev)
{ {
int refCnt = 0;
if(!dev) { if(!dev) {
return -1; return -1;
} }
@ -69,7 +67,6 @@ int spa_libcamera_is_capture(struct spa_libcamera_device *dev)
int spa_libcamera_close(struct spa_libcamera_device *dev) int spa_libcamera_close(struct spa_libcamera_device *dev)
{ {
int refCnt = 0;
if(!dev) { if(!dev) {
spa_log_error(dev->log, "Invalid argument"); spa_log_error(dev->log, "Invalid argument");
return -1; return -1;
@ -95,8 +92,6 @@ static int spa_libcamera_buffer_recycle(struct impl *this, uint32_t buffer_id)
{ {
struct port *port = &this->out_ports[0]; struct port *port = &this->out_ports[0];
struct buffer *b = &port->buffers[buffer_id]; struct buffer *b = &port->buffers[buffer_id];
struct spa_libcamera_device *dev = &port->dev;
int err;
if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUTSTANDING)) if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_OUTSTANDING))
return 0; return 0;
@ -377,16 +372,14 @@ spa_libcamera_enum_format(struct impl *this, int seq,
const struct spa_pod *filter) const struct spa_pod *filter)
{ {
struct port *port = &this->out_ports[0]; struct port *port = &this->out_ports[0];
int res, n_fractions; int res;
const struct format_info *info; const struct format_info *info;
struct spa_pod_choice *choice; uint32_t video_format;
uint32_t filter_media_type, filter_media_subtype, video_format;
struct spa_libcamera_device *dev = &port->dev; struct spa_libcamera_device *dev = &port->dev;
uint8_t buffer[1024]; uint8_t buffer[1024];
struct spa_pod_builder b = { 0 }; struct spa_pod_builder b = { 0 };
struct spa_pod_frame f[2]; struct spa_pod_frame f[2];
struct spa_result_node_params result; struct spa_result_node_params result;
uint32_t count = 0;
uint32_t width = 0, height = 0; uint32_t width = 0, height = 0;
if ((res = spa_libcamera_open(dev)) < 0) { if ((res = spa_libcamera_open(dev)) < 0) {
@ -444,7 +437,6 @@ have_framerate:
spa_pod_builder_prop(&b, SPA_FORMAT_VIDEO_framerate, 0); spa_pod_builder_prop(&b, SPA_FORMAT_VIDEO_framerate, 0);
spa_pod_builder_push_choice(&b, &f[1], SPA_CHOICE_None, 0); spa_pod_builder_push_choice(&b, &f[1], SPA_CHOICE_None, 0);
choice = (struct spa_pod_choice*)spa_pod_builder_frame(&b, &f[1]);
/* Below framerates are hardcoded until framerates are queried from libcamera */ /* Below framerates are hardcoded until framerates are queried from libcamera */
port->fmt.denominator = 30; port->fmt.denominator = 30;
@ -472,7 +464,7 @@ static int spa_libcamera_set_format(struct impl *this, struct spa_video_info *fo
{ {
struct port *port = &this->out_ports[0]; struct port *port = &this->out_ports[0];
struct spa_libcamera_device *dev = &port->dev; struct spa_libcamera_device *dev = &port->dev;
int res, cmd; int res;
struct camera_fmt fmt; struct camera_fmt fmt;
const struct format_info *info = NULL; const struct format_info *info = NULL;
uint32_t video_format; uint32_t video_format;
@ -729,7 +721,6 @@ static int spa_libcamera_use_buffers(struct impl *this, struct spa_buffer **buff
for (i = 0; i < n_buffers; i++) { for (i = 0; i < n_buffers; i++) {
struct buffer *b; struct buffer *b;
int64_t fd;
b = &port->buffers[i]; b = &port->buffers[i];
b->id = i; b->id = i;
@ -881,7 +872,6 @@ spa_libcamera_alloc_buffers(struct impl *this,
{ {
int res; int res;
struct port *port = &this->out_ports[0]; struct port *port = &this->out_ports[0];
struct spa_libcamera_device *dev = &port->dev;
if (port->n_buffers > 0) if (port->n_buffers > 0)
return -EIO; return -EIO;

View file

@ -113,7 +113,6 @@ extern "C" {
uint32_t bufIdx_; uint32_t bufIdx_;
int64_t **fd_; int64_t **fd_;
uint32_t maxSize_; uint32_t maxSize_;
bool isAvail_;
uint32_t width_; uint32_t width_;
uint32_t height_; uint32_t height_;
uint32_t pixelFormat_; uint32_t pixelFormat_;
@ -475,7 +474,6 @@ extern "C" {
bool LibCamera::open() { bool LibCamera::open() {
std::shared_ptr<Camera> cam; std::shared_ptr<Camera> cam;
int err;
int ret = 0; int ret = 0;
cam = this->get_camera(); cam = this->get_camera();
@ -485,7 +483,6 @@ extern "C" {
ret = cam->acquire(); ret = cam->acquire();
if (ret) { if (ret) {
err = errno;
return false; return false;
} }
@ -663,7 +660,6 @@ extern "C" {
return -EINVAL; return -EINVAL;
} }
uint32_t index = 0;
for (const StreamConfiguration &cfg : *camera->config_) { for (const StreamConfiguration &cfg : *camera->config_) {
uint32_t index = 0; uint32_t index = 0;
const StreamFormats &formats = cfg.formats(); const StreamFormats &formats = cfg.formats();
@ -688,7 +684,6 @@ extern "C" {
} }
for (const StreamConfiguration &cfg : *camera->config_) { for (const StreamConfiguration &cfg : *camera->config_) {
uint32_t index = 0;
const StreamFormats &formats = cfg.formats(); const StreamFormats &formats = cfg.formats();
for (PixelFormat pixelformat : formats.pixelformats()) { for (PixelFormat pixelformat : formats.pixelformats()) {
uint32_t index = 0; uint32_t index = 0;
@ -779,7 +774,6 @@ extern "C" {
} }
LibCamera* newLibCamera() { LibCamera* newLibCamera() {
int err;
int ret = 0; int ret = 0;
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
std::unique_ptr<CameraManager> cm = std::make_unique<CameraManager>(); std::unique_ptr<CameraManager> cm = std::make_unique<CameraManager>();
@ -787,7 +781,6 @@ extern "C" {
ret = cm->start(); ret = cm->start();
if (ret) { if (ret) {
err = errno;
return nullptr; return nullptr;
} }
@ -838,17 +831,12 @@ extern "C" {
bufIdx_ = 0; bufIdx_ = 0;
} }
StreamConfiguration &cfg = config_->at(0);
const std::map<Stream *, FrameBuffer *> &buffers = request->buffers(); const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
unsigned int idx = 0;
for (auto it = buffers.begin(); it != buffers.end(); ++it) { for (auto it = buffers.begin(); it != buffers.end(); ++it) {
Stream *stream = it->first;
FrameBuffer *buffer = it->second; FrameBuffer *buffer = it->second;
const std::string &name = streamName_[stream];
unsigned int nplanes = buffer->planes().size(); unsigned int nplanes = buffer->planes().size();
OutBuf *pBuf = new OutBuf(); OutBuf *pBuf = new OutBuf();
uint32_t ringbuf_write_index;
pBuf->bufIdx = bufIdx_; pBuf->bufIdx = bufIdx_;
pBuf->n_datas = nplanes; pBuf->n_datas = nplanes;
@ -872,7 +860,6 @@ extern "C" {
/* Push the buffer to ring buffer */ /* Push the buffer to ring buffer */
if(pBuf && pBuf->datas) { if(pBuf && pBuf->datas) {
this->ring_buffer_write(pBuf); this->ring_buffer_write(pBuf);
spa_log_trace(log_, "%s::Pushing buffer %p at index: %d\n", __FUNCTION__, pBuf, ringbuf_write_index);
/* Now update the write index of the ring buffer */ /* Now update the write index of the ring buffer */
this->ring_buffer_update_write_index(); this->ring_buffer_update_write_index();
if(this->system_ && (this->eventfd_ > 0)) { if(this->system_ && (this->eventfd_ > 0)) {