74#define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter)                                                   \ 
   75        for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_array_body), void);    \ 
   76             (iter) < (__typeof__(iter))SPA_PTROFF((body), (_size), void);                              \ 
   77             (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void)) 
   79#define SPA_POD_ARRAY_FOREACH(obj, iter)                                                        \ 
   80        SPA_POD_ARRAY_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter) 
   82#define SPA_POD_CHOICE_BODY_FOREACH(body, _size, iter)                                                  \ 
   83        for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_choice_body), void);   \ 
   84             (iter) < (__typeof__(iter))SPA_PTROFF((body), (_size), void);                              \ 
   85             (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void)) 
   87#define SPA_POD_CHOICE_FOREACH(obj, iter)                                                       \ 
   88        SPA_POD_CHOICE_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter) 
   90#define SPA_POD_FOREACH(pod, size, iter)                                        \ 
   91        for ((iter) = (pod);                                                    \ 
   92             spa_pod_is_inside(pod, size, iter);                                \ 
   93             (iter) = (__typeof__(iter))spa_pod_next(iter)) 
   95#define SPA_POD_STRUCT_FOREACH(obj, iter)                                                       \ 
   96        SPA_POD_FOREACH(SPA_POD_BODY(obj), SPA_POD_BODY_SIZE(obj), iter) 
   98#define SPA_POD_OBJECT_BODY_FOREACH(body, size, iter)                                           \ 
   99        for ((iter) = spa_pod_prop_first(body);                         \ 
  100             spa_pod_prop_is_inside(body, size, iter);                  \ 
  101             (iter) = spa_pod_prop_next(iter)) 
  103#define SPA_POD_OBJECT_FOREACH(obj, iter)                                                       \ 
  104        SPA_POD_OBJECT_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter) 
  106#define SPA_POD_SEQUENCE_BODY_FOREACH(body, size, iter)                                         \ 
  107        for ((iter) = spa_pod_control_first(body);                                              \ 
  108             spa_pod_control_is_inside(body, size, iter);                                               \ 
  109             (iter) = spa_pod_control_next(iter)) 
  111#define SPA_POD_SEQUENCE_FOREACH(seq, iter)                                                     \ 
  112        SPA_POD_SEQUENCE_BODY_FOREACH(&(seq)->body, SPA_POD_BODY_SIZE(seq), iter) 
  118        if (size < 
sizeof(
struct spa_pod) || 
offset + size > maxsize)
 
  230        strncpy(dest, s, maxlen-1);
 
  231        dest[maxlen-1]= 
'\0';
 
  325                void *values, uint32_t max_values)
 
  331        n_values = 
SPA_MIN(n_values, max_values);
 
static int spa_pod_is_bitmap(const struct spa_pod *pod)
Definition: iter.h:310
 
static int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
Definition: iter.h:167
 
static int spa_pod_is_long(const struct spa_pod *pod)
Definition: iter.h:175
 
static int spa_pod_is_bytes(const struct spa_pod *pod)
Definition: iter.h:240
 
static int spa_pod_fixate(struct spa_pod *pod)
Definition: iter.h:427
 
static const struct spa_pod_prop * spa_pod_object_find_prop(const struct spa_pod_object *pod, const struct spa_pod_prop *start, uint32_t key)
Definition: iter.h:388
 
static int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
Definition: iter.h:260
 
static bool spa_pod_control_is_inside(const struct spa_pod_sequence_body *body, uint32_t size, const struct spa_pod_control *iter)
Definition: iter.h:67
 
#define SPA_POD_VALUE(type, pod)
Definition: pod/pod.h:49
 
static int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
Definition: iter.h:303
 
static const struct spa_pod_prop * spa_pod_find_prop(const struct spa_pod *pod, const struct spa_pod_prop *start, uint32_t key)
Definition: iter.h:408
 
static void * spa_pod_next(const void *iter)
Definition: iter.h:40
 
static int spa_pod_is_rectangle(const struct spa_pod *pod)
Definition: iter.h:283
 
static int spa_pod_is_fd(const struct spa_pod *pod)
Definition: iter.h:269
 
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition: iter.h:108
 
#define SPA_POD_BODY(pod)
Definition: pod/pod.h:39
 
static int spa_pod_is_pointer(const struct spa_pod *pod)
Definition: iter.h:254
 
#define SPA_POD_TYPE(pod)
Definition: pod/pod.h:28
 
static int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
Definition: iter.h:154
 
static bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
Definition: iter.h:377
 
#define SPA_POD_BODY_SIZE(pod)
Definition: pod/pod.h:26
 
static int spa_pod_get_float(const struct spa_pod *pod, float *value)
Definition: iter.h:193
 
static int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
Definition: iter.h:230
 
static uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type, void *values, uint32_t max_values)
Definition: iter.h:329
 
static struct spa_pod_control * spa_pod_control_next(const struct spa_pod_control *iter)
Definition: iter.h:74
 
#define SPA_POD_PROP_FLAG_DONT_FIXATE
choices need no fixation
Definition: pod/pod.h:224
 
static int spa_pod_object_fixate(struct spa_pod_object *pod)
Definition: iter.h:416
 
static bool spa_pod_is_inside(const void *pod, uint32_t size, const void *iter)
Definition: iter.h:34
 
static int spa_pod_is_object(const struct spa_pod *pod)
Definition: iter.h:366
 
static int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
Definition: iter.h:289
 
static int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
Definition: iter.h:275
 
static int spa_pod_is_struct(const struct spa_pod *pod)
Definition: iter.h:361
 
static int spa_pod_is_sequence(const struct spa_pod *pod)
Definition: iter.h:382
 
#define SPA_POD_ARRAY_VALUE_SIZE(arr)
Definition: pod/pod.h:115
 
#define SPA_POD_CONTROL_SIZE(ev)
Definition: pod/pod.h:231
 
static int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
Definition: iter.h:180
 
#define SPA_POD_CONTENTS(type, pod)
Definition: pod/pod.h:35
 
static void * spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
Definition: iter.h:120
 
static int spa_pod_is_string(const struct spa_pod *pod)
Definition: iter.h:214
 
static int spa_pod_is_fixated(const struct spa_pod *pod)
Definition: iter.h:445
 
static int spa_pod_is_choice(const struct spa_pod *pod)
Definition: iter.h:341
 
static void * spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
Definition: iter.h:322
 
static int spa_pod_get_string(const struct spa_pod *pod, const char **value)
Definition: iter.h:222
 
#define SPA_POD_PROP_SIZE(prop)
Definition: pod/pod.h:205
 
static struct spa_pod * spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
Definition: iter.h:347
 
static int spa_pod_get_double(const struct spa_pod *pod, double *value)
Definition: iter.h:206
 
static int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
Definition: iter.h:141
 
static struct spa_pod_prop * spa_pod_prop_next(const struct spa_pod_prop *iter)
Definition: iter.h:57
 
#define SPA_POD_OBJECT_TYPE(obj)
Definition: pod/pod.h:173
 
#define SPA_POD_OBJECT_ID(obj)
Definition: pod/pod.h:175
 
static bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
Definition: iter.h:372
 
#define SPA_POD_ARRAY_VALUE_TYPE(arr)
Definition: pod/pod.h:113
 
static int spa_pod_is_array(const struct spa_pod *pod)
Definition: iter.h:316
 
static int spa_pod_is_id(const struct spa_pod *pod)
Definition: iter.h:149
 
static int spa_pod_is_double(const struct spa_pod *pod)
Definition: iter.h:201
 
static struct spa_pod_control * spa_pod_control_first(const struct spa_pod_sequence_body *body)
Definition: iter.h:62
 
#define SPA_POD_CHOICE_N_VALUES(choice)
Definition: pod/pod.h:142
 
static struct spa_pod_prop * spa_pod_prop_first(const struct spa_pod_object_body *body)
Definition: iter.h:45
 
static int spa_pod_is_int(const struct spa_pod *pod)
Definition: iter.h:162
 
static int spa_pod_is_none(const struct spa_pod *pod)
Definition: iter.h:131
 
static int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
Definition: iter.h:434
 
static int spa_pod_is_fraction(const struct spa_pod *pod)
Definition: iter.h:297
 
#define SPA_POD_SIZE(pod)
Definition: pod/pod.h:30
 
static int spa_pod_is_float(const struct spa_pod *pod)
Definition: iter.h:188
 
#define SPA_POD_CHOICE_CHILD(choice)
Definition: pod/pod.h:132
 
#define SPA_POD_ARRAY_N_VALUES(arr)
Definition: pod/pod.h:117
 
#define SPA_POD_CHOICE_TYPE(choice)
Definition: pod/pod.h:134
 
static int spa_pod_get_bytes(const struct spa_pod *pod, const void **value, uint32_t *len)
Definition: iter.h:245
 
#define SPA_POD_ARRAY_VALUES(arr)
Definition: pod/pod.h:119
 
static int spa_pod_is_bool(const struct spa_pod *pod)
Definition: iter.h:136
 
static bool spa_pod_prop_is_inside(const struct spa_pod_object_body *body, uint32_t size, const struct spa_pod_prop *iter)
Definition: iter.h:50
 
@ SPA_CHOICE_None
no choice, first value is current
Definition: pod/pod.h:147
 
@ SPA_TYPE_Int
Definition: spa/include/spa/utils/type.h:34
 
@ SPA_TYPE_Rectangle
Definition: spa/include/spa/utils/type.h:40
 
@ SPA_TYPE_Long
Definition: spa/include/spa/utils/type.h:35
 
@ SPA_TYPE_Bool
Definition: spa/include/spa/utils/type.h:32
 
@ SPA_TYPE_Bytes
Definition: spa/include/spa/utils/type.h:39
 
@ SPA_TYPE_Bitmap
Definition: spa/include/spa/utils/type.h:42
 
@ SPA_TYPE_Object
Definition: spa/include/spa/utils/type.h:45
 
@ SPA_TYPE_Float
Definition: spa/include/spa/utils/type.h:36
 
@ SPA_TYPE_Fraction
Definition: spa/include/spa/utils/type.h:41
 
@ SPA_TYPE_None
Definition: spa/include/spa/utils/type.h:31
 
@ SPA_TYPE_Sequence
Definition: spa/include/spa/utils/type.h:46
 
@ SPA_TYPE_Double
Definition: spa/include/spa/utils/type.h:37
 
@ SPA_TYPE_Id
Definition: spa/include/spa/utils/type.h:33
 
@ SPA_TYPE_Choice
Definition: spa/include/spa/utils/type.h:49
 
@ SPA_TYPE_Pointer
Definition: spa/include/spa/utils/type.h:47
 
@ SPA_TYPE_Array
Definition: spa/include/spa/utils/type.h:43
 
@ SPA_TYPE_String
Definition: spa/include/spa/utils/type.h:38
 
@ SPA_TYPE_Fd
Definition: spa/include/spa/utils/type.h:48
 
@ SPA_TYPE_Struct
Definition: spa/include/spa/utils/type.h:44
 
#define SPA_MIN(a, b)
Definition: defs.h:151
 
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:320
 
#define spa_return_val_if_fail(expr, val)
Definition: defs.h:365
 
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:76
 
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:194
 
Definition: pod/pod.h:121
 
Definition: pod/pod.h:154
 
Definition: pod/pod.h:162
 
struct spa_pod pod
Definition: pod/pod.h:163
 
Definition: pod/pod.h:234
 
struct spa_pod value
control value, depends on type
Definition: pod/pod.h:237
 
uint32_t type
type of control, enum spa_control_type
Definition: pod/pod.h:236
 
uint32_t offset
media offset
Definition: pod/pod.h:235
 
Definition: pod/pod.h:199
 
Definition: pod/pod.h:100
 
struct spa_pod pod
Definition: iter.h:28
 
uint32_t offset
Definition: iter.h:30
 
struct spa_pod_frame * parent
Definition: iter.h:29
 
uint32_t flags
Definition: iter.h:31
 
Definition: pod/pod.h:177
 
Definition: pod/pod.h:183
 
struct spa_pod pod
Definition: pod/pod.h:184
 
struct spa_pod_object_body body
Definition: pod/pod.h:185
 
Definition: pod/pod.h:188
 
Definition: pod/pod.h:194
 
struct spa_pod pod
Definition: pod/pod.h:195
 
Definition: pod/pod.h:208
 
uint32_t key
key of property, list of valid keys depends on the object type
Definition: pod/pod.h:209
 
uint32_t flags
flags for property
Definition: pod/pod.h:225
 
struct spa_pod value
Definition: pod/pod.h:226
 
Definition: pod/pod.h:241
 
uint32_t type
Definition: pod/pod.h:45
 
uint32_t size
Definition: pod/pod.h:44