115 virtual bool init(
const std::shared_ptr<
125 int xioctl(
int fd,
int request,
void* arg);
126 bool init_device(
void);
127 bool uninit_device(
void);
129 void set_device_config();
131 void set_auto_focus(
int value);
133 void set_v4l_parameter(
const std::string& param,
int value);
134 void set_v4l_parameter(
const std::string& param,
const std::string& value);
136 int init_mjpeg_decoder(
int image_width,
int image_height);
137 void mjpeg2rgb(
char* mjepg_buffer,
int len,
char* rgb_buffer,
int pixels);
147 int convert_yuv_to_rgb_pixel(
int y,
int u,
int v);
157 int convert_yuv_to_rgb_buffer(
unsigned char* yuv,
unsigned char* rgb,
158 unsigned int width,
unsigned int height);
166 uint64_t compensate_rtcpu_to_kernel_time(uint64_t rtcpu_time_ns);
169 bool init_read(
unsigned int buffer_size);
170 bool init_mmap(
void);
171 bool init_userp(
unsigned int buffer_size);
172 bool set_adv_trigger(
void);
173 bool close_device(
void);
174 bool open_device(
void);
176 bool process_image(
void* src,
int len,
CameraImagePtr dest,
void* zero_copy_src=
nullptr);
177 bool start_capturing(
void);
178 bool stop_capturing(
void);
187 int time_compensator_fd_;
191 unsigned int n_buffers_;
197 AVFrame* avframe_camera_;
198 AVFrame* avframe_rgb_;
200 AVDictionary* avoptions_;
201 AVCodecContext* avcodec_context_;
202 int avframe_camera_size_;
203 int avframe_rgb_size_;
204 struct SwsContext* video_sws_;
206 float frame_warning_interval_ = 0.0;
207 float device_wait_sec_ = 0.0;
208 uint64_t last_nsec_ = 0;
209 float frame_drop_interval_ = 0.0;
210 uint64_t last_error_time_ns_ = 0;
211 uint64_t frame_drop_interval_ns_ = 0;