Hi Laurent,
I promised to look at the new type names, so here is my opinion:
On Monday, December 20, 2010 12:36:26 Laurent Pinchart wrote:
<snip>
+#define MEDIA_ENTITY_TYPE_SHIFT 16 +#define MEDIA_ENTITY_TYPE_MASK 0x00ff0000 +#define MEDIA_ENTITY_SUBTYPE_MASK 0x0000ffff
+#define MEDIA_ENTITY_TYPE_DEVNODE (1 << MEDIA_ENTITY_TYPE_SHIFT) +#define MEDIA_ENTITY_TYPE_DEVNODE_V4L (MEDIA_ENTITY_TYPE_DEVNODE + 1) +#define MEDIA_ENTITY_TYPE_DEVNODE_FB (MEDIA_ENTITY_TYPE_DEVNODE + 2) +#define MEDIA_ENTITY_TYPE_DEVNODE_ALSA (MEDIA_ENTITY_TYPE_DEVNODE + 3) +#define MEDIA_ENTITY_TYPE_DEVNODE_DVB (MEDIA_ENTITY_TYPE_DEVNODE + 4)
+#define MEDIA_ENTITY_TYPE_V4L2_SUBDEV (2 << MEDIA_ENTITY_TYPE_SHIFT) +#define MEDIA_ENTITY_TYPE_V4L2_SUBDEV_SENSOR (MEDIA_ENTITY_TYPE_V4L2_SUBDEV + 1) +#define MEDIA_ENTITY_TYPE_V4L2_SUBDEV_FLASH (MEDIA_ENTITY_TYPE_V4L2_SUBDEV + 2) +#define MEDIA_ENTITY_TYPE_V4L2_SUBDEV_LENS (MEDIA_ENTITY_TYPE_V4L2_SUBDEV + 3)
+#define MEDIA_ENTITY_FLAG_DEFAULT (1 << 0)
+#define MEDIA_LINK_FLAG_ENABLED (1 << 0) +#define MEDIA_LINK_FLAG_IMMUTABLE (1 << 1)
+#define MEDIA_PAD_FLAG_INPUT (1 << 0) +#define MEDIA_PAD_FLAG_OUTPUT (1 << 1)
Using V4L2_SUBDEV instead of just SUBDEV is definitely an improvement.
However, I think the defines are getting way too long and I would propose to use the ME_ prefix instead of MEDIA_ENTITY_. Also ML_ instead of MEDIA_LINK_ and MP_ instead of MEDIA_PAD_.
That way it is less of an alphabet soup when reading code.
Regards,
Hans