[PATCH RFC v2 02/16] media: Add a common embeed struct for all media graph objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to the MC API proposed changes, we'll need to:
	- have an unique object ID for all graph objects;
	- be able to dynamically create/remove objects;
	- be able to group objects;
	- keep the object in memory until we stop use it.

Due to that, create a struct media_graph_obj and put there the
common elements that all media objects will have in common.

Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx>

diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 0c003d817493..051aa3f8bbfe 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -28,10 +28,50 @@
 #include <linux/list.h>
 #include <linux/media.h>
 
+/* Enums used internally at the media controller to represent graphs */
+
+/**
+ * enum media_graph_type - type of a graph element
+ *
+ * @MEDIA_GRAPH_ENTITY:		Identify a media entity
+ * @MEDIA_GRAPH_PAD:		Identify a media PAD
+ * @MEDIA_GRAPH_LINK:		Identify a media link
+ */
+enum media_graph_type {
+	MEDIA_GRAPH_ENTITY,
+	MEDIA_GRAPH_PAD,
+	MEDIA_GRAPH_LINK,
+};
+
+
+/* Structs to represent the objects that belong to a media graph */
+
+/**
+ * struct media_graph_obj - Define a graph object.
+ *
+ * @list:		List of media graph objects
+ * @obj_id:		Non-zero object ID identifier. The ID should be unique
+ *			inside a media_device
+ * @type:		Type of the graph object
+ * @mdev:		Media device that contains the object
+ *			object before stopping using it
+ *
+ * All elements on the media graph should have this struct embedded
+ */
+struct media_graph_obj {
+	struct list_head	list;
+	struct list_head	group;
+	u32			obj_id;
+	enum media_graph_type	type;
+	struct media_device	*mdev;
+};
+
+
 struct media_pipeline {
 };
 
 struct media_link {
+	struct media_graph_obj			graph_obj;
 	struct media_pad *source;	/* Source pad */
 	struct media_pad *sink;		/* Sink pad  */
 	struct media_link *reverse;	/* Link in the reverse direction */
@@ -39,6 +79,7 @@ struct media_link {
 };
 
 struct media_pad {
+	struct media_graph_obj			graph_obj;
 	struct media_entity *entity;	/* Entity this pad belongs to */
 	u16 index;			/* Pad index in the entity pads array */
 	unsigned long flags;		/* Pad flags (MEDIA_PAD_FL_*) */
@@ -61,6 +102,7 @@ struct media_entity_operations {
 };
 
 struct media_entity {
+	struct media_graph_obj			graph_obj;
 	struct list_head list;
 	struct media_device *parent;	/* Media device this entity belongs to*/
 	u32 id;				/* Entity ID, unique in the parent media
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux