[libcamera-devel,v4,08/15] py: Drop get_ready_requests()
diff mbox series

Message ID 20230309142601.70556-9-tomi.valkeinen@ideasonboard.com
State Superseded
Headers show
Series
  • py: New python bindings event handling
Related show

Commit Message

Tomi Valkeinen March 9, 2023, 2:25 p.m. UTC
get_ready_requests() is deprecated, and the Python code in libcamera has
been converted to the new event system, so we can drop
get_ready_requests().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 src/py/libcamera/py_camera_manager.cpp | 24 ------------------------
 src/py/libcamera/py_camera_manager.h   |  1 -
 src/py/libcamera/py_main.cpp           |  3 ---
 3 files changed, 28 deletions(-)

Comments

Laurent Pinchart March 9, 2023, 4 p.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Thu, Mar 09, 2023 at 04:25:54PM +0200, Tomi Valkeinen via libcamera-devel wrote:
> get_ready_requests() is deprecated, and the Python code in libcamera has
> been converted to the new event system, so we can drop
> get_ready_requests().
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

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

> ---
>  src/py/libcamera/py_camera_manager.cpp | 24 ------------------------
>  src/py/libcamera/py_camera_manager.h   |  1 -
>  src/py/libcamera/py_main.cpp           |  3 ---
>  3 files changed, 28 deletions(-)
> 
> diff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp
> index 7d6dded4..c3b9646f 100644
> --- a/src/py/libcamera/py_camera_manager.cpp
> +++ b/src/py/libcamera/py_camera_manager.cpp
> @@ -103,30 +103,6 @@ PyCameraEvent PyCameraManager::convertEvent(const CameraEvent &event)
>  	return pyevent;
>  }
>  
> -/* DEPRECATED */
> -std::vector<py::object> PyCameraManager::getReadyRequests()
> -{
> -	int ret = readFd();
> -
> -	if (ret == -EAGAIN)
> -		return std::vector<py::object>();
> -
> -	if (ret != 0)
> -		throw std::system_error(-ret, std::generic_category());
> -
> -	std::vector<py::object> py_reqs;
> -
> -	for (const auto &ev : getEvents()) {
> -		if (ev.type_ != CameraEventType::RequestCompleted)
> -			continue;
> -
> -		PyCameraEvent pyev = convertEvent(ev);
> -		py_reqs.push_back(pyev.request_);
> -	}
> -
> -	return py_reqs;
> -}
> -
>  std::vector<PyCameraEvent> PyCameraManager::getPyEvents()
>  {
>  	int ret = readFd();
> diff --git a/src/py/libcamera/py_camera_manager.h b/src/py/libcamera/py_camera_manager.h
> index 757f6d8e..648d78af 100644
> --- a/src/py/libcamera/py_camera_manager.h
> +++ b/src/py/libcamera/py_camera_manager.h
> @@ -68,7 +68,6 @@ public:
>  
>  	int eventFd() const { return eventFd_.get(); }
>  
> -	std::vector<pybind11::object> getReadyRequests(); /* DEPRECATED */
>  	std::vector<PyCameraEvent> getPyEvents();
>  	std::vector<PyCameraEvent> getPyCameraEvents(std::shared_ptr<Camera> camera);
>  
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index 0fffc030..1069fd9c 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -126,9 +126,6 @@ PYBIND11_MODULE(_libcamera, m)
>  
>  		.def_property_readonly("event_fd", &PyCameraManager::eventFd)
>  
> -		/* DEPRECATED */
> -		.def("get_ready_requests", &PyCameraManager::getReadyRequests)
> -
>  		.def("get_events", &PyCameraManager::getPyEvents)
>  
>  		.def_readwrite("buffer_completed_active", &PyCameraManager::bufferCompletedEventActive_);

Patch
diff mbox series

diff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp
index 7d6dded4..c3b9646f 100644
--- a/src/py/libcamera/py_camera_manager.cpp
+++ b/src/py/libcamera/py_camera_manager.cpp
@@ -103,30 +103,6 @@  PyCameraEvent PyCameraManager::convertEvent(const CameraEvent &event)
 	return pyevent;
 }
 
-/* DEPRECATED */
-std::vector<py::object> PyCameraManager::getReadyRequests()
-{
-	int ret = readFd();
-
-	if (ret == -EAGAIN)
-		return std::vector<py::object>();
-
-	if (ret != 0)
-		throw std::system_error(-ret, std::generic_category());
-
-	std::vector<py::object> py_reqs;
-
-	for (const auto &ev : getEvents()) {
-		if (ev.type_ != CameraEventType::RequestCompleted)
-			continue;
-
-		PyCameraEvent pyev = convertEvent(ev);
-		py_reqs.push_back(pyev.request_);
-	}
-
-	return py_reqs;
-}
-
 std::vector<PyCameraEvent> PyCameraManager::getPyEvents()
 {
 	int ret = readFd();
diff --git a/src/py/libcamera/py_camera_manager.h b/src/py/libcamera/py_camera_manager.h
index 757f6d8e..648d78af 100644
--- a/src/py/libcamera/py_camera_manager.h
+++ b/src/py/libcamera/py_camera_manager.h
@@ -68,7 +68,6 @@  public:
 
 	int eventFd() const { return eventFd_.get(); }
 
-	std::vector<pybind11::object> getReadyRequests(); /* DEPRECATED */
 	std::vector<PyCameraEvent> getPyEvents();
 	std::vector<PyCameraEvent> getPyCameraEvents(std::shared_ptr<Camera> camera);
 
diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index 0fffc030..1069fd9c 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -126,9 +126,6 @@  PYBIND11_MODULE(_libcamera, m)
 
 		.def_property_readonly("event_fd", &PyCameraManager::eventFd)
 
-		/* DEPRECATED */
-		.def("get_ready_requests", &PyCameraManager::getReadyRequests)
-
 		.def("get_events", &PyCameraManager::getPyEvents)
 
 		.def_readwrite("buffer_completed_active", &PyCameraManager::bufferCompletedEventActive_);