libcamera: libcamera::MediaEntity Class Reference

libcamera v0.7.1 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::MediaEntity Class Reference

The MediaEntity represents an entity in the media graph. More...

Inheritance diagram for libcamera::MediaEntity:
[legend]
Collaboration diagram for libcamera::MediaEntity:
[legend]

## Public Types
enum class | Type { Invalid , MediaEntity , V4L2Subdevice , V4L2VideoDevice }
| The type of the interface exposed by the entity to userspace. More...

## Public Member Functions
const std::string & | name () const
| Retrieve the entity name.
unsigned int | function () const
| Retrieve the entity's main function.
unsigned int | flags () const
| Retrieve the entity's flags.
Type | type () const
| Retrieve the entity's type.
const std::string & | deviceNode () const
| Retrieve the entity's device node path, if any.
unsigned int | deviceMajor () const
| Retrieve the major number of the interface associated with the entity.
unsigned int | deviceMinor () const
| Retrieve the minor number of the interface associated with the entity.
const std::vector< MediaPad * > & | pads () const
| Retrieve all pads of the entity.
const std::vector< MediaEntity * > & | ancillaryEntities () const
| Retrieve all ancillary entities of the entity.
const MediaPad * | getPadByIndex (unsigned int index) const
| Get a pad in this entity by its index.
const MediaPad * | getPadById (unsigned int id) const
| Get a pad in this entity by its object id.
int | setDeviceNode (const std::string &deviceNode)
| Set the path to the device node for the associated interface.
Public Member Functions inherited from libcamera::MediaObject
MediaDevice * | device ()
| Retrieve the media device the media object belongs to.
const MediaDevice * | device () const
| Retrieve the media device the media object belongs to.
unsigned int | id () const
| Retrieve the media object id.

## Friends
class | MediaDevice

## Additional Inherited Members
Protected Member Functions inherited from libcamera::MediaObject
| MediaObject (MediaDevice *dev, unsigned int id)
| Construct a MediaObject part of the MediaDevice dev, identified by the id unique within the device.
Protected Attributes inherited from libcamera::MediaObject
MediaDevice * | dev_
| The media device the media object belongs to.
unsigned int | id_
| The media object id.

## Detailed Description

The MediaEntity represents an entity in the media graph.

Entities are created from the information provided by the Media Controller API in the media_v2_entity structure. They reference the pads() they contain.

In addition to their graph id, media graph entities are identified by a name() unique in the media device context. They implement a function() and may expose a deviceNode().

## Member Enumeration Documentation

## ◆ Type

enum class libcamera::MediaEntity::Type
| strong

The type of the interface exposed by the entity to userspace.

Enumerator
Invalid | Invalid or unsupported entity type.
MediaEntity | Plain media entity with no userspace interface.
V4L2Subdevice | V4L2 subdevice with a V4L2 subdev device node.
V4L2VideoDevice | V4L2 video device with a V4L2 video device node.

## Member Function Documentation

## ◆ ancillaryEntities()

const std::vector< MediaEntity * > & libcamera::MediaEntity::ancillaryEntities | ( |  | ) | const
| inline

Retrieve all ancillary entities of the entity.

Returns
  The list of the entity's ancillary entities

## ◆ deviceMajor()

unsigned int libcamera::MediaEntity::deviceMajor | ( |  | ) | const
| inline

Retrieve the major number of the interface associated with the entity.

Returns
  The interface major number, or 0 if the entity isn't associated with an interface

## ◆ deviceMinor()

unsigned int libcamera::MediaEntity::deviceMinor | ( |  | ) | const
| inline

Retrieve the minor number of the interface associated with the entity.

Returns
  The interface minor number, or 0 if the entity isn't associated with an interface

## ◆ deviceNode()

const std::string & libcamera::MediaEntity::deviceNode | ( |  | ) | const
| inline

Retrieve the entity's device node path, if any.

Returns
  The entity's device node path, or an empty string if it is not set

See also
  int setDeviceNode()

## ◆ flags()

unsigned int libcamera::MediaEntity::flags | ( |  | ) | const
| inline

Retrieve the entity's flags.

Media entity flags are expressed using the MEDIA_ENT_FL_* macros defined by the Media Controller API.

Returns
  The entity's flags

## ◆ function()

unsigned int libcamera::MediaEntity::function | ( |  | ) | const
| inline

Retrieve the entity's main function.

Media entity functions are expressed using the MEDIA_ENT_F_* macros defined by the Media Controller API.

Returns
  The entity's function

## ◆ getPadById()

const MediaPad * libcamera::MediaEntity::getPadById | ( | unsigned int | id | ) | const

Get a pad in this entity by its object id.

Parameters

  [in] | id | The pad id

Returns
  The pad identified by id, or nullptr if no such pad exist

## ◆ getPadByIndex()

const MediaPad * libcamera::MediaEntity::getPadByIndex | ( | unsigned int | index | ) | const

Get a pad in this entity by its index.

Parameters

  [in] | index | The 0-based pad index

Returns
  The pad identified by index, or nullptr if no such pad exist

## ◆ name()

const std::string & libcamera::MediaEntity::name | ( |  | ) | const
| inline

Retrieve the entity name.

Returns
  The entity name

## ◆ pads()

const std::vector< MediaPad * > & libcamera::MediaEntity::pads | ( |  | ) | const
| inline

Retrieve all pads of the entity.

Returns
  The list of the entity's pads

## ◆ setDeviceNode()

int libcamera::MediaEntity::setDeviceNode | ( | const std::string & | deviceNode | ) |

Set the path to the device node for the associated interface.

Parameters

  [in] | deviceNode | The interface device node path associated with this entity

Returns
  0 on success or a negative error code otherwise

## ◆ type()

Type libcamera::MediaEntity::type | ( |  | ) | const
| inline

Retrieve the entity's type.

The entity type identifies the type of interface exposed to userspace.

Returns
  The entity's type

The documentation for this class was generated from the following files:

- include/libcamera/internal/media_object.h
- src/libcamera/media_object.cpp