mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-15 08:56:38 -05:00
Improve enum_param
Add an argument to pass the result param to the caller instead of having the caller have to pick it up from the builder. Improve docs for node, clock and monitor Pass spa_pod everywhere instead of spa_pod_object. Pass result argument to spa_pod_filter to make things a little nicer.
This commit is contained in:
parent
cd5e697e9f
commit
440f681f4b
70 changed files with 872 additions and 858 deletions
|
|
@ -375,7 +375,7 @@ print_format_value(uint32_t size, uint32_t type, void *body)
|
|||
}
|
||||
}
|
||||
|
||||
static int spa_debug_format(const struct spa_pod_object *format)
|
||||
static int spa_debug_format(const struct spa_pod *format)
|
||||
{
|
||||
int i;
|
||||
const char *media_type;
|
||||
|
|
@ -383,7 +383,7 @@ static int spa_debug_format(const struct spa_pod_object *format)
|
|||
struct spa_pod *pod;
|
||||
uint32_t mtype, mstype;
|
||||
|
||||
if (format == NULL)
|
||||
if (format == NULL || SPA_POD_TYPE(format) != SPA_POD_TYPE_OBJECT)
|
||||
return -EINVAL;
|
||||
|
||||
if (spa_pod_object_parse(format, "I", &mtype,
|
||||
|
|
@ -396,7 +396,7 @@ static int spa_debug_format(const struct spa_pod_object *format)
|
|||
fprintf(stderr, "%-6s %s/%s\n", "", rindex(media_type, ':') + 1,
|
||||
rindex(media_subtype, ':') + 1);
|
||||
|
||||
SPA_POD_OBJECT_FOREACH(format, pod) {
|
||||
SPA_POD_OBJECT_FOREACH((struct spa_pod_object*)format, pod) {
|
||||
struct spa_pod_prop *prop;
|
||||
const char *key;
|
||||
|
||||
|
|
@ -459,7 +459,7 @@ int spa_debug_pod(const struct spa_pod *pod, uint32_t flags)
|
|||
int res = 0;
|
||||
|
||||
if (flags & SPA_DEBUG_FLAG_FORMAT)
|
||||
res = spa_debug_format((struct spa_pod_object*)pod);
|
||||
res = spa_debug_format(pod);
|
||||
else
|
||||
print_pod_value(pod->size, pod->type, SPA_POD_BODY(pod), 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -330,9 +330,7 @@ int pod_filter(struct spa_pod_builder *b,
|
|||
break;
|
||||
case SPA_POD_TYPE_OBJECT:
|
||||
if (pf != NULL) {
|
||||
struct spa_pod_object *p1;
|
||||
|
||||
p1 = (struct spa_pod_object *) pp;
|
||||
struct spa_pod_object *p1 = (struct spa_pod_object *) pp;
|
||||
|
||||
if (SPA_POD_TYPE(pf) != SPA_POD_TYPE_OBJECT)
|
||||
return -EINVAL;
|
||||
|
|
@ -394,18 +392,28 @@ int pod_filter(struct spa_pod_builder *b,
|
|||
|
||||
int
|
||||
spa_pod_filter(struct spa_pod_builder *b,
|
||||
struct spa_pod **result,
|
||||
const struct spa_pod *pod,
|
||||
const struct spa_pod *filter)
|
||||
{
|
||||
int res;
|
||||
uint32_t offset;
|
||||
|
||||
spa_return_val_if_fail(pod != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(b != NULL, -EINVAL);
|
||||
|
||||
if (filter == NULL) {
|
||||
spa_pod_builder_raw_padded(b, pod, SPA_POD_SIZE(pod));
|
||||
*result = spa_pod_builder_deref(b,
|
||||
spa_pod_builder_raw_padded(b, pod, SPA_POD_SIZE(pod)));
|
||||
return 0;
|
||||
}
|
||||
return pod_filter(b, pod, SPA_POD_SIZE(pod), filter, SPA_POD_SIZE(filter));
|
||||
|
||||
offset = b->state.offset;
|
||||
|
||||
if ((res = pod_filter(b, pod, SPA_POD_SIZE(pod), filter, SPA_POD_SIZE(filter))) == 0)
|
||||
*result = spa_pod_builder_deref(b, offset);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int pod_compare(const struct spa_pod *pod1,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ extern "C" {
|
|||
#include <spa/pod/builder.h>
|
||||
|
||||
int spa_pod_filter(struct spa_pod_builder *b,
|
||||
struct spa_pod **result,
|
||||
const struct spa_pod *pod,
|
||||
const struct spa_pod *filter);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue