Allow to configure control

This commit is contained in:
Kamil Trzcinski 2022-04-11 12:45:01 +02:00
parent 8adcd67569
commit a586bad403
2 changed files with 19 additions and 8 deletions

View File

@ -86,7 +86,7 @@ int buffer_list_set_stream(buffer_list_t *buf_list, bool do_on)
buf_list->streaming = do_on;
int enqueued = buffer_list_count_enqueued(buf_list);
E_LOG_DEBUG(buf_list, "Streaming %s... Was %d of %d enqueud", do_on ? "started" : "stopped", enqueued, buf_list->nbufs);
E_LOG_VERBOSE(buf_list, "Streaming %s... Was %d of %d enqueud", do_on ? "started" : "stopped", enqueued, buf_list->nbufs);
return 0;
error:

View File

@ -1,6 +1,12 @@
#ifdef USE_LIBCAMERA
#include "libcamera.hh"
std::string libcamera_device_option_normalize(std::string key)
{
key.resize(device_option_normalize_name(key.data(), key.data()));
return key;
}
int libcamera_device_open(device_t *dev)
{
dev->libcamera = new device_libcamera_t{};
@ -27,7 +33,18 @@ int libcamera_device_open(device_t *dev)
E_LOG_ERROR(dev, "Failed to acquire `%s` camera.", dev->path);
}
printf("camera manager started, and camera was found: %s\n", dev->libcamera->camera->id().c_str());
E_LOG_INFO(dev, "Device path=%s opened", dev->path);
for (auto const &control : dev->libcamera->camera->controls()) {
if (!control.first)
continue;
auto control_id = control.first;
auto control_key = libcamera_device_option_normalize(control_id->name());
E_LOG_VERBOSE(dev, "Available control: %s (%08x, type=%d)",
control_key.c_str(), control_id->id(), control_id->type());
}
return 0;
error:
@ -53,12 +70,6 @@ int libcamera_device_set_fps(device_t *dev, int desired_fps)
return -1;
}
std::string libcamera_device_option_normalize(std::string key)
{
key.resize(device_option_normalize_name(key.data(), key.data()));
return key;
}
int libcamera_device_set_option(device_t *dev, const char *keyp, const char *value)
{
auto key = libcamera_device_option_normalize(keyp);