aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-08-25 08:00:41 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 03:53:17 -0400
commite02188c90f6ef61f0844c42508fe603c5d4fa42b (patch)
tree7b0ff940b37ba6bf53c7cea7fadbb697ec2d156a /include
parent97548ed4c4661502cdfd1aabd5d3876fa4f5cc2e (diff)
[media] media: Pipelines and media streams
Drivers often need to associate pipeline objects to entities, and to take stream state into account when configuring entities and links. The pipeline API helps drivers manage that information. When starting streaming, drivers call media_entity_pipeline_start(). The function marks all entities connected to the given entity through enabled links, either directly or indirectly, as streaming. Similarly, when stopping the stream, drivers call media_entity_pipeline_stop(). The media_entity_pipeline_start() function takes a pointer to a media pipeline and stores it in every entity in the graph. Drivers should embed the media_pipeline structure in higher-level pipeline structures and can then access the pipeline through the media_entity structure. Link configuration will fail with -EBUSY by default if either end of the link is a streaming entity, unless the link is marked with the MEDIA_LNK_FL_DYNAMIC flag. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/media.h1
-rw-r--r--include/media/media-entity.h10
2 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/media.h b/include/linux/media.h
index 7c69913c0ad2..7ed23b43f43b 100644
--- a/include/linux/media.h
+++ b/include/linux/media.h
@@ -106,6 +106,7 @@ struct media_pad_desc {
106 106
107#define MEDIA_LNK_FL_ENABLED (1 << 0) 107#define MEDIA_LNK_FL_ENABLED (1 << 0)
108#define MEDIA_LNK_FL_IMMUTABLE (1 << 1) 108#define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
109#define MEDIA_LNK_FL_DYNAMIC (1 << 2)
109 110
110struct media_link_desc { 111struct media_link_desc {
111 struct media_pad_desc source; 112 struct media_pad_desc source;
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index d889dcc67d0d..cd8bca63a502 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -26,6 +26,9 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/media.h> 27#include <linux/media.h>
28 28
29struct media_pipeline {
30};
31
29struct media_link { 32struct media_link {
30 struct media_pad *source; /* Source pad */ 33 struct media_pad *source; /* Source pad */
31 struct media_pad *sink; /* Sink pad */ 34 struct media_pad *sink; /* Sink pad */
@@ -71,8 +74,11 @@ struct media_entity {
71 * purpose: a simple WARN_ON(<0) check can be used to detect reference 74 * purpose: a simple WARN_ON(<0) check can be used to detect reference
72 * count bugs that would make them negative. 75 * count bugs that would make them negative.
73 */ 76 */
77 int stream_count; /* Stream count for the entity. */
74 int use_count; /* Use count for the entity. */ 78 int use_count; /* Use count for the entity. */
75 79
80 struct media_pipeline *pipe; /* Pipeline this entity belongs to. */
81
76 union { 82 union {
77 /* Node specifications */ 83 /* Node specifications */
78 struct { 84 struct {
@@ -118,6 +124,7 @@ struct media_entity_graph {
118int media_entity_init(struct media_entity *entity, u16 num_pads, 124int media_entity_init(struct media_entity *entity, u16 num_pads,
119 struct media_pad *pads, u16 extra_links); 125 struct media_pad *pads, u16 extra_links);
120void media_entity_cleanup(struct media_entity *entity); 126void media_entity_cleanup(struct media_entity *entity);
127
121int media_entity_create_link(struct media_entity *source, u16 source_pad, 128int media_entity_create_link(struct media_entity *source, u16 source_pad,
122 struct media_entity *sink, u16 sink_pad, u32 flags); 129 struct media_entity *sink, u16 sink_pad, u32 flags);
123int __media_entity_setup_link(struct media_link *link, u32 flags); 130int __media_entity_setup_link(struct media_link *link, u32 flags);
@@ -133,6 +140,9 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph,
133 struct media_entity *entity); 140 struct media_entity *entity);
134struct media_entity * 141struct media_entity *
135media_entity_graph_walk_next(struct media_entity_graph *graph); 142media_entity_graph_walk_next(struct media_entity_graph *graph);
143void media_entity_pipeline_start(struct media_entity *entity,
144 struct media_pipeline *pipe);
145void media_entity_pipeline_stop(struct media_entity *entity);
136 146
137#define media_entity_call(entity, operation, args...) \ 147#define media_entity_call(entity, operation, args...) \
138 (((entity)->ops && (entity)->ops->operation) ? \ 148 (((entity)->ops && (entity)->ops->operation) ? \