From 6a31a8d8e2742990f3b3a3dbf5157a9e1cb835ea Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 28 Jun 2021 01:54:17 +0300 Subject: libcamera: buffer: Rename buffer.h to framebuffer.h libcamera names header files based on the classes they define. The buffer.h file is an exception. Rename it to framebuffer.h. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Jacopo Mondi Reviewed-by: Hirokazu Honda Reviewed-by: Kieran Bingham --- include/libcamera/buffer.h | 74 ----------------------- include/libcamera/framebuffer.h | 74 +++++++++++++++++++++++ include/libcamera/internal/buffer.h | 52 ---------------- include/libcamera/internal/framebuffer.h | 52 ++++++++++++++++ include/libcamera/internal/ipa_data_serializer.h | 2 +- include/libcamera/internal/meson.build | 2 +- include/libcamera/internal/tracepoints/request.tp | 2 +- include/libcamera/internal/v4l2_videodevice.h | 2 +- include/libcamera/ipa/ipa_interface.h | 2 +- include/libcamera/meson.build | 2 +- include/libcamera/stream.h | 2 +- 11 files changed, 133 insertions(+), 133 deletions(-) delete mode 100644 include/libcamera/buffer.h create mode 100644 include/libcamera/framebuffer.h delete mode 100644 include/libcamera/internal/buffer.h create mode 100644 include/libcamera/internal/framebuffer.h (limited to 'include') diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h deleted file mode 100644 index 323d1cba..00000000 --- a/include/libcamera/buffer.h +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * buffer.h - Buffer handling - */ -#ifndef __LIBCAMERA_BUFFER_H__ -#define __LIBCAMERA_BUFFER_H__ - -#include -#include - -#include - -#include - -namespace libcamera { - -class Request; - -struct FrameMetadata { - enum Status { - FrameSuccess, - FrameError, - FrameCancelled, - }; - - struct Plane { - unsigned int bytesused; - }; - - Status status; - unsigned int sequence; - uint64_t timestamp; - std::vector planes; -}; - -class FrameBuffer final -{ -public: - struct Plane { - FileDescriptor fd; - unsigned int length; - }; - - FrameBuffer(const std::vector &planes, unsigned int cookie = 0); - - const std::vector &planes() const { return planes_; } - - Request *request() const { return request_; } - void setRequest(Request *request) { request_ = request; } - const FrameMetadata &metadata() const { return metadata_; } - - unsigned int cookie() const { return cookie_; } - void setCookie(unsigned int cookie) { cookie_ = cookie; } - - void cancel() { metadata_.status = FrameMetadata::FrameCancelled; } - -private: - LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer) - - friend class V4L2VideoDevice; /* Needed to update metadata_. */ - - std::vector planes_; - - Request *request_; - FrameMetadata metadata_; - - unsigned int cookie_; -}; - -} /* namespace libcamera */ - -#endif /* __LIBCAMERA_BUFFER_H__ */ diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h new file mode 100644 index 00000000..baf22a46 --- /dev/null +++ b/include/libcamera/framebuffer.h @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * framebuffer.h - Frame buffer handling + */ +#ifndef __LIBCAMERA_FRAMEBUFFER_H__ +#define __LIBCAMERA_FRAMEBUFFER_H__ + +#include +#include + +#include + +#include + +namespace libcamera { + +class Request; + +struct FrameMetadata { + enum Status { + FrameSuccess, + FrameError, + FrameCancelled, + }; + + struct Plane { + unsigned int bytesused; + }; + + Status status; + unsigned int sequence; + uint64_t timestamp; + std::vector planes; +}; + +class FrameBuffer final +{ +public: + struct Plane { + FileDescriptor fd; + unsigned int length; + }; + + FrameBuffer(const std::vector &planes, unsigned int cookie = 0); + + const std::vector &planes() const { return planes_; } + + Request *request() const { return request_; } + void setRequest(Request *request) { request_ = request; } + const FrameMetadata &metadata() const { return metadata_; } + + unsigned int cookie() const { return cookie_; } + void setCookie(unsigned int cookie) { cookie_ = cookie; } + + void cancel() { metadata_.status = FrameMetadata::FrameCancelled; } + +private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer) + + friend class V4L2VideoDevice; /* Needed to update metadata_. */ + + std::vector planes_; + + Request *request_; + FrameMetadata metadata_; + + unsigned int cookie_; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_FRAMEBUFFER_H__ */ diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h deleted file mode 100644 index beae0cb9..00000000 --- a/include/libcamera/internal/buffer.h +++ /dev/null @@ -1,52 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2020, Google Inc. - * - * buffer.h - Internal buffer handling - */ -#ifndef __LIBCAMERA_INTERNAL_BUFFER_H__ -#define __LIBCAMERA_INTERNAL_BUFFER_H__ - -#include -#include - -#include -#include - -#include - -namespace libcamera { - -class MappedBuffer -{ -public: - using Plane = Span; - - ~MappedBuffer(); - - MappedBuffer(MappedBuffer &&other); - MappedBuffer &operator=(MappedBuffer &&other); - - bool isValid() const { return error_ == 0; } - int error() const { return error_; } - const std::vector &maps() const { return maps_; } - -protected: - MappedBuffer(); - - int error_; - std::vector maps_; - -private: - LIBCAMERA_DISABLE_COPY(MappedBuffer) -}; - -class MappedFrameBuffer : public MappedBuffer -{ -public: - MappedFrameBuffer(const FrameBuffer *buffer, int flags); -}; - -} /* namespace libcamera */ - -#endif /* __LIBCAMERA_INTERNAL_BUFFER_H__ */ diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h new file mode 100644 index 00000000..0c76fc62 --- /dev/null +++ b/include/libcamera/internal/framebuffer.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Google Inc. + * + * framebuffer.h - Internal frame buffer handling + */ +#ifndef __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__ +#define __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__ + +#include +#include + +#include +#include + +#include + +namespace libcamera { + +class MappedBuffer +{ +public: + using Plane = Span; + + ~MappedBuffer(); + + MappedBuffer(MappedBuffer &&other); + MappedBuffer &operator=(MappedBuffer &&other); + + bool isValid() const { return error_ == 0; } + int error() const { return error_; } + const std::vector &maps() const { return maps_; } + +protected: + MappedBuffer(); + + int error_; + std::vector maps_; + +private: + LIBCAMERA_DISABLE_COPY(MappedBuffer) +}; + +class MappedFrameBuffer : public MappedBuffer +{ +public: + MappedFrameBuffer(const FrameBuffer *buffer, int flags); +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__ */ diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h index 76325b1d..519093bd 100644 --- a/include/libcamera/internal/ipa_data_serializer.h +++ b/include/libcamera/internal/ipa_data_serializer.h @@ -16,8 +16,8 @@ #include -#include #include +#include #include #include diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 16a76ebd..6d4eb7ed 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -11,7 +11,6 @@ libcamera_tracepoint_header = custom_target( libcamera_internal_headers = files([ 'bayer_format.h', - 'buffer.h', 'byte_stream_buffer.h', 'camera_controls.h', 'camera_sensor.h', @@ -23,6 +22,7 @@ libcamera_internal_headers = files([ 'device_enumerator_sysfs.h', 'device_enumerator_udev.h', 'formats.h', + 'framebuffer.h', 'ipa_manager.h', 'ipa_module.h', 'ipa_proxy.h', diff --git a/include/libcamera/internal/tracepoints/request.tp b/include/libcamera/internal/tracepoints/request.tp index 9c841b97..37d8c46f 100644 --- a/include/libcamera/internal/tracepoints/request.tp +++ b/include/libcamera/internal/tracepoints/request.tp @@ -5,7 +5,7 @@ * request.tp - Tracepoints for the request object */ -#include +#include #include TRACEPOINT_EVENT_CLASS( diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index a7c3d529..e767ec84 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h index 9a15c86b..1590584c 100644 --- a/include/libcamera/ipa/ipa_interface.h +++ b/include/libcamera/ipa/ipa_interface.h @@ -15,8 +15,8 @@ #include -#include #include +#include #include namespace libcamera { diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index e4d5c655..5b25ef84 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -1,12 +1,12 @@ # SPDX-License-Identifier: CC0-1.0 libcamera_public_headers = files([ - 'buffer.h', 'camera.h', 'camera_manager.h', 'compiler.h', 'controls.h', 'file_descriptor.h', + 'framebuffer.h', 'framebuffer_allocator.h', 'geometry.h', 'logging.h', diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index bb47c390..0c55e716 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include -- cgit v1.2.1