libmegapixels.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #ifndef LIBMEGAPIXELS_HEADER
  2. #define LIBMEGAPIXELS_HEADER
  3. #include <stdint.h>
  4. #define EXPORT __attribute__((__visibility__("default")))
  5. EXPORT int
  6. libmegapixels_find_config(char *configfile);
  7. #define LIBMEGAPIXELS_CMD_LINK 1
  8. #define LIBMEGAPIXELS_CMD_MODE 2
  9. struct _lmp_cmd {
  10. int type;
  11. const char *entity_from;
  12. const char *entity_to;
  13. int pad_from;
  14. int pad_to;
  15. int width;
  16. int height;
  17. uint32_t mode;
  18. uint32_t entity_from_id;
  19. int pad_from_id;
  20. uint32_t entity_to_id;
  21. int pad_to_id;
  22. };
  23. typedef struct _lmp_cmd libmegapixels_cmd;
  24. struct _lmp_mode {
  25. int width;
  26. int height;
  27. int rate;
  28. int format;
  29. int rotation;
  30. double focal_length;
  31. double f_number;
  32. uint32_t v4l_pixfmt;
  33. uint32_t media_busfmt;
  34. int num_cmds;
  35. libmegapixels_cmd **cmds;
  36. };
  37. typedef struct _lmp_mode libmegapixels_mode;
  38. struct _lmp_subdev {
  39. char *path;
  40. int fd;
  41. uint32_t entity_id;
  42. };
  43. typedef struct _lmp_subdev libmegapixels_subdev;
  44. struct _lmp_camera {
  45. char *name;
  46. char *sensor_name;
  47. char *bridge_name;
  48. char *media_path;
  49. char *sensor_path;
  50. char *video_path;
  51. int media_fd;
  52. int sensor_fd;
  53. int video_fd;
  54. int num_modes;
  55. libmegapixels_mode **modes;
  56. int num_handles;
  57. libmegapixels_subdev **handles;
  58. };
  59. typedef struct _lmp_camera libmegapixels_camera;
  60. struct _lmp_device_config {
  61. char *path;
  62. const char *make;
  63. const char *model;
  64. int count;
  65. int loaded_config;
  66. int loaded_uvc;
  67. libmegapixels_camera **cameras;
  68. };
  69. typedef struct _lmp_device_config libmegapixels_devconfig;
  70. EXPORT int
  71. libmegapixels_init(libmegapixels_devconfig **config);
  72. EXPORT int
  73. libmegapixels_load_file(libmegapixels_devconfig *config, const char *file);
  74. EXPORT int
  75. libmegapixels_load_uvc(libmegapixels_devconfig *config);
  76. EXPORT int
  77. libmegapixels_open(libmegapixels_camera *camera);
  78. EXPORT void
  79. libmegapixels_close(libmegapixels_camera *camera);
  80. EXPORT unsigned int
  81. libmegapixels_select_mode(libmegapixels_camera *camera, libmegapixels_mode *mode);
  82. #endif