[libcamera-devel,v5,09/12] py: libcamera: Define and use Orientation
diff mbox series

Message ID 20230901150215.11585-10-jacopo.mondi@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Replace CameraConfiguration::transform
Related show

Commit Message

Jacopo Mondi Sept. 1, 2023, 3:02 p.m. UTC
Define an enumeration type for Orientation and expose the
CameraConfiguration::orientation property in place of
CameraConfiguration::transform.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/py/libcamera/py_enums.cpp | 10 ++++++++++
 src/py/libcamera/py_main.cpp  |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Tomi Valkeinen Sept. 4, 2023, 5:04 p.m. UTC | #1
On 01/09/2023 18:02, Jacopo Mondi via libcamera-devel wrote:
> Define an enumeration type for Orientation and expose the
> CameraConfiguration::orientation property in place of
> CameraConfiguration::transform.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
>   src/py/libcamera/py_enums.cpp | 10 ++++++++++
>   src/py/libcamera/py_main.cpp  |  2 +-
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp
> index 803c4e7ee362..3cf381e2eb84 100644
> --- a/src/py/libcamera/py_enums.cpp
> +++ b/src/py/libcamera/py_enums.cpp
> @@ -31,4 +31,14 @@ void init_py_enums(py::module &m)
>   		.value("String", ControlType::ControlTypeString)
>   		.value("Rectangle", ControlType::ControlTypeRectangle)
>   		.value("Size", ControlType::ControlTypeSize);
> +
> +	py::enum_<Orientation>(m, "Orientation")
> +		.value("Rotate0", Orientation::rotate0)
> +		.value("Rotate0Flip", Orientation::rotate0Flip)
> +		.value("Rotate180", Orientation::rotate180)
> +		.value("Rotate180Flip", Orientation::rotate180Flip)
> +		.value("Rotate90Flip", Orientation::rotate90Flip)
> +		.value("Rotate270", Orientation::rotate270)
> +		.value("Rotate270Flip", Orientation::rotate270Flip)
> +		.value("Rotate90", Orientation::rotate90);
>   }
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index 01fb15a9391c..63371dce38b3 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -293,7 +293,7 @@ PYBIND11_MODULE(_libcamera, m)
>   		     py::return_value_policy::reference_internal)
>   		.def_property_readonly("size", &CameraConfiguration::size)
>   		.def_property_readonly("empty", &CameraConfiguration::empty)
> -		.def_readwrite("transform", &CameraConfiguration::transform);
> +		.def_readwrite("orientation", &CameraConfiguration::orientation);
>   
>   	pyCameraConfigurationStatus
>   		.value("Valid", CameraConfiguration::Valid)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

  Tomi
Laurent Pinchart Oct. 18, 2023, 8:56 p.m. UTC | #2
Hi Jacopo,

Thank you for the patch.

On Fri, Sep 01, 2023 at 05:02:12PM +0200, Jacopo Mondi via libcamera-devel wrote:
> Define an enumeration type for Orientation and expose the
> CameraConfiguration::orientation property in place of
> CameraConfiguration::transform.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

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

> ---
>  src/py/libcamera/py_enums.cpp | 10 ++++++++++
>  src/py/libcamera/py_main.cpp  |  2 +-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp
> index 803c4e7ee362..3cf381e2eb84 100644
> --- a/src/py/libcamera/py_enums.cpp
> +++ b/src/py/libcamera/py_enums.cpp
> @@ -31,4 +31,14 @@ void init_py_enums(py::module &m)
>  		.value("String", ControlType::ControlTypeString)
>  		.value("Rectangle", ControlType::ControlTypeRectangle)
>  		.value("Size", ControlType::ControlTypeSize);
> +
> +	py::enum_<Orientation>(m, "Orientation")
> +		.value("Rotate0", Orientation::rotate0)
> +		.value("Rotate0Flip", Orientation::rotate0Flip)
> +		.value("Rotate180", Orientation::rotate180)
> +		.value("Rotate180Flip", Orientation::rotate180Flip)
> +		.value("Rotate90Flip", Orientation::rotate90Flip)
> +		.value("Rotate270", Orientation::rotate270)
> +		.value("Rotate270Flip", Orientation::rotate270Flip)
> +		.value("Rotate90", Orientation::rotate90);
>  }
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index 01fb15a9391c..63371dce38b3 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -293,7 +293,7 @@ PYBIND11_MODULE(_libcamera, m)
>  		     py::return_value_policy::reference_internal)
>  		.def_property_readonly("size", &CameraConfiguration::size)
>  		.def_property_readonly("empty", &CameraConfiguration::empty)
> -		.def_readwrite("transform", &CameraConfiguration::transform);
> +		.def_readwrite("orientation", &CameraConfiguration::orientation);
>  
>  	pyCameraConfigurationStatus
>  		.value("Valid", CameraConfiguration::Valid)

Patch
diff mbox series

diff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp
index 803c4e7ee362..3cf381e2eb84 100644
--- a/src/py/libcamera/py_enums.cpp
+++ b/src/py/libcamera/py_enums.cpp
@@ -31,4 +31,14 @@  void init_py_enums(py::module &m)
 		.value("String", ControlType::ControlTypeString)
 		.value("Rectangle", ControlType::ControlTypeRectangle)
 		.value("Size", ControlType::ControlTypeSize);
+
+	py::enum_<Orientation>(m, "Orientation")
+		.value("Rotate0", Orientation::rotate0)
+		.value("Rotate0Flip", Orientation::rotate0Flip)
+		.value("Rotate180", Orientation::rotate180)
+		.value("Rotate180Flip", Orientation::rotate180Flip)
+		.value("Rotate90Flip", Orientation::rotate90Flip)
+		.value("Rotate270", Orientation::rotate270)
+		.value("Rotate270Flip", Orientation::rotate270Flip)
+		.value("Rotate90", Orientation::rotate90);
 }
diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index 01fb15a9391c..63371dce38b3 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -293,7 +293,7 @@  PYBIND11_MODULE(_libcamera, m)
 		     py::return_value_policy::reference_internal)
 		.def_property_readonly("size", &CameraConfiguration::size)
 		.def_property_readonly("empty", &CameraConfiguration::empty)
-		.def_readwrite("transform", &CameraConfiguration::transform);
+		.def_readwrite("orientation", &CameraConfiguration::orientation);
 
 	pyCameraConfigurationStatus
 		.value("Valid", CameraConfiguration::Valid)