Files
libmegapixels/include/libmegapixels.h
2023-07-08 20:59:07 +02:00

99 lines
1.8 KiB
C

#ifndef LIBMEGAPIXELS_HEADER
#define LIBMEGAPIXELS_HEADER
#include <stdint.h>
#define EXPORT __attribute__((__visibility__("default")))
EXPORT int
libmegapixels_find_config(char *configfile);
#define LIBMEGAPIXELS_CMD_LINK 1
#define LIBMEGAPIXELS_CMD_MODE 2
struct _lmp_cmd {
int type;
const char *entity_from;
const char *entity_to;
int pad_from;
int pad_to;
int width;
int height;
uint32_t mode;
uint32_t entity_from_id;
int pad_from_id;
uint32_t entity_to_id;
int pad_to_id;
};
typedef struct _lmp_cmd libmegapixels_cmd;
struct _lmp_mode {
int width;
int height;
int rate;
int format;
int rotation;
double focal_length;
double f_number;
uint32_t v4l_pixfmt;
uint32_t media_busfmt;
int num_cmds;
libmegapixels_cmd **cmds;
};
typedef struct _lmp_mode libmegapixels_mode;
struct _lmp_subdev {
char *path;
int fd;
uint32_t entity_id;
};
typedef struct _lmp_subdev libmegapixels_subdev;
struct _lmp_camera {
char *name;
char *sensor_name;
char *bridge_name;
char *media_path;
char *sensor_path;
char *video_path;
int media_fd;
int sensor_fd;
int video_fd;
int num_modes;
libmegapixels_mode **modes;
int num_handles;
libmegapixels_subdev **handles;
};
typedef struct _lmp_camera libmegapixels_camera;
struct _lmp_device_config {
char *path;
char *make;
char *model;
int count;
libmegapixels_camera **cameras;
};
typedef struct _lmp_device_config libmegapixels_devconfig;
EXPORT int
libmegapixels_load_file(libmegapixels_devconfig **config, const char *file);
EXPORT int
libmegapixels_open(libmegapixels_camera *camera);
EXPORT void
libmegapixels_close(libmegapixels_camera *camera);
EXPORT unsigned int
libmegapixels_select_mode(libmegapixels_camera *camera, libmegapixels_mode *mode);
#endif