Pass options to ISP
This commit is contained in:
parent
42ab32b1a6
commit
08c179e22a
@ -74,6 +74,8 @@ option_t all_options[] = {
|
|||||||
DEFINE_OPTION(camera, low_res_factor, float),
|
DEFINE_OPTION(camera, low_res_factor, float),
|
||||||
DEFINE_OPTION_PTR(camera, options, list),
|
DEFINE_OPTION_PTR(camera, options, list),
|
||||||
|
|
||||||
|
DEFINE_OPTION_PTR(camera, isp.options, list),
|
||||||
|
|
||||||
DEFINE_OPTION(http, port, uint),
|
DEFINE_OPTION(http, port, uint),
|
||||||
DEFINE_OPTION(http, maxcons, uint),
|
DEFINE_OPTION(http, maxcons, uint),
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ int camera_set_params(camera_t *camera)
|
|||||||
{
|
{
|
||||||
device_set_fps(camera->camera, camera->options.fps);
|
device_set_fps(camera->camera, camera->options.fps);
|
||||||
device_set_option_list(camera->camera, camera->options.options);
|
device_set_option_list(camera->camera, camera->options.options);
|
||||||
|
device_set_option_list(camera->isp_srgb, camera->options.isp.options);
|
||||||
|
|
||||||
// DEVICE_SET_OPTION(camera->camera, EXPOSURE, 2684);
|
// DEVICE_SET_OPTION(camera->camera, EXPOSURE, 2684);
|
||||||
// DEVICE_SET_OPTION(camera->camera, ANALOGUE_GAIN, 938);
|
// DEVICE_SET_OPTION(camera->camera, ANALOGUE_GAIN, 938);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#define MAX_HTTP_METHODS 20
|
#define MAX_HTTP_METHODS 20
|
||||||
|
|
||||||
#define CAMERA_DEVICE_CAMERA 0
|
#define CAMERA_DEVICE_CAMERA 0
|
||||||
|
#define CAMERA_OPTIONS_LENGTH 4096
|
||||||
|
|
||||||
typedef struct camera_options_s {
|
typedef struct camera_options_s {
|
||||||
char path[256];
|
char path[256];
|
||||||
@ -16,7 +17,11 @@ typedef struct camera_options_s {
|
|||||||
float high_res_factor;
|
float high_res_factor;
|
||||||
float low_res_factor;
|
float low_res_factor;
|
||||||
|
|
||||||
char options[4096];
|
char options[CAMERA_OPTIONS_LENGTH];
|
||||||
|
|
||||||
|
struct {
|
||||||
|
char options[CAMERA_OPTIONS_LENGTH];
|
||||||
|
} isp;
|
||||||
} camera_options_t;
|
} camera_options_t;
|
||||||
|
|
||||||
typedef struct camera_s {
|
typedef struct camera_s {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "device/hw/device.h"
|
#include "device/hw/device.h"
|
||||||
|
#include "opts/opts.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
@ -83,7 +84,8 @@ error:
|
|||||||
|
|
||||||
int device_set_option_string(device_t *dev, const char *option)
|
int device_set_option_string(device_t *dev, const char *option)
|
||||||
{
|
{
|
||||||
char name[256];
|
int ret = -1;
|
||||||
|
char *name = strdup(option);
|
||||||
strcpy(name, option);
|
strcpy(name, option);
|
||||||
|
|
||||||
char *value = strchr(name, '=');
|
char *value = strchr(name, '=');
|
||||||
@ -94,21 +96,19 @@ int device_set_option_string(device_t *dev, const char *option)
|
|||||||
|
|
||||||
device_option_normalize_name(name);
|
device_option_normalize_name(name);
|
||||||
|
|
||||||
int ret = device_set_option_string_fd(dev, dev->subdev_fd, name, value);
|
ret = device_set_option_string_fd(dev, dev->subdev_fd, name, value);
|
||||||
if (ret > 0)
|
if (ret <= 0)
|
||||||
return 0;
|
ret = device_set_option_string_fd(dev, dev->fd, name, value);
|
||||||
|
|
||||||
ret = device_set_option_string_fd(dev, dev->fd, name, value);
|
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
E_LOG_ERROR(dev, "The '%s' was failed to find.", option);
|
E_LOG_ERROR(dev, "The '%s' was failed to find.", option);
|
||||||
else if (ret < 0)
|
else if (ret < 0)
|
||||||
E_LOG_ERROR(dev, "The '%s' did fail to be set.", option);
|
E_LOG_ERROR(dev, "The '%s' did fail to be set.", option);
|
||||||
|
|
||||||
return 0;
|
ret = 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return -1;
|
free(name);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void device_set_option_list(device_t *dev, const char *option_list)
|
void device_set_option_list(device_t *dev, const char *option_list)
|
||||||
@ -121,7 +121,7 @@ void device_set_option_list(device_t *dev, const char *option_list)
|
|||||||
char *string = start;
|
char *string = start;
|
||||||
char *option;
|
char *option;
|
||||||
|
|
||||||
while (option = strsep(&string, ",")) {
|
while (option = strsep(&string, OPTION_VALUE_LIST_SEP)) {
|
||||||
device_set_option_string(dev, option);
|
device_set_option_string(dev, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,13 +25,7 @@ typedef struct options_s {
|
|||||||
const char *default_value;
|
const char *default_value;
|
||||||
} option_t;
|
} option_t;
|
||||||
|
|
||||||
#define lambda(return_type, function_body) \
|
#define OPTION_VALUE_LIST_SEP ";"
|
||||||
({ \
|
|
||||||
return_type __fn__ function_body \
|
|
||||||
__fn__; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define OPTION_VALUE_LIST_SEP ","
|
|
||||||
|
|
||||||
#define OPTION_FORMAT_uint "%d"
|
#define OPTION_FORMAT_uint "%d"
|
||||||
#define OPTION_FORMAT_hex "%08x"
|
#define OPTION_FORMAT_hex "%08x"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user