summaryrefslogtreecommitdiff
path: root/src/mediactl.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-07-31 15:31:55 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-03-10 19:54:00 +0100
commit5d751cc0b289282d354f7701a1ff896cc0778be8 (patch)
tree033304b850732d20b6b2a62ec01bdaa7ca17ce72 /src/mediactl.c
parent69ded6a53907c667b01a2b1dcafc24715c9b5bff (diff)
Expose default devices
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'src/mediactl.c')
-rw-r--r--src/mediactl.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mediactl.c b/src/mediactl.c
index dd5bd57..4da334a 100644
--- a/src/mediactl.c
+++ b/src/mediactl.c
@@ -145,6 +145,21 @@ const char *media_entity_get_devname(struct media_entity *entity)
return entity->devname[0] ? entity->devname : NULL;
}
+struct media_entity *media_get_default_entity(struct media_device *media,
+ unsigned int type)
+{
+ switch (type) {
+ case MEDIA_ENT_T_DEVNODE_V4L:
+ return media->def.v4l;
+ case MEDIA_ENT_T_DEVNODE_FB:
+ return media->def.fb;
+ case MEDIA_ENT_T_DEVNODE_ALSA:
+ return media->def.alsa;
+ case MEDIA_ENT_T_DEVNODE_DVB:
+ return media->def.dvb;
+ }
+}
+
const struct media_device_info *media_get_info(struct media_device *media)
{
return &media->info;
@@ -519,6 +534,23 @@ static int media_enum_entities(struct media_device *media)
media->entities_count++;
+ if (entity->info.flags & MEDIA_ENT_FL_DEFAULT) {
+ switch (entity->info.type) {
+ case MEDIA_ENT_T_DEVNODE_V4L:
+ media->def.v4l = entity;
+ break;
+ case MEDIA_ENT_T_DEVNODE_FB:
+ media->def.fb = entity;
+ break;
+ case MEDIA_ENT_T_DEVNODE_ALSA:
+ media->def.alsa = entity;
+ break;
+ case MEDIA_ENT_T_DEVNODE_DVB:
+ media->def.dvb = entity;
+ break;
+ }
+ }
+
/* Find the corresponding device name. */
if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE &&
media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV)