mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
improve props test
This commit is contained in:
parent
ded1ea69a1
commit
cf94117244
4 changed files with 92 additions and 75 deletions
|
|
@ -29,6 +29,12 @@ extern "C" {
|
|||
#include <spa/format.h>
|
||||
#include <spa/pod-builder.h>
|
||||
|
||||
#define SPA_FORMAT_INIT(size,type,media_type,media_subtype,...) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, \
|
||||
SPA_POD_ID_INIT(media_type), \
|
||||
SPA_POD_ID_INIT(media_subtype) } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_format(struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame,
|
||||
|
|
@ -36,10 +42,8 @@ spa_pod_builder_push_format(struct spa_pod_builder *builder,
|
|||
uint32_t media_type,
|
||||
uint32_t media_subtype)
|
||||
{
|
||||
const struct spa_format p = {
|
||||
{sizeof(struct spa_format_body), SPA_POD_TYPE_OBJECT}, {{0, format_type},
|
||||
{{sizeof(uint32_t), SPA_POD_TYPE_ID}, media_type},
|
||||
{{sizeof(uint32_t), SPA_POD_TYPE_ID}, media_subtype} } };
|
||||
const struct spa_format p = SPA_FORMAT_INIT(sizeof(struct spa_format_body),
|
||||
0, format_type, media_type, media_subtype);
|
||||
return spa_pod_builder_push(builder, frame, &p.pod,
|
||||
spa_pod_builder_raw(builder, &p, sizeof(p)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,12 +136,6 @@ spa_type_media_subtype_audio_map(struct spa_type_map *map,
|
|||
}
|
||||
}
|
||||
|
||||
#define SPA_FORMAT_INIT(size,type,media_type,media_subtype,...) \
|
||||
{ { size, SPA_POD_TYPE_OBJECT }, \
|
||||
{ { 0, type }, \
|
||||
SPA_POD_ID_INIT(media_type), \
|
||||
SPA_POD_ID_INIT(media_subtype) } }
|
||||
|
||||
#define SPA_FORMAT_BODY_FOREACH(body, size, iter) \
|
||||
for ((iter) = SPA_MEMBER((body), sizeof(struct spa_format_body), struct spa_pod_prop); \
|
||||
(iter) < SPA_MEMBER((body), (size), struct spa_pod_prop); \
|
||||
|
|
|
|||
|
|
@ -298,13 +298,15 @@ spa_pod_builder_push_object(struct spa_pod_builder *builder,
|
|||
spa_pod_builder_raw(builder, &p, sizeof(p)));
|
||||
}
|
||||
|
||||
#define SPA_POD_PROP_INIT(size,key,flags,val_size,val_type) \
|
||||
{ { size, SPA_POD_TYPE_PROP}, {key, flags, { val_size, val_type } } }
|
||||
|
||||
static inline uint32_t
|
||||
spa_pod_builder_push_prop(struct spa_pod_builder *builder,
|
||||
struct spa_pod_frame *frame, uint32_t key, uint32_t flags)
|
||||
{
|
||||
const struct spa_pod_prop p = { {sizeof(struct spa_pod_prop_body) -
|
||||
sizeof(struct spa_pod), SPA_POD_TYPE_PROP},
|
||||
{key, flags, {0, 0}} };
|
||||
const struct spa_pod_prop p = SPA_POD_PROP_INIT (sizeof(struct spa_pod_prop_body) -
|
||||
sizeof(struct spa_pod), key, flags, 0, 0);
|
||||
return spa_pod_builder_push(builder, frame, &p.pod,
|
||||
spa_pod_builder_raw(builder, &p,
|
||||
sizeof(p) - sizeof(struct spa_pod)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue