summaryrefslogtreecommitdiff
path: root/src/ipa/ipu3/meson.build
AgeCommit message (Expand)Author
2021-10-26ipa: ipu3: Isolate ipa_context documentationKieran Bingham
2021-08-20ipa: ipu3: Move IPU3 agc into algorithmsJean-Michel Hautbois
2021-08-20ipa: ipu3: Move IPU3 awb into algorithmsJean-Michel Hautbois
2021-08-20ipa: move libipa::Algorithm to ipa/ipu3/algorithmsJean-Michel Hautbois
2021-06-25libcamera/base: Validate internal headers as privateKieran Bingham
2021-04-22ipa: ipu3: Add support for IPU3 AEC/AGC algorithmJean-Michel Hautbois
2021-04-22ipa: ipu3: Add support for IPU3 AWB algorithmJean-Michel Hautbois
2021-02-16libcamera: IPAInterface: Replace C API with the new C++-only APIPaul Elder
2021-02-11meson: Fix coding style when declaring arraysLaurent Pinchart
2021-02-05libcamera: ipa: ipu3: Add an IPA skeleton for the IPU3 pipelineNiklas Söderlund
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2018, Google Inc.
 *
 * media_object.h - Media Device objects: entities, pads and links.
 */
#ifndef __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__
#define __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__

#include <string>
#include <vector>

#include <linux/media.h>

namespace libcamera {

class MediaDevice;
class MediaEntity;
class MediaPad;

class MediaObject
{
public:
	MediaDevice *device() { return dev_; }
	unsigned int id() const { return id_; }

protected:
	friend class MediaDevice;

	MediaObject(MediaDevice *dev, unsigned int id)
		: dev_(dev), id_(id)
	{
	}
	virtual ~MediaObject() {}

	MediaDevice *dev_;
	unsigned int id_;
};

class MediaLink : public MediaObject
{
public:
	MediaPad *source() const { return source_; }
	MediaPad *sink() const { return sink_; }
	unsigned int flags() const { return flags_; }
	int setEnabled(bool enable);

private:
	friend class MediaDevice;

	MediaLink(const struct media_v2_link *link,
		  MediaPad *source, MediaPad *sink);
	MediaLink(const MediaLink &) = delete;
	~MediaLink() {}

	MediaPad *source_;
	MediaPad *sink_;
	unsigned int flags_;
};

class MediaPad : public MediaObject
{
public:
	unsigned int index() const { return index_; }
	MediaEntity *entity() const { return entity_; }
	unsigned int flags() const { return flags_; }
	const std::vector<MediaLink *> &links() const { return links_; }

	void addLink(MediaLink *link);

private:
	friend class MediaDevice;

	MediaPad(const struct media_v2_pad *pad, MediaEntity *entity);
	MediaPad(const MediaPad &) = delete;
	~MediaPad();

	unsigned int index_;
	MediaEntity *entity_;
	unsigned int flags_;

	std::vector<MediaLink *> links_;
};

class MediaEntity : public MediaObject
{
public:
	const std::string &name() const { return name_; }
	unsigned int function() const { return function_; }
	unsigned int flags() const { return flags_; }
	const std::string &deviceNode() const { return deviceNode_; }
	unsigned int deviceMajor() const { return major_; }
	unsigned int deviceMinor() const { return minor_; }

	const std::vector<MediaPad *> &pads() const { return pads_; }

	const MediaPad *getPadByIndex(unsigned int index) const;
	const MediaPad *getPadById(unsigned int id) const;

	int setDeviceNode(const std::string &deviceNode);

private:
	friend class MediaDevice;

	MediaEntity(MediaDevice *dev, const struct media_v2_entity *entity,
		    unsigned int major = 0, unsigned int minor = 0);
	MediaEntity(const MediaEntity &) = delete;
	~MediaEntity();

	void addPad(MediaPad *pad);

	std::string name_;
	unsigned int function_;
	unsigned int flags_;
	std::string deviceNode_;
	unsigned int major_;
	unsigned int minor_;

	std::vector<MediaPad *> pads_;
};

} /* namespace libcamera */

#endif /* __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__ */