libcamera: media_object: Expose entity type

Add a new field to the MediaEntity class to identify the type of
interface it exposes to userspace. The MediaEntity constructor is
changed to take a media_v2_interface pointer instead of just the device
node major and minor to have access to the interface type.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
This commit is contained in:
Laurent Pinchart
2021-07-03 21:37:44 +03:00
parent 2e4fc65f77
commit a376aa331a
3 changed files with 57 additions and 13 deletions

View File

@@ -652,14 +652,7 @@ bool MediaDevice::populateEntities(const struct media_v2_topology &topology)
*/
struct media_v2_interface *iface =
findInterface(topology, ent->id);
MediaEntity *entity;
if (iface)
entity = new MediaEntity(this, ent,
iface->devnode.major,
iface->devnode.minor);
else
entity = new MediaEntity(this, ent);
MediaEntity *entity = new MediaEntity(this, ent, iface);
if (!addObject(entity)) {
delete entity;