From f17bc788f7b97c36b8f3fbef14555a2a16ee3f69 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 13 Jan 2022 17:00:41 +0200 Subject: 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 Signed-off-by: Sakari Ailus --- include/media/media-entity.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/media/media-entity.h') 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 @@ -858,6 +858,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 * -- cgit v1.2.3