Skip to content

Commit

Permalink
uref_pic_flow: add helper to find format by name
Browse files Browse the repository at this point in the history
  • Loading branch information
nto authored and cmassiot committed Oct 11, 2024
1 parent 3f00cc6 commit e71e115
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/upipe/uref_pic_flow_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,21 @@ uref_pic_flow_get_format(struct uref *uref)
return NULL;
}

/** @This finds a picture format with the given name.
*
* @param name name of the picture format to lookup
* @return the corresponding picture format, or NULL if not found
*/
static inline const struct uref_pic_flow_format *
uref_pic_flow_get_format_by_name(const char *name)
{
for (unsigned i = 0; i < UBASE_ARRAY_SIZE(uref_pic_flow_formats); i++)
if (!strcmp(uref_pic_flow_formats[i]->name, name))
return uref_pic_flow_formats[i];

return NULL;
}

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit e71e115

Please sign in to comment.