[libcamera-devel] [RFC 5/8] libcamera: request: Rename the Stream to Buffer map
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Jul 2 00:44:16 CEST 2019
Hi Jacopo,
Thanks for your work.
On 2019-06-30 20:10:46 +0200, Jacopo Mondi wrote:
> As we're about to add support for mapping application buffers to
> streams' ones, rename the existing bufferMap_ to just buffers_, which
> also matches the associated accessor operation name.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> include/libcamera/request.h | 4 ++--
> src/libcamera/camera.cpp | 2 +-
> src/libcamera/request.cpp | 16 ++++++++--------
> 3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index 58de6f00a554..7adb753b2706 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -32,7 +32,7 @@ public:
> Request(const Request &) = delete;
> Request &operator=(const Request &) = delete;
>
> - const std::map<Stream *, Buffer *> &buffers() const { return bufferMap_; }
> + const std::map<Stream *, Buffer *> &buffers() const { return buffers_; }
> int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
> Buffer *findBuffer(Stream *stream) const;
>
> @@ -50,7 +50,7 @@ private:
> bool completeBuffer(Buffer *buffer);
>
> Camera *camera_;
> - std::map<Stream *, Buffer *> bufferMap_;
> + std::map<Stream *, Buffer *> buffers_;
> std::unordered_set<Buffer *> pending_;
>
> Status status_;
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index a71b44b82ea0..4b66d6216950 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -883,7 +883,7 @@ int Camera::stop()
> */
> void Camera::requestComplete(Request *request)
> {
> - std::map<Stream *, Buffer *> buffers(std::move(request->bufferMap_));
> + std::map<Stream *, Buffer *> buffers(std::move(request->buffers_));
> requestCompleted.emit(request, buffers);
> delete request;
> }
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index fa3ee46da440..def7f2f21dc7 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -70,20 +70,20 @@ Request::Request(Camera *camera)
> */
> int Request::setBuffers(const std::map<Stream *, Buffer *> &streamMap)
> {
> - if (!bufferMap_.empty()) {
> + if (!buffers_.empty()) {
> LOG(Request, Error) << "Buffers already set";
> return -EBUSY;
> }
>
> - bufferMap_ = streamMap;
> + buffers_ = streamMap;
> return 0;
> }
>
> /**
> - * \var Request::bufferMap_
> + * \var Request::buffers_
> * \brief Mapping of streams to buffers for this request
> *
> - * The bufferMap_ tracks the buffers associated with each stream. If a stream is
> + * The buffers_ tracks the buffers associated with each stream. If a stream is
> * not utilised in this request there will be no buffer for that stream in the
> * map.
> */
> @@ -96,8 +96,8 @@ int Request::setBuffers(const std::map<Stream *, Buffer *> &streamMap)
> */
> Buffer *Request::findBuffer(Stream *stream) const
> {
> - auto it = bufferMap_.find(stream);
> - if (it == bufferMap_.end())
> + auto it = buffers_.find(stream);
> + if (it == buffers_.end())
> return nullptr;
>
> return it->second;
> @@ -134,12 +134,12 @@ Buffer *Request::findBuffer(Stream *stream) const
> */
> int Request::prepare()
> {
> - if (bufferMap_.empty()) {
> + if (buffers_.empty()) {
> LOG(Request, Error) << "Invalid request due to missing buffers";
> return -EINVAL;
> }
>
> - for (auto const &pair : bufferMap_) {
> + for (auto const &pair : buffers_) {
> Buffer *buffer = pair.second;
> buffer->setRequest(this);
> pending_.insert(buffer);
> --
> 2.21.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list