@@ -96,38 +96,63 @@ std::vector<std::shared_ptr<pixel_format_base>> driver_supported_formats(
9696  return  fmts;
9797}
9898
99- typedef  struct 
99+ typedef  struct   capture_format_t 
100100{
101101  struct  v4l2_fmtdesc  format;
102102  struct  v4l2_frmivalenum  v4l2_fmt;
103103} capture_format_t ;
104104
105- typedef  struct 
105+ typedef  struct   parameters_t 
106106{
107-   std::string camera_name = " usb_cam" //  can be anything
108-   std::string device_name = " /dev/video0" //  usually /dev/video0 or something similiar
109-   std::string frame_id = " camera" 
110-   std::string io_method_name = " mmap" 
111-   std::string camera_info_url = " package://usb_cam/config/camera_info.yaml" 
112-   std::string pixel_format_name = " yuyv2rgb" 
113-   std::string av_device_format = " YUV422P" 
114-   int  image_width = 600 ;
115-   int  image_height = 400 ;
116-   int  framerate = 30.0 ;
117-   int  brightness = -1 ;
118-   int  contrast = -1 ;
119-   int  saturation = -1 ;
120-   int  sharpness = -1 ;
121-   int  gain = -1 ;
122-   int  white_balance = -1 ;
123-   int  exposure = -1 ;
124-   int  focus = -1 ;
125-   bool  auto_white_balance = true ;
126-   bool  autoexposure = true ;
127-   bool  autofocus = false ;
107+   std::string camera_name;
108+   std::string device_name;
109+   std::string frame_id;
110+   std::string io_method_name;
111+   std::string camera_info_url;
112+   std::string pixel_format_name;
113+   std::string av_device_format;
114+   int  image_width;
115+   int  image_height;
116+   int  framerate;
117+   int  brightness;
118+   int  contrast;
119+   int  saturation;
120+   int  sharpness;
121+   int  gain;
122+   int  white_balance;
123+   int  exposure;
124+   int  focus;
125+   bool  auto_white_balance;
126+   bool  autoexposure;
127+   bool  autofocus;
128+ 
129+   parameters_t ()
130+     : camera_name(" usb_cam" 
131+     device_name (" /dev/video0" 
132+     frame_id(" camera" 
133+     io_method_name(" mmap" 
134+     camera_info_url(" package://usb_cam/config/camera_info.yaml" 
135+     pixel_format_name(" yuyv2rgb" 
136+     av_device_format(" YUV422P" 
137+     image_width(600 ),
138+     image_height(480 ),
139+     framerate(30.0 ),
140+     brightness(-1 ),
141+     contrast(-1 ),
142+     saturation(-1 ),
143+     sharpness(-1 ),
144+     gain(-1 ),
145+     white_balance(-1 ),
146+     exposure(-1 ),
147+     focus(-1 ),
148+     auto_white_balance(true ),
149+     autoexposure(true ),
150+     autofocus(false )
151+   {
152+   }
128153} parameters_t ;
129154
130- typedef  struct 
155+ typedef  struct   image_t 
131156{
132157  char  * data;
133158  size_t  width;
@@ -396,13 +421,10 @@ class UsbCam
396421  image_t  m_image;
397422
398423  AVFrame * m_avframe;
399-   int  m_avframe_size;
400424  AVCodec * m_avcodec;
401-   AVCodecID m_codec_id;
402425  AVDictionary * m_avoptions;
403426  AVCodecContext * m_avcodec_context;
404427
405-   int64_t  m_buffer_time_us;
406428  bool  m_is_capturing;
407429  int  m_framerate;
408430  const  time_t  m_epoch_time_shift_us;
0 commit comments