summaryrefslogtreecommitdiff
path: root/include/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-01-13 18:00:41 +0300
committerSakari Ailus <sakari.ailus@linux.intel.com>2022-03-04 01:27:06 +0300
commitf17bc788f7b97c36b8f3fbef14555a2a16ee3f69 (patch)
tree0900729130e4d0100d67bcc9123b32b98b15dcb7 /include/media
parent472377febf848a08f67ed73bb0dc13a907575f82 (diff)
downloadlinux-f17bc788f7b97c36b8f3fbef14555a2a16ee3f69.tar.xz
media: media-entity: Add media_pad_is_streaming() helper function
Add a function to test if a pad is part of a pipeline currently streaming, and use it through drivers to replace direct access to the stream_count field. This will help reworking pipeline start/stop without disturbing drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/media-entity.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index fea489f03d57..8546f13c42a9 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -859,6 +859,18 @@ struct media_link *media_entity_find_link(struct media_pad *source,
struct media_pad *media_entity_remote_pad(const struct media_pad *pad);
/**
+ * media_entity_is_streaming - Test if an entity is part of a streaming pipeline
+ * @entity: The entity
+ *
+ * Return: True if the entity is part of a pipeline started with the
+ * media_pipeline_start() function, false otherwise.
+ */
+static inline bool media_entity_is_streaming(const struct media_entity *entity)
+{
+ return entity->stream_count > 0;
+}
+
+/**
* media_entity_get_fwnode_pad - Get pad number from fwnode
*
* @entity: The entity