summaryrefslogtreecommitdiff
path: root/utils/hooks/pre-push
diff options
context:
space:
mode:
authorRicardo Ribalda <ricardo@ribalda.com>2020-09-24 09:19:20 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-09-24 21:08:30 +0300
commitaba567338b25c8cefe9e9e257d34ad3a61776276 (patch)
treeb46c8f2690d89542811bb4171d7f5b7ef190bc54 /utils/hooks/pre-push
parent4e998cea15cf3d962473aa5faab99f939d9dc0dd (diff)
Documentation: Move all dependencies into features
This way if the user enables the documentation and the dependencies are missing the configure fails. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'utils/hooks/pre-push')
0 files changed, 0 insertions, 0 deletions
class="hl ppc">#include <unistd.h> #include "buffer_writer.h" using namespace libcamera; BufferWriter::BufferWriter(const std::string &pattern) : pattern_(pattern) { } BufferWriter::~BufferWriter() { for (auto &iter : mappedBuffers_) { void *memory = iter.second.first; unsigned int length = iter.second.second; munmap(memory, length); } mappedBuffers_.clear(); } void BufferWriter::mapBuffer(FrameBuffer *buffer) { for (const FrameBuffer::Plane &plane : buffer->planes()) { void *memory = mmap(NULL, plane.length, PROT_READ, MAP_SHARED, plane.fd.fd(), 0); mappedBuffers_[plane.fd.fd()] = std::make_pair(memory, plane.length); } } int BufferWriter::write(FrameBuffer *buffer, const std::string &streamName) { std::string filename; size_t pos; int fd, ret = 0; filename = pattern_; pos = filename.find_first_of('#'); if (pos != std::string::npos) { std::stringstream ss; ss << streamName << "-" << std::setw(6) << std::setfill('0') << buffer->metadata().sequence; filename.replace(pos, 1, ss.str()); } fd = open(filename.c_str(), O_CREAT | O_WRONLY | (pos == std::string::npos ? O_APPEND : O_TRUNC), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd == -1) return -errno; for (unsigned int i = 0; i < buffer->planes().size(); ++i) { const FrameBuffer::Plane &plane = buffer->planes()[i]; const FrameMetadata::Plane &meta = buffer->metadata().planes[i]; void *data = mappedBuffers_[plane.fd.fd()].first; unsigned int length = std::min(meta.bytesused, plane.length); if (meta.bytesused > plane.length) std::cerr << "payload size " << meta.bytesused << " larger than plane size " << plane.length << std::endl; ret = ::write(fd, data, length); if (ret < 0) { ret = -errno; std::cerr << "write error: " << strerror(-ret)