mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
iter: add helper to parse pod from memory region
This commit is contained in:
parent
322ccb452c
commit
d3c7acb137
1 changed files with 11 additions and 0 deletions
|
|
@ -126,6 +126,17 @@ static inline struct spa_pod_control *spa_pod_control_next(const struct spa_pod_
|
|||
SPA_POD_SEQUENCE_BODY_FOREACH(&(seq)->body, SPA_POD_BODY_SIZE(seq), iter)
|
||||
|
||||
|
||||
static inline void *spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
|
||||
{
|
||||
void *pod;
|
||||
if (offset + size > maxsize)
|
||||
return NULL;
|
||||
pod = SPA_MEMBER(data, offset, void);
|
||||
if (SPA_POD_SIZE(pod) > size)
|
||||
return NULL;
|
||||
return pod;
|
||||
}
|
||||
|
||||
static inline int spa_pod_is_none(const struct spa_pod *pod)
|
||||
{
|
||||
return (SPA_POD_TYPE(pod) == SPA_TYPE_None);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue