@@ -96,38 +96,61 @@ 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 
106- {
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 ;
105+ typedef  struct  parameters_t  {
106+   std::string camera_name;
107+   std::string device_name;
108+   std::string frame_id;
109+   std::string io_method_name;
110+   std::string camera_info_url;
111+   std::string pixel_format_name;
112+   std::string av_device_format;
113+   int  image_width;
114+   int  image_height;
115+   int  framerate;
116+   int  brightness;
117+   int  contrast;
118+   int  saturation;
119+   int  sharpness;
120+   int  gain;
121+   int  white_balance;
122+   int  exposure;
123+   int  focus;
124+   bool  auto_white_balance;
125+   bool  autoexposure;
126+   bool  autofocus;
127+ 
128+   parameters_t () :
129+     camera_name (" usb_cam" 
130+     device_name (" /dev/video0" 
131+     frame_id (" camera" 
132+     io_method_name (" mmap" 
133+     camera_info_url (" package://usb_cam/config/camera_info.yaml" 
134+     pixel_format_name (" yuyv2rgb" 
135+     av_device_format (" YUV422P" 
136+     image_width (600 ),
137+     image_height (480 ),
138+     framerate (30.0 ),
139+     brightness (-1 ),
140+     contrast (-1 ),
141+     saturation (-1 ),
142+     sharpness (-1 ),
143+     gain (-1 ),
144+     white_balance (-1 ),
145+     exposure (-1 ),
146+     focus (-1 ),
147+     auto_white_balance (true ),
148+     autoexposure (true ),
149+     autofocus (false )
150+   {}
128151} parameters_t ;
129152
130- typedef  struct 
153+ typedef  struct   image_t 
131154{
132155  char  * data;
133156  size_t  width;
@@ -396,13 +419,10 @@ class UsbCam
396419  image_t  m_image;
397420
398421  AVFrame * m_avframe;
399-   int  m_avframe_size;
400422  AVCodec * m_avcodec;
401-   AVCodecID m_codec_id;
402423  AVDictionary * m_avoptions;
403424  AVCodecContext * m_avcodec_context;
404425
405-   int64_t  m_buffer_time_us;
406426  bool  m_is_capturing;
407427  int  m_framerate;
408428  const  time_t  m_epoch_time_shift_us;
0 commit comments