gstreamer: Split value_set_rectangle() GValue helper

Split the value_set_rectangle() GValue helper into further
helpers pertaining to libcamera::Point and libcamera::Size.
This would help to cover additional cases where helpers
are needed for Point and Size individually (in subsequent commits).

The libcamera::Rectangle's GValue helper can be easily
constructed with the new Point and Size helpers. Hence,
this patch does not introduce any functional changes.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Umang Jain
2025-07-29 21:09:13 +05:30
committed by Kieran Bingham
parent 409d1b29da
commit f96c4df423

View File

@@ -17,21 +17,21 @@
using namespace libcamera;
static void value_set_rectangle(GValue *value, const Rectangle &rect)
static void value_set_point(GValue *value, const Point &point)
{
Point top_left = rect.topLeft();
Size size = rect.size();
GValue x = G_VALUE_INIT;
g_value_init(&x, G_TYPE_INT);
g_value_set_int(&x, top_left.x);
g_value_set_int(&x, point.x);
gst_value_array_append_and_take_value(value, &x);
GValue y = G_VALUE_INIT;
g_value_init(&y, G_TYPE_INT);
g_value_set_int(&y, top_left.y);
g_value_set_int(&y, point.y);
gst_value_array_append_and_take_value(value, &y);
}
static void value_set_size(GValue *value, const Size &size)
{
GValue width = G_VALUE_INIT;
g_value_init(&width, G_TYPE_INT);
g_value_set_int(&width, size.width);
@@ -43,6 +43,12 @@ static void value_set_rectangle(GValue *value, const Rectangle &rect)
gst_value_array_append_and_take_value(value, &height);
}
static void value_set_rectangle(GValue *value, const Rectangle &rect)
{
value_set_point(value, rect.topLeft());
value_set_size(value, rect.size());
}
static Rectangle value_get_rectangle(const GValue *value)
{
const GValue *r;