aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2010-03-07 14:14:14 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 03:53:11 -0400
commita5ccc48a7c48610e7f92fa599406738d69195d51 (patch)
tree8b82352250fa0cef0bcbb7b4db760d98844d746d /include/media
parent53e269c102fbaf77e7dc526b1606ad4a48e57200 (diff)
[media] media: Entity graph traversal
Add media entity graph traversal. The traversal follows enabled links by depth first. Traversing graph backwards is prevented by comparing the next possible entity in the graph with the previous one. Multiply connected graphs are thus not supported. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Vimarsh Zutshi <vimarsh.zutshi@gmail.com> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/media-entity.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index f6c856c9ac16..28f61f6ee549 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -113,10 +113,25 @@ static inline u32 media_entity_subtype(struct media_entity *entity)
113 return entity->type & MEDIA_ENT_SUBTYPE_MASK; 113 return entity->type & MEDIA_ENT_SUBTYPE_MASK;
114} 114}
115 115
116#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
117
118struct media_entity_graph {
119 struct {
120 struct media_entity *entity;
121 int link;
122 } stack[MEDIA_ENTITY_ENUM_MAX_DEPTH];
123 int top;
124};
125
116int media_entity_init(struct media_entity *entity, u16 num_pads, 126int media_entity_init(struct media_entity *entity, u16 num_pads,
117 struct media_pad *pads, u16 extra_links); 127 struct media_pad *pads, u16 extra_links);
118void media_entity_cleanup(struct media_entity *entity); 128void media_entity_cleanup(struct media_entity *entity);
119int media_entity_create_link(struct media_entity *source, u16 source_pad, 129int media_entity_create_link(struct media_entity *source, u16 source_pad,
120 struct media_entity *sink, u16 sink_pad, u32 flags); 130 struct media_entity *sink, u16 sink_pad, u32 flags);
121 131
132void media_entity_graph_walk_start(struct media_entity_graph *graph,
133 struct media_entity *entity);
134struct media_entity *
135media_entity_graph_walk_next(struct media_entity_graph *graph);
136
122#endif 137#endif