Re: [media-ctl PATCH 1/1] libmediactl: Implement MEDIA_ENT_ID_FLAG_NEXT in media_get_entity_by_id()

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

 



Hi Laurent,

Laurent Pinchart wrote:
On Saturday 14 January 2012 20:33:36 Sakari Ailus wrote:
Signed-off-by: Sakari Ailus<sakari.ailus@xxxxxx>
---
  src/mediactl.c |    9 +++++++--
  src/mediactl.h |    4 +++-
  2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mediactl.c b/src/mediactl.c
index 5b8c587..f62fcdf 100644
--- a/src/mediactl.c
+++ b/src/mediactl.c
@@ -81,8 +81,13 @@ struct media_entity *media_get_entity_by_id(struct
media_device *media, for (i = 0; i<  media->entities_count; ++i) {
  		struct media_entity *entity =&media->entities[i];

-		if (entity->info.id == id)
-			return entity;
+		if (!(id&  MEDIA_ENT_ID_FLAG_NEXT)) {
+			if (entity->info.id == id)
+				return entity;
+		} else {
+			if (entity->info.id>= (id&  ~MEDIA_ENT_ID_FLAG_NEXT)
+				return entity;
+		}

Just one question that hasn't crossed my mind before, why do you need this ?
If you want to enumerate entities in an application you can just iterate over
media_device::entities.

We do have the MEDIA_ENT_ID_FLAG_NEXT flag which is intended to help in entity enumeration. Currently the range of entity ids is contiguous in all practical implementation but will that always be the case, also in the future? A few things might break in the kernel if the range is non-contiguous as well, but that's still internal to the kernel.

However, this is a user space library and if this interface change is not made, we essentially are making a promise that the entity ranges will always be contiguous.

I wouldn't as there's no need to do so.

I you think about programmable hardware, entities there are logical rather than physical and their existence may be dependent on multiple factors.

--
Sakari Ailus
sakari.ailus@xxxxxx
--
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