Loading include/input/TouchVideoFrame.h +6 −6 Original line number Diff line number Diff line Loading @@ -30,19 +30,19 @@ namespace android { */ class TouchVideoFrame { public: TouchVideoFrame(uint32_t width, uint32_t height, std::vector<int16_t> data, TouchVideoFrame(uint32_t height, uint32_t width, std::vector<int16_t> data, const struct timeval& timestamp); bool operator==(const TouchVideoFrame& rhs) const; /** * Width of the frame */ uint32_t getWidth() const; /** * Height of the frame */ uint32_t getHeight() const; /** * Width of the frame */ uint32_t getWidth() const; /** * The touch strength data. * The array is a 2-D row-major matrix, with dimensions (height, width). Loading @@ -56,8 +56,8 @@ public: const struct timeval& getTimestamp() const; private: uint32_t mWidth; uint32_t mHeight; uint32_t mWidth; std::vector<int16_t> mData; struct timeval mTimestamp; }; Loading libs/input/TouchVideoFrame.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -18,23 +18,23 @@ namespace android { TouchVideoFrame::TouchVideoFrame(uint32_t width, uint32_t height, std::vector<int16_t> data, TouchVideoFrame::TouchVideoFrame(uint32_t height, uint32_t width, std::vector<int16_t> data, const struct timeval& timestamp) : mWidth(width), mHeight(height), mData(std::move(data)), mTimestamp(timestamp) { mHeight(height), mWidth(width),mData(std::move(data)), mTimestamp(timestamp) { } bool TouchVideoFrame::operator==(const TouchVideoFrame& rhs) const { return mWidth == rhs.mWidth && mHeight == rhs.mHeight return mHeight == rhs.mHeight && mWidth == rhs.mWidth && mData == rhs.mData && mTimestamp.tv_sec == rhs.mTimestamp.tv_sec && mTimestamp.tv_usec == rhs.mTimestamp.tv_usec; } uint32_t TouchVideoFrame::getWidth() const { return mWidth; } uint32_t TouchVideoFrame::getHeight() const { return mHeight; } uint32_t TouchVideoFrame::getWidth() const { return mWidth; } const std::vector<int16_t>& TouchVideoFrame::getData() const { return mData; } const struct timeval& TouchVideoFrame::getTimestamp() const { return mTimestamp; } Loading services/inputflinger/TouchVideoDevice.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -37,10 +37,10 @@ using android::base::unique_fd; namespace android { TouchVideoDevice::TouchVideoDevice(int fd, std::string&& name, std::string&& devicePath, uint32_t width, uint32_t height, uint32_t height, uint32_t width, const std::array<const int16_t*, NUM_BUFFERS>& readLocations) : mFd(fd), mName(std::move(name)), mPath(std::move(devicePath)), mWidth(width), mHeight(height), mHeight(height), mWidth(width), mReadLocations(readLocations) { mFrames.reserve(MAX_QUEUE_SIZE); }; Loading Loading @@ -87,9 +87,9 @@ std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePat ALOGE("VIDIOC_G_FMT failed: %s", strerror(errno)); return nullptr; } const uint32_t width = v4l2_fmt.fmt.pix.width; const uint32_t height = v4l2_fmt.fmt.pix.height; ALOGI("Frame dimensions: width = %" PRIu32 " height = %" PRIu32, width, height); const uint32_t width = v4l2_fmt.fmt.pix.width; ALOGI("Frame dimensions: height = %" PRIu32 " width = %" PRIu32, height, width); struct v4l2_requestbuffers req; req.count = NUM_BUFFERS; Loading @@ -116,7 +116,7 @@ std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePat ALOGE("VIDIOC_QUERYBUF failed: %s", strerror(errno)); return nullptr; } if (buf.length != width * height * sizeof(int16_t)) { if (buf.length != height * width * sizeof(int16_t)) { ALOGE("Unexpected value of buf.length = %i (offset = %" PRIu32 ")", buf.length, buf.m.offset); return nullptr; Loading Loading @@ -148,7 +148,7 @@ std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePat } // Using 'new' to access a non-public constructor. return std::unique_ptr<TouchVideoDevice>(new TouchVideoDevice( fd.release(), std::move(name), std::move(devicePath), width, height, readLocations)); fd.release(), std::move(name), std::move(devicePath), height, width, readLocations)); } size_t TouchVideoDevice::readAndQueueFrames() { Loading Loading @@ -193,10 +193,10 @@ std::optional<TouchVideoFrame> TouchVideoDevice::readFrame() { ALOGW("The timestamp %ld.%ld was not acquired using CLOCK_MONOTONIC", buf.timestamp.tv_sec, buf.timestamp.tv_usec); } std::vector<int16_t> data(mWidth * mHeight); std::vector<int16_t> data(mHeight * mWidth); const int16_t* readFrom = mReadLocations[buf.index]; std::copy(readFrom, readFrom + mWidth * mHeight, data.begin()); TouchVideoFrame frame(mWidth, mHeight, std::move(data), buf.timestamp); std::copy(readFrom, readFrom + mHeight * mWidth, data.begin()); TouchVideoFrame frame(mHeight, mWidth, std::move(data), buf.timestamp); result = ioctl(mFd.get(), VIDIOC_QBUF, &buf); if (result == -1) { Loading Loading @@ -230,7 +230,7 @@ TouchVideoDevice::~TouchVideoDevice() { } for (const int16_t* buffer : mReadLocations) { void* bufferAddress = static_cast<void*>(const_cast<int16_t*>(buffer)); result = munmap(bufferAddress, mWidth * mHeight * sizeof(int16_t)); result = munmap(bufferAddress, mHeight * mWidth * sizeof(int16_t)); if (result == -1) { ALOGE("%s: Couldn't unmap: [%s]", __func__, strerror(errno)); } Loading @@ -238,9 +238,9 @@ TouchVideoDevice::~TouchVideoDevice() { } std::string TouchVideoDevice::dump() const { return StringPrintf("Video device %s (%s) : width=%" PRIu32 ", height=%" PRIu32 return StringPrintf("Video device %s (%s) : height=%" PRIu32 ", width=%" PRIu32 ", fd=%i, hasValidFd=%s", mName.c_str(), mPath.c_str(), mWidth, mHeight, mFd.get(), mName.c_str(), mPath.c_str(), mHeight, mWidth, mFd.get(), hasValidFd() ? "true" : "false"); } Loading services/inputflinger/TouchVideoDevice.h +6 −6 Original line number Diff line number Diff line Loading @@ -53,14 +53,14 @@ public: * Get the file path of this video device. */ const std::string& getPath() const { return mPath; } /** * Get the width of the heatmap frame */ uint32_t getWidth() const { return mWidth; } /** * Get the height of the heatmap frame */ uint32_t getHeight() const { return mHeight; } /** * Get the width of the heatmap frame */ uint32_t getWidth() const { return mWidth; } /** * Direct read of the frame. Stores the frame into internal buffer. * Return the number of frames that were successfully read. Loading @@ -87,8 +87,8 @@ private: std::string mName; std::string mPath; uint32_t mWidth; uint32_t mHeight; uint32_t mWidth; static constexpr int INVALID_FD = -1; /** Loading @@ -110,7 +110,7 @@ private: * To get a new TouchVideoDevice, use 'create' instead. */ explicit TouchVideoDevice(int fd, std::string&& name, std::string&& devicePath, uint32_t width, uint32_t height, uint32_t height, uint32_t width, const std::array<const int16_t*, NUM_BUFFERS>& readLocations); /** * Read all currently available frames. Loading Loading
include/input/TouchVideoFrame.h +6 −6 Original line number Diff line number Diff line Loading @@ -30,19 +30,19 @@ namespace android { */ class TouchVideoFrame { public: TouchVideoFrame(uint32_t width, uint32_t height, std::vector<int16_t> data, TouchVideoFrame(uint32_t height, uint32_t width, std::vector<int16_t> data, const struct timeval& timestamp); bool operator==(const TouchVideoFrame& rhs) const; /** * Width of the frame */ uint32_t getWidth() const; /** * Height of the frame */ uint32_t getHeight() const; /** * Width of the frame */ uint32_t getWidth() const; /** * The touch strength data. * The array is a 2-D row-major matrix, with dimensions (height, width). Loading @@ -56,8 +56,8 @@ public: const struct timeval& getTimestamp() const; private: uint32_t mWidth; uint32_t mHeight; uint32_t mWidth; std::vector<int16_t> mData; struct timeval mTimestamp; }; Loading
libs/input/TouchVideoFrame.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -18,23 +18,23 @@ namespace android { TouchVideoFrame::TouchVideoFrame(uint32_t width, uint32_t height, std::vector<int16_t> data, TouchVideoFrame::TouchVideoFrame(uint32_t height, uint32_t width, std::vector<int16_t> data, const struct timeval& timestamp) : mWidth(width), mHeight(height), mData(std::move(data)), mTimestamp(timestamp) { mHeight(height), mWidth(width),mData(std::move(data)), mTimestamp(timestamp) { } bool TouchVideoFrame::operator==(const TouchVideoFrame& rhs) const { return mWidth == rhs.mWidth && mHeight == rhs.mHeight return mHeight == rhs.mHeight && mWidth == rhs.mWidth && mData == rhs.mData && mTimestamp.tv_sec == rhs.mTimestamp.tv_sec && mTimestamp.tv_usec == rhs.mTimestamp.tv_usec; } uint32_t TouchVideoFrame::getWidth() const { return mWidth; } uint32_t TouchVideoFrame::getHeight() const { return mHeight; } uint32_t TouchVideoFrame::getWidth() const { return mWidth; } const std::vector<int16_t>& TouchVideoFrame::getData() const { return mData; } const struct timeval& TouchVideoFrame::getTimestamp() const { return mTimestamp; } Loading
services/inputflinger/TouchVideoDevice.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -37,10 +37,10 @@ using android::base::unique_fd; namespace android { TouchVideoDevice::TouchVideoDevice(int fd, std::string&& name, std::string&& devicePath, uint32_t width, uint32_t height, uint32_t height, uint32_t width, const std::array<const int16_t*, NUM_BUFFERS>& readLocations) : mFd(fd), mName(std::move(name)), mPath(std::move(devicePath)), mWidth(width), mHeight(height), mHeight(height), mWidth(width), mReadLocations(readLocations) { mFrames.reserve(MAX_QUEUE_SIZE); }; Loading Loading @@ -87,9 +87,9 @@ std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePat ALOGE("VIDIOC_G_FMT failed: %s", strerror(errno)); return nullptr; } const uint32_t width = v4l2_fmt.fmt.pix.width; const uint32_t height = v4l2_fmt.fmt.pix.height; ALOGI("Frame dimensions: width = %" PRIu32 " height = %" PRIu32, width, height); const uint32_t width = v4l2_fmt.fmt.pix.width; ALOGI("Frame dimensions: height = %" PRIu32 " width = %" PRIu32, height, width); struct v4l2_requestbuffers req; req.count = NUM_BUFFERS; Loading @@ -116,7 +116,7 @@ std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePat ALOGE("VIDIOC_QUERYBUF failed: %s", strerror(errno)); return nullptr; } if (buf.length != width * height * sizeof(int16_t)) { if (buf.length != height * width * sizeof(int16_t)) { ALOGE("Unexpected value of buf.length = %i (offset = %" PRIu32 ")", buf.length, buf.m.offset); return nullptr; Loading Loading @@ -148,7 +148,7 @@ std::unique_ptr<TouchVideoDevice> TouchVideoDevice::create(std::string devicePat } // Using 'new' to access a non-public constructor. return std::unique_ptr<TouchVideoDevice>(new TouchVideoDevice( fd.release(), std::move(name), std::move(devicePath), width, height, readLocations)); fd.release(), std::move(name), std::move(devicePath), height, width, readLocations)); } size_t TouchVideoDevice::readAndQueueFrames() { Loading Loading @@ -193,10 +193,10 @@ std::optional<TouchVideoFrame> TouchVideoDevice::readFrame() { ALOGW("The timestamp %ld.%ld was not acquired using CLOCK_MONOTONIC", buf.timestamp.tv_sec, buf.timestamp.tv_usec); } std::vector<int16_t> data(mWidth * mHeight); std::vector<int16_t> data(mHeight * mWidth); const int16_t* readFrom = mReadLocations[buf.index]; std::copy(readFrom, readFrom + mWidth * mHeight, data.begin()); TouchVideoFrame frame(mWidth, mHeight, std::move(data), buf.timestamp); std::copy(readFrom, readFrom + mHeight * mWidth, data.begin()); TouchVideoFrame frame(mHeight, mWidth, std::move(data), buf.timestamp); result = ioctl(mFd.get(), VIDIOC_QBUF, &buf); if (result == -1) { Loading Loading @@ -230,7 +230,7 @@ TouchVideoDevice::~TouchVideoDevice() { } for (const int16_t* buffer : mReadLocations) { void* bufferAddress = static_cast<void*>(const_cast<int16_t*>(buffer)); result = munmap(bufferAddress, mWidth * mHeight * sizeof(int16_t)); result = munmap(bufferAddress, mHeight * mWidth * sizeof(int16_t)); if (result == -1) { ALOGE("%s: Couldn't unmap: [%s]", __func__, strerror(errno)); } Loading @@ -238,9 +238,9 @@ TouchVideoDevice::~TouchVideoDevice() { } std::string TouchVideoDevice::dump() const { return StringPrintf("Video device %s (%s) : width=%" PRIu32 ", height=%" PRIu32 return StringPrintf("Video device %s (%s) : height=%" PRIu32 ", width=%" PRIu32 ", fd=%i, hasValidFd=%s", mName.c_str(), mPath.c_str(), mWidth, mHeight, mFd.get(), mName.c_str(), mPath.c_str(), mHeight, mWidth, mFd.get(), hasValidFd() ? "true" : "false"); } Loading
services/inputflinger/TouchVideoDevice.h +6 −6 Original line number Diff line number Diff line Loading @@ -53,14 +53,14 @@ public: * Get the file path of this video device. */ const std::string& getPath() const { return mPath; } /** * Get the width of the heatmap frame */ uint32_t getWidth() const { return mWidth; } /** * Get the height of the heatmap frame */ uint32_t getHeight() const { return mHeight; } /** * Get the width of the heatmap frame */ uint32_t getWidth() const { return mWidth; } /** * Direct read of the frame. Stores the frame into internal buffer. * Return the number of frames that were successfully read. Loading @@ -87,8 +87,8 @@ private: std::string mName; std::string mPath; uint32_t mWidth; uint32_t mHeight; uint32_t mWidth; static constexpr int INVALID_FD = -1; /** Loading @@ -110,7 +110,7 @@ private: * To get a new TouchVideoDevice, use 'create' instead. */ explicit TouchVideoDevice(int fd, std::string&& name, std::string&& devicePath, uint32_t width, uint32_t height, uint32_t height, uint32_t width, const std::array<const int16_t*, NUM_BUFFERS>& readLocations); /** * Read all currently available frames. Loading