summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_buffer.h5
-rw-r--r--src/android/camera_capabilities.h6
-rw-r--r--src/android/camera_device.h6
-rw-r--r--src/android/camera_hal_config.h5
-rw-r--r--src/android/camera_hal_manager.h6
-rw-r--r--src/android/camera_metadata.h6
-rw-r--r--src/android/camera_ops.h6
-rw-r--r--src/android/camera_request.h6
-rw-r--r--src/android/camera_stream.h6
-rw-r--r--src/android/camera_worker.h6
-rw-r--r--src/android/jpeg/encoder.h6
-rw-r--r--src/android/jpeg/encoder_libjpeg.h6
-rw-r--r--src/android/jpeg/exif.h6
-rw-r--r--src/android/jpeg/post_processor_jpeg.h6
-rw-r--r--src/android/jpeg/thumbnailer.h6
-rw-r--r--src/android/post_processor.h6
-rw-r--r--src/android/yuv/post_processor_yuv.h6
17 files changed, 34 insertions, 66 deletions
diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h
index 226a8f5c..b4531c80 100644
--- a/src/android/camera_buffer.h
+++ b/src/android/camera_buffer.h
@@ -4,8 +4,8 @@
*
* camera_buffer.h - Frame buffer handling interface definition
*/
-#ifndef __ANDROID_CAMERA_BUFFER_H__
-#define __ANDROID_CAMERA_BUFFER_H__
+
+#pragma once
#include <hardware/camera3.h>
@@ -82,4 +82,3 @@ size_t CameraBuffer::jpegBufferSize(size_t maxJpegBufferSize) const \
{ \
return _d()->jpegBufferSize(maxJpegBufferSize); \
}
-#endif /* __ANDROID_CAMERA_BUFFER_H__ */
diff --git a/src/android/camera_capabilities.h b/src/android/camera_capabilities.h
index 2cf97ae8..6f66f221 100644
--- a/src/android/camera_capabilities.h
+++ b/src/android/camera_capabilities.h
@@ -4,8 +4,8 @@
*
* camera_capabilities.h - Camera static properties manager
*/
-#ifndef __ANDROID_CAMERA_CAPABILITIES_H__
-#define __ANDROID_CAMERA_CAPABILITIES_H__
+
+#pragma once
#include <map>
#include <memory>
@@ -84,5 +84,3 @@ private:
std::set<int32_t> availableRequestKeys_;
std::set<int32_t> availableResultKeys_;
};
-
-#endif /* __ANDROID_CAMERA_CAPABILITIES_H__ */
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 2a414020..51fe7da2 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -4,8 +4,8 @@
*
* camera_device.h - libcamera Android Camera Device
*/
-#ifndef __ANDROID_CAMERA_DEVICE_H__
-#define __ANDROID_CAMERA_DEVICE_H__
+
+#pragma once
#include <map>
#include <memory>
@@ -130,5 +130,3 @@ private:
CameraMetadata lastSettings_;
};
-
-#endif /* __ANDROID_CAMERA_DEVICE_H__ */
diff --git a/src/android/camera_hal_config.h b/src/android/camera_hal_config.h
index a79d5d6c..9df554f9 100644
--- a/src/android/camera_hal_config.h
+++ b/src/android/camera_hal_config.h
@@ -4,8 +4,8 @@
*
* camera_hal_config.h - Camera HAL configuration file manager
*/
-#ifndef __ANDROID_CAMERA_HAL_CONFIG_H__
-#define __ANDROID_CAMERA_HAL_CONFIG_H__
+
+#pragma once
#include <map>
#include <string>
@@ -36,4 +36,3 @@ private:
int parseConfigurationFile();
};
-#endif /* __ANDROID_CAMERA_HAL_CONFIG_H__ */
diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
index 3f6d302a..192f2fc5 100644
--- a/src/android/camera_hal_manager.h
+++ b/src/android/camera_hal_manager.h
@@ -4,8 +4,8 @@
*
* camera_hal_manager.h - libcamera Android Camera Manager
*/
-#ifndef __ANDROID_CAMERA_MANAGER_H__
-#define __ANDROID_CAMERA_MANAGER_H__
+
+#pragma once
#include <map>
#include <mutex>
@@ -69,5 +69,3 @@ private:
unsigned int numInternalCameras_;
unsigned int nextExternalCameraId_;
};
-
-#endif /* __ANDROID_CAMERA_MANAGER_H__ */
diff --git a/src/android/camera_metadata.h b/src/android/camera_metadata.h
index 8555c7c3..e70f60af 100644
--- a/src/android/camera_metadata.h
+++ b/src/android/camera_metadata.h
@@ -4,8 +4,8 @@
*
* camera_metadata.h - libcamera Android Camera Metadata Helper
*/
-#ifndef __ANDROID_CAMERA_METADATA_H__
-#define __ANDROID_CAMERA_METADATA_H__
+
+#pragma once
#include <stdint.h>
#include <vector>
@@ -99,5 +99,3 @@ private:
bool valid_;
bool resized_;
};
-
-#endif /* __ANDROID_CAMERA_METADATA_H__ */
diff --git a/src/android/camera_ops.h b/src/android/camera_ops.h
index 304e7b85..b501bb7e 100644
--- a/src/android/camera_ops.h
+++ b/src/android/camera_ops.h
@@ -4,12 +4,10 @@
*
* camera_ops.h - Android Camera HAL Operations
*/
-#ifndef __ANDROID_CAMERA_OPS_H__
-#define __ANDROID_CAMERA_OPS_H__
+
+#pragma once
#include <hardware/camera3.h>
int hal_dev_close(hw_device_t *hw_device);
extern camera3_device_ops hal_dev_ops;
-
-#endif /* __ANDROID_CAMERA_OPS_H__ */
diff --git a/src/android/camera_request.h b/src/android/camera_request.h
index 8d1204e5..f3cb6d64 100644
--- a/src/android/camera_request.h
+++ b/src/android/camera_request.h
@@ -4,8 +4,8 @@
*
* camera_request.h - libcamera Android Camera Request Descriptor
*/
-#ifndef __ANDROID_CAMERA_REQUEST_H__
-#define __ANDROID_CAMERA_REQUEST_H__
+
+#pragma once
#include <map>
#include <memory>
@@ -80,5 +80,3 @@ public:
private:
LIBCAMERA_DISABLE_COPY(Camera3RequestDescriptor)
};
-
-#endif /* __ANDROID_CAMERA_REQUEST_H__ */
diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
index 0c402deb..e9da75f0 100644
--- a/src/android/camera_stream.h
+++ b/src/android/camera_stream.h
@@ -4,8 +4,8 @@
*
* camera_stream.h - Camera HAL stream
*/
-#ifndef __ANDROID_CAMERA_STREAM_H__
-#define __ANDROID_CAMERA_STREAM_H__
+
+#pragma once
#include <condition_variable>
#include <memory>
@@ -179,5 +179,3 @@ private:
std::unique_ptr<PostProcessorWorker> worker_;
};
-
-#endif /* __ANDROID_CAMERA_STREAM__ */
diff --git a/src/android/camera_worker.h b/src/android/camera_worker.h
index c94f1632..26ecc273 100644
--- a/src/android/camera_worker.h
+++ b/src/android/camera_worker.h
@@ -4,8 +4,8 @@
*
* camera_worker.h - Process capture requests on behalf of the Camera HAL
*/
-#ifndef __ANDROID_CAMERA_WORKER_H__
-#define __ANDROID_CAMERA_WORKER_H__
+
+#pragma once
#include <memory>
#include <stdint.h>
@@ -68,5 +68,3 @@ private:
Worker worker_;
};
-
-#endif /* __ANDROID_CAMERA_WORKER_H__ */
diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
index a28522f4..b974d367 100644
--- a/src/android/jpeg/encoder.h
+++ b/src/android/jpeg/encoder.h
@@ -4,8 +4,8 @@
*
* encoder.h - Image encoding interface
*/
-#ifndef __ANDROID_JPEG_ENCODER_H__
-#define __ANDROID_JPEG_ENCODER_H__
+
+#pragma once
#include <libcamera/base/span.h>
@@ -23,5 +23,3 @@ public:
libcamera::Span<const uint8_t> exifData,
unsigned int quality) = 0;
};
-
-#endif /* __ANDROID_JPEG_ENCODER_H__ */
diff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h
index 45ffbd7f..1b3ac067 100644
--- a/src/android/jpeg/encoder_libjpeg.h
+++ b/src/android/jpeg/encoder_libjpeg.h
@@ -4,8 +4,8 @@
*
* encoder_libjpeg.h - JPEG encoding using libjpeg
*/
-#ifndef __ANDROID_JPEG_ENCODER_LIBJPEG_H__
-#define __ANDROID_JPEG_ENCODER_LIBJPEG_H__
+
+#pragma once
#include "encoder.h"
@@ -43,5 +43,3 @@ private:
bool nv_;
bool nvSwap_;
};
-
-#endif /* __ANDROID_JPEG_ENCODER_LIBJPEG_H__ */
diff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h
index 23b0e097..2ff8fb78 100644
--- a/src/android/jpeg/exif.h
+++ b/src/android/jpeg/exif.h
@@ -4,8 +4,8 @@
*
* exif.h - EXIF tag creator using libexif
*/
-#ifndef __ANDROID_JPEG_EXIF_H__
-#define __ANDROID_JPEG_EXIF_H__
+
+#pragma once
#include <chrono>
#include <string>
@@ -107,5 +107,3 @@ private:
unsigned char *exifData_;
unsigned int size_;
};
-
-#endif /* __ANDROID_JPEG_EXIF_H__ */
diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h
index 43fcbe60..98309b01 100644
--- a/src/android/jpeg/post_processor_jpeg.h
+++ b/src/android/jpeg/post_processor_jpeg.h
@@ -4,8 +4,8 @@
*
* post_processor_jpeg.h - JPEG Post Processor
*/
-#ifndef __ANDROID_POST_PROCESSOR_JPEG_H__
-#define __ANDROID_POST_PROCESSOR_JPEG_H__
+
+#pragma once
#include "../post_processor.h"
#include "encoder_libjpeg.h"
@@ -36,5 +36,3 @@ private:
EncoderLibJpeg thumbnailEncoder_;
Thumbnailer thumbnailer_;
};
-
-#endif /* __ANDROID_POST_PROCESSOR_JPEG_H__ */
diff --git a/src/android/jpeg/thumbnailer.h b/src/android/jpeg/thumbnailer.h
index 4d086c49..d933cf0e 100644
--- a/src/android/jpeg/thumbnailer.h
+++ b/src/android/jpeg/thumbnailer.h
@@ -4,8 +4,8 @@
*
* thumbnailer.h - Simple image thumbnailer
*/
-#ifndef __ANDROID_JPEG_THUMBNAILER_H__
-#define __ANDROID_JPEG_THUMBNAILER_H__
+
+#pragma once
#include <libcamera/framebuffer.h>
#include <libcamera/geometry.h>
@@ -30,5 +30,3 @@ private:
bool valid_;
};
-
-#endif /* __ANDROID_JPEG_THUMBNAILER_H__ */
diff --git a/src/android/post_processor.h b/src/android/post_processor.h
index 5ec71c93..1a205b05 100644
--- a/src/android/post_processor.h
+++ b/src/android/post_processor.h
@@ -4,8 +4,8 @@
*
* post_processor.h - CameraStream Post Processing Interface
*/
-#ifndef __ANDROID_POST_PROCESSOR_H__
-#define __ANDROID_POST_PROCESSOR_H__
+
+#pragma once
#include <libcamera/base/signal.h>
@@ -31,5 +31,3 @@ public:
libcamera::Signal<Camera3RequestDescriptor::StreamBuffer *, Status> processComplete;
};
-
-#endif /* __ANDROID_POST_PROCESSOR_H__ */
diff --git a/src/android/yuv/post_processor_yuv.h b/src/android/yuv/post_processor_yuv.h
index 39ec7994..a7ac17c5 100644
--- a/src/android/yuv/post_processor_yuv.h
+++ b/src/android/yuv/post_processor_yuv.h
@@ -4,8 +4,8 @@
*
* post_processor_yuv.h - Post Processor using libyuv
*/
-#ifndef __ANDROID_POST_PROCESSOR_YUV_H__
-#define __ANDROID_POST_PROCESSOR_YUV_H__
+
+#pragma once
#include "../post_processor.h"
@@ -33,5 +33,3 @@ private:
unsigned int sourceStride_[2] = {};
unsigned int destinationStride_[2] = {};
};
-
-#endif /* __ANDROID_POST_PROCESSOR_YUV_H__ */
>"Read failed" << endl; close(outfd); stop(-EIO); return; } else if (!num) break; if (write(outfd, buf, num) < 0) { cerr << "Write failed" << endl; close(outfd); stop(-EIO); return; } } close(fd); } lseek(outfd, 0, 0); response.data.push_back(CMD_JOIN); response.fds.push_back(outfd); ret = ipc_.send(response); if (ret < 0) { cerr << "Join failed" << endl; stop(ret); } close(outfd); break; } default: cerr << "Unknown command " << cmd << endl; stop(-EINVAL); break; } } void stop(int code) { exitCode_ = code; exit_ = true; } IPCUnixSocket ipc_; EventDispatcher *dispatcher_; int exitCode_; bool exit_; }; class UnixSocketTest : public Test { protected: int slaveStart(int fd) { pid_ = fork(); if (pid_ == -1) return TestFail; if (!pid_) { std::string arg = std::to_string(fd); execl("/proc/self/exe", "/proc/self/exe", arg.c_str(), nullptr); /* Only get here if exec fails. */ exit(TestFail); } return TestPass; } int slaveStop() { int status; if (pid_ < 0) return TestFail; if (waitpid(pid_, &status, 0) < 0) return TestFail; if (!WIFEXITED(status) || WEXITSTATUS(status)) return TestFail; return TestPass; } int testReverse() { IPCUnixSocket::Payload message, response; int ret; message.data = { CMD_REVERSE, 1, 2, 3, 4, 5 }; ret = call(message, &response); if (ret) return ret; std::reverse(response.data.begin() + 1, response.data.end()); if (message.data != response.data) return TestFail; return 0; } int testEmptyFail() { IPCUnixSocket::Payload message; return ipc_.send(message) != -EINVAL; } int testCalc() { IPCUnixSocket::Payload message, response; int sizeOut, sizeIn, ret; sizeOut = prepareFDs(&message, 2); if (sizeOut < 0) return sizeOut; message.data.push_back(CMD_LEN_CALC); ret = call(message, &response); if (ret) return ret; memcpy(&sizeIn, response.data.data() + 1, sizeof(sizeIn)); if (sizeOut != sizeIn) return TestFail; return 0; } int testCmp() { IPCUnixSocket::Payload message; int size; size = prepareFDs(&message, 7); if (size < 0) return size; message.data.resize(1 + sizeof(size)); message.data[0] = CMD_LEN_CMP; memcpy(message.data.data() + 1, &size, sizeof(size)); if (ipc_.send(message)) return TestFail; return 0; } int testFdOrder() { IPCUnixSocket::Payload message, response; int ret; static const char *strings[2] = { "Foo", "Bar", }; int fds[2]; for (unsigned int i = 0; i < std::size(strings); i++) { unsigned int len = strlen(strings[i]); fds[i] = open("/tmp", O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR); if (fds[i] < 0) return TestFail; ret = write(fds[i], strings[i], len); if (ret < 0) return TestFail; lseek(fds[i], 0, 0); message.fds.push_back(fds[i]); } message.data.push_back(CMD_JOIN); ret = call(message, &response); if (ret) return ret; for (unsigned int i = 0; i < std::size(strings); i++) { unsigned int len = strlen(strings[i]); char buf[len]; close(fds[i]); if (read(response.fds[0], &buf, len) <= 0) return TestFail; if (memcmp(buf, strings[i], len)) return TestFail; } close(response.fds[0]); return 0; } int init() { callResponse_ = nullptr; return 0; } int run() { int slavefd = ipc_.create(); if (slavefd < 0) return TestFail; if (slaveStart(slavefd)) { cerr << "Failed to start slave" << endl; return TestFail; } ipc_.readyRead.connect(this, &UnixSocketTest::readyRead); /* Test reversing a string, this test sending only data. */ if (testReverse()) { cerr << "Reverse array test failed" << endl; return TestFail; } /* Test that an empty message fails. */ if (testEmptyFail()) { cerr << "Empty message test failed" << endl; return TestFail; } /* Test offloading a calculation, this test sending only FDs. */ if (testCalc()) { cerr << "Calc test failed" << endl; return TestFail; } /* Test fire and forget, this tests sending data and FDs. */ if (testCmp()) { cerr << "Cmp test failed" << endl; return TestFail; } /* Test order of file descriptors. */ if (testFdOrder()) { cerr << "fd order test failed" << endl; return TestFail; } /* Close slave connection. */ IPCUnixSocket::Payload close; close.data.push_back(CMD_CLOSE); if (ipc_.send(close)) {