[libcamera-devel,05/10] cam: BufferWriter: Use the libcamera namespace

Message ID 20191028022224.795355-6-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: Fixes found while working on new buffer API
Related show

Commit Message

Niklas Söderlund Oct. 28, 2019, 2:22 a.m. UTC
Other parts of the cam utility uses the libcamera namespace, do the same
in the buffer writer.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/cam/buffer_writer.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart Nov. 18, 2019, 11:25 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Mon, Oct 28, 2019 at 03:22:19AM +0100, Niklas Söderlund wrote:
> Other parts of the cam utility uses the libcamera namespace, do the same
> in the buffer writer.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

I'm wondering if we shouldn't use the namespace explicitly everywhere
instead, but that would be a change on top of this, let's be consistent
first.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/cam/buffer_writer.cpp | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/cam/buffer_writer.cpp b/src/cam/buffer_writer.cpp
> index 1c044b0634672d87..c33e99c5f8173db8 100644
> --- a/src/cam/buffer_writer.cpp
> +++ b/src/cam/buffer_writer.cpp
> @@ -14,12 +14,14 @@
>  
>  #include "buffer_writer.h"
>  
> +using namespace libcamera;
> +
>  BufferWriter::BufferWriter(const std::string &pattern)
>  	: pattern_(pattern)
>  {
>  }
>  
> -int BufferWriter::write(libcamera::Buffer *buffer, const std::string &streamName)
> +int BufferWriter::write(Buffer *buffer, const std::string &streamName)
>  {
>  	std::string filename;
>  	size_t pos;
> @@ -40,8 +42,8 @@ int BufferWriter::write(libcamera::Buffer *buffer, const std::string &streamName
>  	if (fd == -1)
>  		return -errno;
>  
> -	libcamera::BufferMemory *mem = buffer->mem();
> -	for (libcamera::Plane &plane : mem->planes()) {
> +	BufferMemory *mem = buffer->mem();
> +	for (Plane &plane : mem->planes()) {
>  		void *data = plane.mem();
>  		unsigned int length = plane.length();
>

Patch

diff --git a/src/cam/buffer_writer.cpp b/src/cam/buffer_writer.cpp
index 1c044b0634672d87..c33e99c5f8173db8 100644
--- a/src/cam/buffer_writer.cpp
+++ b/src/cam/buffer_writer.cpp
@@ -14,12 +14,14 @@ 
 
 #include "buffer_writer.h"
 
+using namespace libcamera;
+
 BufferWriter::BufferWriter(const std::string &pattern)
 	: pattern_(pattern)
 {
 }
 
-int BufferWriter::write(libcamera::Buffer *buffer, const std::string &streamName)
+int BufferWriter::write(Buffer *buffer, const std::string &streamName)
 {
 	std::string filename;
 	size_t pos;
@@ -40,8 +42,8 @@  int BufferWriter::write(libcamera::Buffer *buffer, const std::string &streamName
 	if (fd == -1)
 		return -errno;
 
-	libcamera::BufferMemory *mem = buffer->mem();
-	for (libcamera::Plane &plane : mem->planes()) {
+	BufferMemory *mem = buffer->mem();
+	for (Plane &plane : mem->planes()) {
 		void *data = plane.mem();
 		unsigned int length = plane.length();