Prefix LOG and CHECK with AOS_
This prepares us for introducing glog more widely and transitioning
things over where they make sense.
Change-Id: Ic6c208882407bc2153fe875ffc736d66f5c8ade5
diff --git a/aos/vision/image/image_stream.cc b/aos/vision/image/image_stream.cc
index 1dba674..62f5e81 100644
--- a/aos/vision/image/image_stream.cc
+++ b/aos/vision/image/image_stream.cc
@@ -8,7 +8,7 @@
void ImageStreamEvent::ProcessHelper(
DataRef data, aos::monotonic_clock::time_point timestamp) {
if (data.size() < 300) {
- LOG(INFO, "got bad img of size(%d)\n", static_cast<int>(data.size()));
+ AOS_LOG(INFO, "got bad img of size(%d)\n", static_cast<int>(data.size()));
return;
}
ProcessImage(data, timestamp);
diff --git a/aos/vision/image/jpeg_routines.cc b/aos/vision/image/jpeg_routines.cc
index 237daff..507fb3b 100644
--- a/aos/vision/image/jpeg_routines.cc
+++ b/aos/vision/image/jpeg_routines.cc
@@ -66,7 +66,7 @@
int nsymbols = 0;
for (int len = 1; len <= 16; len++) nsymbols += bits[len];
if (nsymbols < 1 || nsymbols > 256) {
- LOG(FATAL, "%s:%d: Error, bad huffman table", __FILE__, __LINE__);
+ AOS_LOG(FATAL, "%s:%d: Error, bad huffman table", __FILE__, __LINE__);
}
memcpy((*htblptr)->huffval, val, nsymbols * sizeof(uint8_t));
diff --git a/aos/vision/image/reader.cc b/aos/vision/image/reader.cc
index 991339b..7584369 100644
--- a/aos/vision/image/reader.cc
+++ b/aos/vision/image/reader.cc
@@ -42,15 +42,15 @@
: dev_name_(dev_name), process_(std::move(process)), params_(params) {
struct stat st;
if (stat(dev_name.c_str(), &st) == -1) {
- PLOG(FATAL, "Cannot identify '%s'", dev_name.c_str());
+ AOS_PLOG(FATAL, "Cannot identify '%s'", dev_name.c_str());
}
if (!S_ISCHR(st.st_mode)) {
- PLOG(FATAL, "%s is no device\n", dev_name.c_str());
+ AOS_PLOG(FATAL, "%s is no device\n", dev_name.c_str());
}
fd_ = open(dev_name.c_str(), O_RDWR /* required */ | O_NONBLOCK, 0);
if (fd_ == -1) {
- PLOG(FATAL, "Cannot open '%s'", dev_name.c_str());
+ AOS_PLOG(FATAL, "Cannot open '%s'", dev_name.c_str());
}
Init();
@@ -58,17 +58,18 @@
InitMMap();
SetExposure(params.exposure());
- LOG(INFO, "Bat Vision Successfully Initialized.\n");
+ AOS_LOG(INFO, "Bat Vision Successfully Initialized.\n");
}
void Reader::QueueBuffer(v4l2_buffer *buf) {
if (xioctl(fd_, VIDIOC_QBUF, buf) == -1) {
- PLOG(WARNING,
- "ioctl VIDIOC_QBUF(%d, %p)."
- " losing buf #%" PRIu32 "\n",
- fd_, &buf, buf->index);
+ AOS_PLOG(WARNING,
+ "ioctl VIDIOC_QBUF(%d, %p)."
+ " losing buf #%" PRIu32 "\n",
+ fd_, &buf, buf->index);
} else {
- // LOG(DEBUG, "put buf #%" PRIu32 " into driver's queue\n", buf->index);
+ // AOS_LOG(DEBUG, "put buf #%" PRIu32 " into driver's queue\n",
+ // buf->index);
++queued_;
}
}
@@ -81,7 +82,7 @@
if (xioctl(fd_, VIDIOC_DQBUF, &buf) == -1) {
if (errno != EAGAIN) {
- PLOG(ERROR, "ioctl VIDIOC_DQBUF(%d, %p)", fd_, &buf);
+ AOS_PLOG(ERROR, "ioctl VIDIOC_DQBUF(%d, %p)", fd_, &buf);
}
return;
}
@@ -110,15 +111,15 @@
buf.memory = V4L2_MEMORY_MMAP;
buf.index = n;
if (xioctl(fd_, VIDIOC_QUERYBUF, &buf) == -1) {
- PLOG(FATAL, "ioctl VIDIOC_QUERYBUF(%d, %p)", fd_, &buf);
+ AOS_PLOG(FATAL, "ioctl VIDIOC_QUERYBUF(%d, %p)", fd_, &buf);
}
buffers_[n].length = buf.length;
buffers_[n].start = mmap(NULL, buf.length, PROT_READ | PROT_WRITE,
MAP_SHARED, fd_, buf.m.offset);
if (buffers_[n].start == MAP_FAILED) {
- PLOG(FATAL,
- "mmap(NULL, %zd, PROT_READ | PROT_WRITE, MAP_SHARED, %d, %jd)",
- (size_t)buf.length, fd_, static_cast<intmax_t>(buf.m.offset));
+ AOS_PLOG(FATAL,
+ "mmap(NULL, %zd, PROT_READ | PROT_WRITE, MAP_SHARED, %d, %jd)",
+ (size_t)buf.length, fd_, static_cast<intmax_t>(buf.m.offset));
}
}
}
@@ -131,14 +132,14 @@
req.memory = V4L2_MEMORY_MMAP;
if (xioctl(fd_, VIDIOC_REQBUFS, &req) == -1) {
if (EINVAL == errno) {
- LOG(FATAL, "%s does not support memory mapping\n", dev_name_.c_str());
+ AOS_LOG(FATAL, "%s does not support memory mapping\n", dev_name_.c_str());
} else {
- PLOG(FATAL, "ioctl VIDIOC_REQBUFS(%d, %p)\n", fd_, &req);
+ AOS_PLOG(FATAL, "ioctl VIDIOC_REQBUFS(%d, %p)\n", fd_, &req);
}
}
queued_ = kNumBuffers;
if (req.count != kNumBuffers) {
- LOG(FATAL, "Insufficient buffer memory on %s\n", dev_name_.c_str());
+ AOS_LOG(FATAL, "Insufficient buffer memory on %s\n", dev_name_.c_str());
}
}
@@ -150,11 +151,11 @@
int r = xioctl(fd_, VIDIOC_G_CTRL, &getArg);
if (r == 0) {
if (getArg.value == value) {
- LOG(DEBUG, "Camera control %s was already %d\n", name, getArg.value);
+ AOS_LOG(DEBUG, "Camera control %s was already %d\n", name, getArg.value);
return true;
}
} else if (errno == EINVAL) {
- LOG(DEBUG, "Camera control %s is invalid\n", name);
+ AOS_LOG(DEBUG, "Camera control %s is invalid\n", name);
errno = 0;
return false;
}
@@ -165,7 +166,7 @@
return true;
}
- LOG(DEBUG, "Couldn't set camera control %s to %d", name, value);
+ AOS_LOG(DEBUG, "Couldn't set camera control %s to %d", name, value);
errno = 0;
return false;
}
@@ -179,16 +180,16 @@
v4l2_capability cap;
if (xioctl(fd_, VIDIOC_QUERYCAP, &cap) == -1) {
if (EINVAL == errno) {
- LOG(FATAL, "%s is no V4L2 device\n", dev_name_.c_str());
+ AOS_LOG(FATAL, "%s is no V4L2 device\n", dev_name_.c_str());
} else {
- PLOG(FATAL, "ioctl VIDIOC_QUERYCAP(%d, %p)", fd_, &cap);
+ AOS_PLOG(FATAL, "ioctl VIDIOC_QUERYCAP(%d, %p)", fd_, &cap);
}
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
- LOG(FATAL, "%s is no video capture device\n", dev_name_.c_str());
+ AOS_LOG(FATAL, "%s is no video capture device\n", dev_name_.c_str());
}
if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
- LOG(FATAL, "%s does not support streaming i/o\n", dev_name_.c_str());
+ AOS_LOG(FATAL, "%s does not support streaming i/o\n", dev_name_.c_str());
}
/* Select video input, video standard and tune here. */
@@ -208,12 +209,12 @@
break;
default:
/* Errors ignored. */
- PLOG(WARNING, "xioctl VIDIOC_S_CROP");
+ AOS_PLOG(WARNING, "xioctl VIDIOC_S_CROP");
break;
}
}
} else {
- PLOG(WARNING, "xioctl VIDIOC_CROPCAP");
+ AOS_PLOG(WARNING, "xioctl VIDIOC_CROPCAP");
}
v4l2_format fmt;
@@ -226,8 +227,8 @@
// fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
// fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
if (xioctl(fd_, VIDIOC_S_FMT, &fmt) == -1) {
- LOG(FATAL, "ioctl VIDIC_S_FMT(%d, %p) failed with %d: %s\n", fd_, &fmt,
- errno, strerror(errno));
+ AOS_LOG(FATAL, "ioctl VIDIC_S_FMT(%d, %p) failed with %d: %s\n", fd_, &fmt,
+ errno, strerror(errno));
}
/* Note VIDIOC_S_FMT may change width and height. */
@@ -239,21 +240,21 @@
if (!SetCameraControl(V4L2_CID_EXPOSURE_AUTO, "V4L2_CID_EXPOSURE_AUTO",
V4L2_EXPOSURE_MANUAL)) {
- LOG(FATAL, "Failed to set exposure\n");
+ AOS_LOG(FATAL, "Failed to set exposure\n");
}
if (!SetCameraControl(V4L2_CID_EXPOSURE_ABSOLUTE,
"V4L2_CID_EXPOSURE_ABSOLUTE", params_.exposure())) {
- LOG(FATAL, "Failed to set exposure\n");
+ AOS_LOG(FATAL, "Failed to set exposure\n");
}
if (!SetCameraControl(V4L2_CID_BRIGHTNESS, "V4L2_CID_BRIGHTNESS",
params_.brightness())) {
- LOG(FATAL, "Failed to set up camera\n");
+ AOS_LOG(FATAL, "Failed to set up camera\n");
}
if (!SetCameraControl(V4L2_CID_GAIN, "V4L2_CID_GAIN", params_.gain())) {
- LOG(FATAL, "Failed to set up camera\n");
+ AOS_LOG(FATAL, "Failed to set up camera\n");
}
// set framerate
@@ -264,18 +265,18 @@
setfps->parm.capture.timeperframe.numerator = 1;
setfps->parm.capture.timeperframe.denominator = params_.fps();
if (xioctl(fd_, VIDIOC_S_PARM, setfps) == -1) {
- PLOG(FATAL, "ioctl VIDIOC_S_PARM(%d, %p)\n", fd_, setfps);
+ AOS_PLOG(FATAL, "ioctl VIDIOC_S_PARM(%d, %p)\n", fd_, setfps);
}
- LOG(INFO, "framerate ended up at %d/%d\n",
- setfps->parm.capture.timeperframe.numerator,
- setfps->parm.capture.timeperframe.denominator);
+ AOS_LOG(INFO, "framerate ended up at %d/%d\n",
+ setfps->parm.capture.timeperframe.numerator,
+ setfps->parm.capture.timeperframe.denominator);
}
aos::vision::ImageFormat Reader::get_format() {
struct v4l2_format fmt;
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl(fd_, VIDIOC_G_FMT, &fmt) == -1) {
- PLOG(FATAL, "ioctl VIDIC_G_FMT(%d, %p)\n", fd_, &fmt);
+ AOS_PLOG(FATAL, "ioctl VIDIC_G_FMT(%d, %p)\n", fd_, &fmt);
}
return aos::vision::ImageFormat{(int)fmt.fmt.pix.width,
@@ -283,7 +284,7 @@
}
void Reader::Start() {
- LOG(DEBUG, "queueing buffers for the first time\n");
+ AOS_LOG(DEBUG, "queueing buffers for the first time\n");
v4l2_buffer buf;
for (unsigned int i = 0; i < kNumBuffers; ++i) {
CLEAR(buf);
@@ -292,11 +293,11 @@
buf.index = i;
QueueBuffer(&buf);
}
- LOG(DEBUG, "done with first queue\n");
+ AOS_LOG(DEBUG, "done with first queue\n");
v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (xioctl(fd_, VIDIOC_STREAMON, &type) == -1) {
- PLOG(FATAL, "ioctl VIDIOC_STREAMON(%d, %p)\n", fd_, &type);
+ AOS_PLOG(FATAL, "ioctl VIDIOC_STREAMON(%d, %p)\n", fd_, &type);
}
}