summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcamera-controls.h
blob: 749220b539253500d85f2b218080e4fdd00089db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2023, Collabora Ltd.
 *     Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
 *
 * GStreamer Camera Controls
 */

#pragma once

#include <memory>

#include <libcamera/camera.h>
#include <libcamera/controls.h>
#include <libcamera/request.h>

#include "gstlibcamerasrc.h"

namespace libcamera {

class GstCameraControls
{
public:
	static void installProperties(GObjectClass *klass, int lastProp);

	bool getProperty(guint propId, GValue *value, GParamSpec *pspec);
	bool setProperty(guint propId, const GValue *value, GParamSpec *pspec);

	void setCamera(const std::shared_ptr<libcamera::Camera> &cam);

	void applyControls(std::unique_ptr<libcamera::Request> &request);
	void readMetadata(libcamera::Request *request);

private:
	/* Supported controls and limits of camera. */
	ControlInfoMap capabilities_;
	/* Set of user modified controls. */
	ControlList controls_;
	/* Accumulator of all controls ever set and metadata returned by camera */
	ControlList controls_acc_;
};

} /* namespace libcamera */