71 {
72 config_ = cameraconfig;
73
74 if (config_->pixel_format() == "yuyv") {
75 pixel_format_ = V4L2_PIX_FMT_YUYV;
76 } else if (config_->pixel_format() == "uyvy") {
77 pixel_format_ = V4L2_PIX_FMT_UYVY;
78 } else if (config_->pixel_format() == "mjpeg") {
79 pixel_format_ = V4L2_PIX_FMT_MJPEG;
80 } else if (config_->pixel_format() == "yuvmono10") {
81 pixel_format_ = V4L2_PIX_FMT_YUYV;
82 config_->set_monochrome(true);
83 } else if (config_->pixel_format() == "rgb24") {
84 pixel_format_ = V4L2_PIX_FMT_RGB24;
85 } else {
86 pixel_format_ = V4L2_PIX_FMT_YUYV;
87 AERROR <<
"Wrong pixel fromat:" << config_->pixel_format()
88 << ",must be yuyv | uyvy | mjpeg | yuvmono10 | rgb24";
89 return false;
90 }
91 if (pixel_format_ == V4L2_PIX_FMT_MJPEG) {
92 init_mjpeg_decoder(config_->width(), config_->height());
93 }
94
95
96 frame_warning_interval_ = static_cast<float>(1.5 / config_->frame_rate());
97
98 frame_drop_interval_ = static_cast<float>(0.9 / config_->frame_rate());
99
100
101 return true;
102}