Commit 9c631842 authored by Raghavendra Rao's avatar Raghavendra Rao
Browse files

libcamera: cleanup unused variables

parent 7c05a7f7
Pipeline #160854 passed with stages
in 1 minute and 26 seconds
......@@ -64,7 +64,6 @@ struct impl {
static int emit_object_info(struct impl *this, uint32_t id)
{
struct spa_device_object_info info;
const char *str;
struct spa_dict_item items[20];
uint32_t n_items = 0;
......@@ -113,7 +112,6 @@ static int
impl_device_add_listener(void *object, struct spa_hook *listener,
const struct spa_device_events *events, void *data)
{
int res;
struct impl *this = object;
struct spa_hook_list save;
......
......@@ -75,12 +75,12 @@ struct impl {
static int emit_info(struct impl *this, bool full)
{
int res, err, fd;
int res, err;
struct spa_dict_item items[10];
uint32_t n_items = 0;
struct spa_device_info info;
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)
return res;
......@@ -88,7 +88,6 @@ static int emit_info(struct impl *this, bool full)
info = SPA_DEVICE_INFO_INIT();
info.change_mask = SPA_DEVICE_CHANGE_MASK_PROPS;
fd = get_dev_fd(&this->dev);
do {
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;
const char *str;
int res;
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);
......
......@@ -927,7 +927,6 @@ impl_init(const struct spa_handle_factory *factory,
const char *str;
struct port *port;
int res;
int err;
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);
......
......@@ -47,8 +47,6 @@ int get_dev_fd(struct spa_libcamera_device *dev) {
int spa_libcamera_open(struct spa_libcamera_device *dev)
{
int refCnt = 0;
if(!dev) {
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 refCnt = 0;
if(!dev) {
spa_log_error(dev->log, "Invalid argument");
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 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))
return 0;
......@@ -377,16 +372,14 @@ spa_libcamera_enum_format(struct impl *this, int seq,
const struct spa_pod *filter)
{
struct port *port = &this->out_ports[0];
int res, n_fractions;
int res;
const struct format_info *info;
struct spa_pod_choice *choice;
uint32_t filter_media_type, filter_media_subtype, video_format;
uint32_t video_format;
struct spa_libcamera_device *dev = &port->dev;
uint8_t buffer[1024];
struct spa_pod_builder b = { 0 };
struct spa_pod_frame f[2];
struct spa_result_node_params result;
uint32_t count = 0;
uint32_t width = 0, height = 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_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 */
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 spa_libcamera_device *dev = &port->dev;
int res, cmd;
int res;
struct camera_fmt fmt;
const struct format_info *info = NULL;
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++) {
struct buffer *b;
int64_t fd;
b = &port->buffers[i];
b->id = i;
......@@ -881,7 +872,6 @@ spa_libcamera_alloc_buffers(struct impl *this,
{
int res;
struct port *port = &this->out_ports[0];
struct spa_libcamera_device *dev = &port->dev;
if (port->n_buffers > 0)
return -EIO;
......
......@@ -113,7 +113,6 @@ extern "C" {
uint32_t bufIdx_;
int64_t **fd_;
uint32_t maxSize_;
bool isAvail_;
uint32_t width_;
uint32_t height_;
uint32_t pixelFormat_;
......@@ -475,7 +474,6 @@ extern "C" {
bool LibCamera::open() {
std::shared_ptr<Camera> cam;
int err;
int ret = 0;
cam = this->get_camera();
......@@ -485,7 +483,6 @@ extern "C" {
ret = cam->acquire();
if (ret) {
err = errno;
return false;
}
......@@ -663,7 +660,6 @@ extern "C" {
return -EINVAL;
}
uint32_t index = 0;
for (const StreamConfiguration &cfg : *camera->config_) {
uint32_t index = 0;
const StreamFormats &formats = cfg.formats();
......@@ -688,7 +684,6 @@ extern "C" {
}
for (const StreamConfiguration &cfg : *camera->config_) {
uint32_t index = 0;
const StreamFormats &formats = cfg.formats();
for (PixelFormat pixelformat : formats.pixelformats()) {
uint32_t index = 0;
......@@ -779,7 +774,6 @@ extern "C" {
}
LibCamera* newLibCamera() {
int err;
int ret = 0;
pthread_mutexattr_t attr;
std::unique_ptr<CameraManager> cm = std::make_unique<CameraManager>();
......@@ -787,7 +781,6 @@ extern "C" {
ret = cm->start();
if (ret) {
err = errno;
return nullptr;
}
......@@ -838,17 +831,12 @@ extern "C" {
bufIdx_ = 0;
}
StreamConfiguration &cfg = config_->at(0);
const std::map<Stream *, FrameBuffer *> &buffers = request->buffers();
unsigned int idx = 0;
for (auto it = buffers.begin(); it != buffers.end(); ++it) {
Stream *stream = it->first;
FrameBuffer *buffer = it->second;
const std::string &name = streamName_[stream];
unsigned int nplanes = buffer->planes().size();
OutBuf *pBuf = new OutBuf();
uint32_t ringbuf_write_index;
pBuf->bufIdx = bufIdx_;
pBuf->n_datas = nplanes;
......@@ -872,7 +860,6 @@ extern "C" {
/* Push the buffer to ring buffer */
if(pBuf && pBuf->datas) {
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 */
this->ring_buffer_update_write_index();
if(this->system_ && (this->eventfd_ > 0)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment