void (*debug_handler)(void *, ...);
void *debug_priv;
+
+ struct {
+ struct media_entity *v4l;
+ struct media_entity *fb;
+ struct media_entity *alsa;
+ struct media_entity *dvb;
+ } def;
};
#define media_dbg(media, ...) \
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;
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)
*/
struct media_entity *media_get_entity(struct media_device *media, unsigned int index);
+/**
+ * @brief Get the default entity for a given type
+ * @param media - media device.
+ * @param type - entity type.
+ *
+ * This function returns the default entity of the requested type. @a type must
+ * be one of
+ *
+ * MEDIA_ENT_T_DEVNODE_V4L
+ * MEDIA_ENT_T_DEVNODE_FB
+ * MEDIA_ENT_T_DEVNODE_ALSA
+ * MEDIA_ENT_T_DEVNODE_DVB
+ *
+ * @return A pointer to the default entity for the type if it exists, or NULL
+ * otherwise.
+ */
+struct media_entity *media_get_default_entity(struct media_device *media,
+ unsigned int type);
+
/**
* @brief Get the media device information
* @param media - media device.