Skip to content

Commit e71e115

Browse files
ntocmassiot
authored andcommitted
uref_pic_flow: add helper to find format by name
1 parent 3f00cc6 commit e71e115

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

include/upipe/uref_pic_flow_formats.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,21 @@ uref_pic_flow_get_format(struct uref *uref)
569569
return NULL;
570570
}
571571

572+
/** @This finds a picture format with the given name.
573+
*
574+
* @param name name of the picture format to lookup
575+
* @return the corresponding picture format, or NULL if not found
576+
*/
577+
static inline const struct uref_pic_flow_format *
578+
uref_pic_flow_get_format_by_name(const char *name)
579+
{
580+
for (unsigned i = 0; i < UBASE_ARRAY_SIZE(uref_pic_flow_formats); i++)
581+
if (!strcmp(uref_pic_flow_formats[i]->name, name))
582+
return uref_pic_flow_formats[i];
583+
584+
return NULL;
585+
}
586+
572587
#ifdef __cplusplus
573588
}
574589
#endif

0 commit comments

Comments
 (0)