[libcamera-devel,RFC,1/3] libcamera: stream: Add setters for image sizes and format

Message ID 20190126151318.28087-2-jacopo@jmondi.org
State Superseded
Delegated to: Jacopo Mondi
Headers show
Series
  • v4l2-device: set and get format
Related show

Commit Message

Jacopo Mondi Jan. 26, 2019, 3:13 p.m. UTC
Add methods to set width, height and pixelformat of a
StreamConfiguration instance.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 include/libcamera/stream.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Niklas Söderlund Jan. 27, 2019, 12:28 a.m. UTC | #1
Hi Jacopo,

Thanks for your work.

On 2019-01-26 16:13:16 +0100, Jacopo Mondi wrote:
> Add methods to set width, height and pixelformat of a
> StreamConfiguration instance.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  include/libcamera/stream.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
> index 8750797..ef7b32a 100644
> --- a/include/libcamera/stream.h
> +++ b/include/libcamera/stream.h
> @@ -33,6 +33,10 @@ public:
>  	void setDimension(unsigned int width, unsigned int height);
>  	void setPixelFormat(unsigned int pixelformat);
>  
> +	void setWidth(unsigned int width) { width_ = width; }
> +	void setHeight(unsigned int height) { height_ = height; }
> +	void setPixelformat(unsigned int pix) { pixelformat_ = pix; }

This looks odd, there is already a setPixelFormat() defined just above.  
In any case when you rebase this RFC all parameters of 
StreamConfiguration are now public so no longer a need for setters and 
getters :-)

> +
>  private:
>  	unsigned int id_;
>  	unsigned int width_;
> -- 
> 2.20.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Jacopo Mondi Jan. 27, 2019, 10:22 a.m. UTC | #2
Hi Niklas,

On Sun, Jan 27, 2019 at 01:28:56AM +0100, Niklas Söderlund wrote:
> Hi Jacopo,
>
> Thanks for your work.
>
> On 2019-01-26 16:13:16 +0100, Jacopo Mondi wrote:
> > Add methods to set width, height and pixelformat of a
> > StreamConfiguration instance.
> >
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > ---
> >  include/libcamera/stream.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
> > index 8750797..ef7b32a 100644
> > --- a/include/libcamera/stream.h
> > +++ b/include/libcamera/stream.h
> > @@ -33,6 +33,10 @@ public:
> >  	void setDimension(unsigned int width, unsigned int height);
> >  	void setPixelFormat(unsigned int pixelformat);
> >
> > +	void setWidth(unsigned int width) { width_ = width; }
> > +	void setHeight(unsigned int height) { height_ = height; }
> > +	void setPixelformat(unsigned int pix) { pixelformat_ = pix; }
>
> This looks odd, there is already a setPixelFormat() defined just above.
> In any case when you rebase this RFC all parameters of
> StreamConfiguration are now public so no longer a need for setters and
> getters :-)
>

You are correct. Please ignore this patch.

Thanks
  j

> > +
> >  private:
> >  	unsigned int id_;
> >  	unsigned int width_;
> > --
> > 2.20.1
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
>
> --
> Regards,
> Niklas Söderlund

Patch

diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
index 8750797..ef7b32a 100644
--- a/include/libcamera/stream.h
+++ b/include/libcamera/stream.h
@@ -33,6 +33,10 @@  public:
 	void setDimension(unsigned int width, unsigned int height);
 	void setPixelFormat(unsigned int pixelformat);
 
+	void setWidth(unsigned int width) { width_ = width; }
+	void setHeight(unsigned int height) { height_ = height; }
+	void setPixelformat(unsigned int pix) { pixelformat_ = pix; }
+
 private:
 	unsigned int id_;
 	unsigned int width_;