diff options
Diffstat (limited to 'src/android')
-rw-r--r-- | src/android/camera_buffer.h | 2 | ||||
-rw-r--r-- | src/android/mm/generic_camera_buffer.cpp | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h index 2311cdaf..784fbd50 100644 --- a/src/android/camera_buffer.h +++ b/src/android/camera_buffer.h @@ -26,6 +26,8 @@ public: libcamera::Span<const uint8_t> plane(unsigned int plane) const; libcamera::Span<uint8_t> plane(unsigned int plane); + + size_t jpegBufferSize(size_t maxJpegBufferSize) const; }; #endif /* __ANDROID_CAMERA_BUFFER_H__ */ diff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp index 45a83c35..98e63dfa 100644 --- a/src/android/mm/generic_camera_buffer.cpp +++ b/src/android/mm/generic_camera_buffer.cpp @@ -27,6 +27,8 @@ public: unsigned int numPlanes() const; Span<uint8_t> plane(unsigned int plane); + + size_t jpegBufferSize(size_t maxJpegBufferSize) const; }; CameraBuffer::Private::Private(CameraBuffer *cameraBuffer, @@ -77,6 +79,12 @@ Span<uint8_t> CameraBuffer::Private::plane(unsigned int plane) return maps_[plane]; } +size_t CameraBuffer::Private::jpegBufferSize(size_t maxJpegBufferSize) const +{ + return std::min<unsigned int>(maps_[0].size(), + maxJpegBufferSize); +} + CameraBuffer::CameraBuffer(buffer_handle_t camera3Buffer, int flags) : Extensible(new Private(this, camera3Buffer, flags)) { @@ -109,3 +117,9 @@ Span<uint8_t> CameraBuffer::plane(unsigned int plane) Private *const d = LIBCAMERA_D_PTR(); return d->plane(plane); } + +size_t CameraBuffer::jpegBufferSize(size_t maxJpegBufferSize) const +{ + const Private *const d = LIBCAMERA_D_PTR(); + return d->jpegBufferSize(maxJpegBufferSize); +} |