From 3b1c40f17f7d5afee4180cf2a91c3f3d09867922 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 13 Aug 2018 17:17:23 +0200 Subject: [PATCH] pod: move compare and filter functions out of the library --- spa/include/spa/pod/compare.h | 167 +++++++++ spa/include/spa/pod/filter.h | 342 +++++++++++++++++++ spa/include/spa/pod/iter.h | 15 +- spa/lib/debug.c | 2 - spa/lib/meson.build | 4 +- spa/plugins/alsa/alsa-monitor.c | 3 +- spa/plugins/alsa/alsa-sink.c | 3 +- spa/plugins/alsa/alsa-source.c | 3 +- spa/plugins/alsa/alsa-utils.c | 3 +- spa/plugins/audioconvert/audioconvert.c | 2 +- spa/plugins/audioconvert/channelmix.c | 3 +- spa/plugins/audioconvert/fmtconvert.c | 3 +- spa/plugins/audioconvert/merger.c | 2 +- spa/plugins/audioconvert/resample.c | 3 +- spa/plugins/audioconvert/splitter.c | 2 +- spa/plugins/audiomixer/audiomixer.c | 3 +- spa/plugins/audiotestsrc/audiotestsrc.c | 3 +- spa/plugins/bluez5/a2dp-sink.c | 2 +- spa/plugins/bluez5/bluez5-monitor.c | 3 +- spa/plugins/ffmpeg/ffmpeg-dec.c | 3 +- spa/plugins/ffmpeg/ffmpeg-enc.c | 2 +- spa/plugins/test/fakesink.c | 3 +- spa/plugins/test/fakesrc.c | 3 +- spa/plugins/v4l2/v4l2-monitor.c | 3 +- spa/plugins/v4l2/v4l2-source.c | 4 +- spa/plugins/videotestsrc/videotestsrc.c | 3 +- spa/plugins/volume/volume.c | 3 +- src/modules/module-audio-dsp.c | 5 + src/modules/module-client-node/client-node.c | 2 +- src/modules/module-media-session/floatmix.c | 3 +- src/pipewire/global.c | 2 - src/pipewire/link.c | 2 +- src/pipewire/node.c | 1 - src/pipewire/remote.c | 1 - src/pipewire/stream.c | 3 +- 35 files changed, 549 insertions(+), 62 deletions(-) create mode 100644 spa/include/spa/pod/compare.h create mode 100644 spa/include/spa/pod/filter.h diff --git a/spa/include/spa/pod/compare.h b/spa/include/spa/pod/compare.h new file mode 100644 index 000000000..23afe72cd --- /dev/null +++ b/spa/include/spa/pod/compare.h @@ -0,0 +1,167 @@ +/* Simple Plugin API + * Copyright (C) 2018 Wim Taymans + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +static inline int spa_pod_compare_value(enum spa_pod_type type, const void *r1, const void *r2) +{ + switch (type) { + case SPA_POD_TYPE_INVALID: + return 0; + case SPA_POD_TYPE_BOOL: + case SPA_POD_TYPE_ID: + return *(int32_t *) r1 == *(uint32_t *) r2 ? 0 : 1; + case SPA_POD_TYPE_INT: + return *(int32_t *) r1 - *(int32_t *) r2; + case SPA_POD_TYPE_LONG: + return *(int64_t *) r1 - *(int64_t *) r2; + case SPA_POD_TYPE_FLOAT: + return *(float *) r1 - *(float *) r2; + case SPA_POD_TYPE_DOUBLE: + return *(double *) r1 - *(double *) r2; + case SPA_POD_TYPE_STRING: + return strcmp(r1, r2); + case SPA_POD_TYPE_RECTANGLE: + { + const struct spa_rectangle *rec1 = (struct spa_rectangle *) r1, + *rec2 = (struct spa_rectangle *) r2; + if (rec1->width == rec2->width && rec1->height == rec2->height) + return 0; + else if (rec1->width < rec2->width || rec1->height < rec2->height) + return -1; + else + return 1; + } + case SPA_POD_TYPE_FRACTION: + { + const struct spa_fraction *f1 = (struct spa_fraction *) r1, + *f2 = (struct spa_fraction *) r2; + int64_t n1, n2; + n1 = ((int64_t) f1->num) * f2->denom; + n2 = ((int64_t) f2->num) * f1->denom; + if (n1 < n2) + return -1; + else if (n1 > n2) + return 1; + else + return 0; + } + default: + break; + } + return 0; +} + +static inline int spa_pod_compare_part(const struct spa_pod *pod1, uint32_t pod1_size, + const struct spa_pod *pod2, uint32_t pod2_size) +{ + const struct spa_pod *p1, *p2; + int res; + + p2 = pod2; + + SPA_POD_FOREACH(pod1, pod1_size, p1) { + bool do_advance = true; + uint32_t recurse_offset = 0; + + if (p2 == NULL) + return -EINVAL; + + switch (SPA_POD_TYPE(p1)) { + case SPA_POD_TYPE_STRUCT: + case SPA_POD_TYPE_OBJECT: + if (SPA_POD_TYPE(p2) != SPA_POD_TYPE(p1)) + return -EINVAL; + + if (SPA_POD_TYPE(p1) == SPA_POD_TYPE_STRUCT) + recurse_offset = sizeof(struct spa_pod_struct); + else + recurse_offset = sizeof(struct spa_pod_object); + + do_advance = true; + break; + case SPA_POD_TYPE_PROP: + { + struct spa_pod_prop *pr1, *pr2; + void *a1, *a2; + + pr1 = (struct spa_pod_prop *) p1; + pr2 = spa_pod_contents_find_prop(pod2, pod2_size, pr1->body.key); + + if (pr2 == NULL) + return -EINVAL; + + /* incompatible property types */ + if (pr1->body.value.type != pr2->body.value.type) + return -EINVAL; + + if (pr1->body.flags & SPA_POD_PROP_FLAG_UNSET || + pr2->body.flags & SPA_POD_PROP_FLAG_UNSET) + return -EINVAL; + + a1 = SPA_MEMBER(pr1, sizeof(struct spa_pod_prop), void); + a2 = SPA_MEMBER(pr2, sizeof(struct spa_pod_prop), void); + + res = spa_pod_compare_value(pr1->body.value.type, a1, a2); + break; + } + default: + if (SPA_POD_TYPE(p1) != SPA_POD_TYPE(p2)) + return -EINVAL; + + res = spa_pod_compare_value(SPA_POD_TYPE(p1), SPA_POD_BODY(p1), SPA_POD_BODY(p2)); + do_advance = true; + break; + } + if (recurse_offset) { + res = spa_pod_compare_part(SPA_MEMBER(p1,recurse_offset,void), + SPA_POD_SIZE(p1) - recurse_offset, + SPA_MEMBER(p2,recurse_offset,void), + SPA_POD_SIZE(p2) - recurse_offset); + } + if (do_advance) { + p2 = spa_pod_next(p2); + if (!spa_pod_is_inside(pod2, pod2_size, p2)) + p2 = NULL; + } + if (res != 0) + return res; + } + if (p2 != NULL) + return -EINVAL; + + return 0; +} + +static inline int spa_pod_compare(const struct spa_pod *pod1, + const struct spa_pod *pod2) +{ + spa_return_val_if_fail(pod1 != NULL, -EINVAL); + spa_return_val_if_fail(pod2 != NULL, -EINVAL); + + return spa_pod_compare_part(pod1, SPA_POD_SIZE(pod1), pod2, SPA_POD_SIZE(pod2)); +} diff --git a/spa/include/spa/pod/filter.h b/spa/include/spa/pod/filter.h new file mode 100644 index 000000000..3aeb264ab --- /dev/null +++ b/spa/include/spa/pod/filter.h @@ -0,0 +1,342 @@ +/* Simple Plugin API + * Copyright (C) 2018 Wim Taymans + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +static inline void spa_pod_prop_fix_default(struct spa_pod_prop *prop) +{ + void *val = SPA_MEMBER(prop, sizeof(struct spa_pod_prop), void), + *alt = SPA_MEMBER(val, prop->body.value.size, void); + int i, nalt = SPA_POD_PROP_N_VALUES(prop) - 1; + + switch (prop->body.flags & SPA_POD_PROP_RANGE_MASK) { + case SPA_POD_PROP_RANGE_NONE: + break; + case SPA_POD_PROP_RANGE_MIN_MAX: + case SPA_POD_PROP_RANGE_STEP: + if (spa_pod_compare_value(prop->body.value.type, val, alt) < 0) + memcpy(val, alt, prop->body.value.size); + alt = SPA_MEMBER(alt, prop->body.value.size, void); + if (spa_pod_compare_value(prop->body.value.type, val, alt) > 0) + memcpy(val, alt, prop->body.value.size); + break; + case SPA_POD_PROP_RANGE_ENUM: + { + void *best = NULL; + + for (i = 0; i < nalt; i++) { + if (spa_pod_compare_value(prop->body.value.type, val, alt) == 0) { + best = alt; + break; + } + if (best == NULL) + best = alt; + alt = SPA_MEMBER(alt, prop->body.value.size, void); + } + if (best) + memcpy(val, best, prop->body.value.size); + + if (nalt <= 1) { + prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET; + prop->body.flags &= ~SPA_POD_PROP_RANGE_MASK; + prop->body.flags |= SPA_POD_PROP_RANGE_NONE; + } + break; + } + case SPA_POD_PROP_RANGE_FLAGS: + break; + } +} + +static inline int +spa_pod_filter_prop(struct spa_pod_builder *b, + const struct spa_pod_prop *p1, + const struct spa_pod_prop *p2) +{ + struct spa_pod_prop *np; + int nalt1, nalt2; + void *alt1, *alt2, *a1, *a2; + uint32_t rt1, rt2; + int j, k; + + /* incompatible property types */ + if (p1->body.value.type != p2->body.value.type) + return -EINVAL; + + rt1 = p1->body.flags & SPA_POD_PROP_RANGE_MASK; + rt2 = p2->body.flags & SPA_POD_PROP_RANGE_MASK; + + alt1 = SPA_MEMBER(p1, sizeof(struct spa_pod_prop), void); + nalt1 = SPA_POD_PROP_N_VALUES(p1); + alt2 = SPA_MEMBER(p2, sizeof(struct spa_pod_prop), void); + nalt2 = SPA_POD_PROP_N_VALUES(p2); + + if (p1->body.flags & SPA_POD_PROP_FLAG_UNSET) { + alt1 = SPA_MEMBER(alt1, p1->body.value.size, void); + nalt1--; + } else { + nalt1 = 1; + rt1 = SPA_POD_PROP_RANGE_NONE; + } + + if (p2->body.flags & SPA_POD_PROP_FLAG_UNSET) { + alt2 = SPA_MEMBER(alt2, p2->body.value.size, void); + nalt2--; + } else { + nalt2 = 1; + rt2 = SPA_POD_PROP_RANGE_NONE; + } + + /* start with copying the property */ + np = spa_pod_builder_deref(b, spa_pod_builder_push_prop(b, p1->body.key, 0)); + + /* default value */ + spa_pod_builder_raw(b, &p1->body.value, sizeof(p1->body.value) + p1->body.value.size); + + if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_NONE) || + (rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_ENUM) || + (rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_NONE) || + (rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_ENUM)) { + int n_copied = 0; + /* copy all equal values but don't copy the default value again */ + for (j = 0, a1 = alt1; j < nalt1; j++, a1 += p1->body.value.size) { + for (k = 0, a2 = alt2; k < nalt2; k++, a2 += p2->body.value.size) { + if (spa_pod_compare_value(p1->body.value.type, a1, a2) == 0) { + if (rt1 == SPA_POD_PROP_RANGE_ENUM || j > 0) + spa_pod_builder_raw(b, a1, p1->body.value.size); + n_copied++; + } + } + } + if (n_copied == 0) + return -EINVAL; + np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET; + } + + if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) || + (rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_MIN_MAX)) { + int n_copied = 0; + /* copy all values inside the range */ + for (j = 0, a1 = alt1, a2 = alt2; j < nalt1; j++, a1 += p1->body.value.size) { + if (spa_pod_compare_value(p1->body.value.type, a1, a2) < 0) + continue; + if (spa_pod_compare_value(p1->body.value.type, a1, a2 + p2->body.value.size) > 0) + continue; + spa_pod_builder_raw(b, a1, p1->body.value.size); + n_copied++; + } + if (n_copied == 0) + return -EINVAL; + np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET; + } + + if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_STEP) || + (rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_STEP)) { + return -ENOTSUP; + } + + if ((rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_NONE) || + (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_ENUM)) { + int n_copied = 0; + /* copy all values inside the range */ + for (k = 0, a1 = alt1, a2 = alt2; k < nalt2; k++, a2 += p2->body.value.size) { + if (spa_pod_compare_value(p1->body.value.type, a2, a1) < 0) + continue; + if (spa_pod_compare_value(p1->body.value.type, a2, a1 + p1->body.value.size) > 0) + continue; + spa_pod_builder_raw(b, a2, p2->body.value.size); + n_copied++; + } + if (n_copied == 0) + return -EINVAL; + np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET; + } + + if (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) { + if (spa_pod_compare_value(p1->body.value.type, alt1, alt2) < 0) + spa_pod_builder_raw(b, alt2, p2->body.value.size); + else + spa_pod_builder_raw(b, alt1, p1->body.value.size); + + alt1 += p1->body.value.size; + alt2 += p2->body.value.size; + + if (spa_pod_compare_value(p1->body.value.type, alt1, alt2) < 0) + spa_pod_builder_raw(b, alt1, p1->body.value.size); + else + spa_pod_builder_raw(b, alt2, p2->body.value.size); + + np->body.flags |= SPA_POD_PROP_RANGE_MIN_MAX | SPA_POD_PROP_FLAG_UNSET; + } + + if (rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_FLAGS) + return -ENOTSUP; + + if (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_STEP) + return -ENOTSUP; + + if (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_FLAGS) + return -ENOTSUP; + + if (rt1 == SPA_POD_PROP_RANGE_ENUM && rt2 == SPA_POD_PROP_RANGE_FLAGS) + return -ENOTSUP; + + if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_NONE) + return -ENOTSUP; + if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) + return -ENOTSUP; + + if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_STEP) + return -ENOTSUP; + if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_ENUM) + return -ENOTSUP; + if (rt1 == SPA_POD_PROP_RANGE_STEP && rt2 == SPA_POD_PROP_RANGE_FLAGS) + return -ENOTSUP; + + if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_NONE) + return -ENOTSUP; + if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) + return -ENOTSUP; + if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_STEP) + return -ENOTSUP; + if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_ENUM) + return -ENOTSUP; + if (rt1 == SPA_POD_PROP_RANGE_FLAGS && rt2 == SPA_POD_PROP_RANGE_FLAGS) + return -ENOTSUP; + + spa_pod_builder_pop(b); + spa_pod_prop_fix_default(np); + + return 0; +} + +static inline int spa_pod_filter_part(struct spa_pod_builder *b, + const struct spa_pod *pod, uint32_t pod_size, + const struct spa_pod *filter, uint32_t filter_size) +{ + const struct spa_pod *pp, *pf; + int res = 0; + + pf = filter; + + SPA_POD_FOREACH(pod, pod_size, pp) { + bool do_copy = false, do_advance = false; + uint32_t filter_offset = 0; + + switch (SPA_POD_TYPE(pp)) { + case SPA_POD_TYPE_STRUCT: + case SPA_POD_TYPE_OBJECT: + if (pf != NULL) { + if (SPA_POD_TYPE(pf) != SPA_POD_TYPE(pp)) + return -EINVAL; + + if (SPA_POD_TYPE(pp) == SPA_POD_TYPE_STRUCT) { + filter_offset = sizeof(struct spa_pod_struct); + spa_pod_builder_push_struct(b); + } else { + struct spa_pod_object *p1 = (struct spa_pod_object *) pp; + filter_offset = sizeof(struct spa_pod_object); + spa_pod_builder_push_object(b, p1->body.id, p1->body.type); + } + do_advance = true; + } + else + do_copy = true; + break; + + case SPA_POD_TYPE_PROP: + { + struct spa_pod_prop *p1, *p2; + + p1 = (struct spa_pod_prop *) pp; + p2 = spa_pod_contents_find_prop(filter, filter_size, p1->body.key); + + if (p2 != NULL) + res = spa_pod_filter_prop(b, p1, p2); + else + do_copy = true; + break; + } + default: + if (pf != NULL) { + if (SPA_POD_SIZE(pp) != SPA_POD_SIZE(pf)) + return -EINVAL; + if (memcmp(pp, pf, SPA_POD_SIZE(pp)) != 0) + return -EINVAL; + do_advance = true; + } + do_copy = true; + break; + } + if (do_copy) + spa_pod_builder_raw_padded(b, pp, SPA_POD_SIZE(pp)); + else if (filter_offset) { + res = spa_pod_filter_part(b, + SPA_MEMBER(pp,filter_offset,void), + SPA_POD_SIZE(pp) - filter_offset, + SPA_MEMBER(pf,filter_offset,void), + SPA_POD_SIZE(pf) - filter_offset); + spa_pod_builder_pop(b); + } + if (do_advance) { + pf = spa_pod_next(pf); + if (!spa_pod_is_inside(filter, filter_size, pf)) + pf = NULL; + } + if (res < 0) + break; + } + return res; +} + +static inline 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; + struct spa_pod_builder_state state; + + spa_return_val_if_fail(pod != NULL, -EINVAL); + spa_return_val_if_fail(b != NULL, -EINVAL); + + if (filter == NULL) { + *result = spa_pod_builder_deref(b, + spa_pod_builder_raw_padded(b, pod, SPA_POD_SIZE(pod))); + return 0; + } + + spa_pod_builder_get_state(b, &state); + if ((res = spa_pod_filter_part(b, pod, SPA_POD_SIZE(pod), filter, SPA_POD_SIZE(filter))) < 0) + spa_pod_builder_reset(b, &state); + else + *result = spa_pod_builder_deref(b, state.offset); + + return res; +} diff --git a/spa/include/spa/pod/iter.h b/spa/include/spa/pod/iter.h index 908835498..c391ca504 100644 --- a/spa/include/spa/pod/iter.h +++ b/spa/include/spa/pod/iter.h @@ -74,9 +74,9 @@ static inline struct spa_pod *spa_pod_next(const struct spa_pod *iter) (iter) < SPA_MEMBER((body), (_size), __typeof__(*(iter))); \ (iter) = SPA_MEMBER((iter), (body)->child.size, __typeof__(*(iter)))) -#define SPA_POD_FOREACH(pod, size, iter) \ - for ((iter) = (pod); \ - spa_pod_is_inside(pod, size, iter); \ +#define SPA_POD_FOREACH(pod, size, iter) \ + for ((iter) = (pod); \ + spa_pod_is_inside(pod, size, iter); \ (iter) = spa_pod_next(iter)) #define SPA_POD_CONTENTS_FOREACH(pod, offset, iter) \ @@ -97,10 +97,10 @@ static inline struct spa_pod *spa_pod_next(const struct spa_pod *iter) (iter) = SPA_MEMBER((iter), (body)->value.size, __typeof__(*iter))) static inline struct spa_pod_prop *spa_pod_contents_find_prop(const struct spa_pod *pod, - uint32_t offset, uint32_t key) + uint32_t size, uint32_t key) { - struct spa_pod *res; - SPA_POD_CONTENTS_FOREACH(pod, offset, res) { + const struct spa_pod *res; + SPA_POD_FOREACH(pod, size, res) { if (res->type == SPA_POD_TYPE_PROP && ((struct spa_pod_prop *) res)->body.key == key) return (struct spa_pod_prop *) res; @@ -119,7 +119,8 @@ static inline struct spa_pod_prop *spa_pod_find_prop(const struct spa_pod *pod, else return NULL; - return spa_pod_contents_find_prop(pod, offset, key); + return spa_pod_contents_find_prop(SPA_MEMBER(pod, offset, const struct spa_pod), + SPA_POD_SIZE(pod) - offset, key); } static inline int spa_pod_fixate(struct spa_pod *pod) diff --git a/spa/lib/debug.c b/spa/lib/debug.c index c20f77f31..3e93f8f77 100644 --- a/spa/lib/debug.c +++ b/spa/lib/debug.c @@ -25,8 +25,6 @@ #include #include -#include - #include "debug.h" static const struct spa_type_map *map; diff --git a/spa/lib/meson.build b/spa/lib/meson.build index 7914759f8..81eb2dcce 100644 --- a/spa/lib/meson.build +++ b/spa/lib/meson.build @@ -1,12 +1,10 @@ spalib_headers = [ 'debug.h', - 'pod.h', ] install_headers(spalib_headers, subdir : 'spa/lib') -spalib_sources = ['debug.c', - 'pod.c' ] +spalib_sources = ['debug.c' ] spalib = shared_library('spa-lib-@0@'.format(spaversion), spalib_sources, diff --git a/spa/plugins/alsa/alsa-monitor.c b/spa/plugins/alsa/alsa-monitor.c index d4b58d188..6c1a6574d 100644 --- a/spa/plugins/alsa/alsa-monitor.c +++ b/spa/plugins/alsa/alsa-monitor.c @@ -30,10 +30,9 @@ #include #include #include +#include #include -#include - #define NAME "alsa-monitor" #define MAX_CARDS 32 diff --git a/spa/plugins/alsa/alsa-sink.c b/spa/plugins/alsa/alsa-sink.c index 78602a457..98eca7382 100644 --- a/spa/plugins/alsa/alsa-sink.c +++ b/spa/plugins/alsa/alsa-sink.c @@ -23,8 +23,7 @@ #include #include - -#include +#include #define NAME "alsa-sink" diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c index 9dd922000..4ca8ab68c 100644 --- a/spa/plugins/alsa/alsa-source.c +++ b/spa/plugins/alsa/alsa-source.c @@ -24,8 +24,7 @@ #include #include #include - -#include +#include #define NAME "alsa-source" diff --git a/spa/plugins/alsa/alsa-utils.c b/spa/plugins/alsa/alsa-utils.c index a83ecc416..356a81b7d 100644 --- a/spa/plugins/alsa/alsa-utils.c +++ b/spa/plugins/alsa/alsa-utils.c @@ -9,8 +9,7 @@ #include #include -#include -#include +#include #include "alsa-utils.h" diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index f078f1986..d9888cfff 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -31,8 +31,8 @@ #include #include #include +#include -#include #include #define NAME "audioconvert" diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index 42a564cbd..2682e5ef3 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -30,8 +30,7 @@ #include #include #include - -#include +#include #define NAME "channelmix" diff --git a/spa/plugins/audioconvert/fmtconvert.c b/spa/plugins/audioconvert/fmtconvert.c index 4670fa2ec..7fb6d58d3 100644 --- a/spa/plugins/audioconvert/fmtconvert.c +++ b/spa/plugins/audioconvert/fmtconvert.c @@ -30,8 +30,7 @@ #include #include #include - -#include +#include #define NAME "fmtconvert" diff --git a/spa/plugins/audioconvert/merger.c b/spa/plugins/audioconvert/merger.c index 6dc63229c..19c5c518d 100644 --- a/spa/plugins/audioconvert/merger.c +++ b/spa/plugins/audioconvert/merger.c @@ -31,8 +31,8 @@ #include #include #include +#include -#include #include #define NAME "merger" diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c index 824e35e2f..1e5bd8b3f 100644 --- a/spa/plugins/audioconvert/resample.c +++ b/spa/plugins/audioconvert/resample.c @@ -32,8 +32,7 @@ #include #include #include - -#include +#include #define NAME "resample" diff --git a/spa/plugins/audioconvert/splitter.c b/spa/plugins/audioconvert/splitter.c index d73c36000..3d387138a 100644 --- a/spa/plugins/audioconvert/splitter.c +++ b/spa/plugins/audioconvert/splitter.c @@ -30,8 +30,8 @@ #include #include #include +#include -#include #include #define NAME "splitter" diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c index 5a62539f7..a21a150bd 100644 --- a/spa/plugins/audiomixer/audiomixer.c +++ b/spa/plugins/audiomixer/audiomixer.c @@ -30,8 +30,7 @@ #include #include #include - -#include +#include #include "mix-ops.h" diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c index 519c9a145..aa738967b 100644 --- a/spa/plugins/audiotestsrc/audiotestsrc.c +++ b/spa/plugins/audiotestsrc/audiotestsrc.c @@ -34,8 +34,7 @@ #include #include #include - -#include +#include #define NAME "audiotestsrc" diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index d621afbf5..208effe22 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -35,8 +35,8 @@ #include #include #include +#include -#include #include #include "defs.h" diff --git a/spa/plugins/bluez5/bluez5-monitor.c b/spa/plugins/bluez5/bluez5-monitor.c index 8da67e396..50c37030b 100644 --- a/spa/plugins/bluez5/bluez5-monitor.c +++ b/spa/plugins/bluez5/bluez5-monitor.c @@ -33,10 +33,9 @@ #include #include #include +#include #include -#include - #include "a2dp-codecs.h" #include "defs.h" diff --git a/spa/plugins/ffmpeg/ffmpeg-dec.c b/spa/plugins/ffmpeg/ffmpeg-dec.c index 46dea6115..52dea2343 100644 --- a/spa/plugins/ffmpeg/ffmpeg-dec.c +++ b/spa/plugins/ffmpeg/ffmpeg-dec.c @@ -28,8 +28,7 @@ #include #include #include - -#include +#include #define IS_VALID_PORT(this,d,id) ((id) == 0) #define GET_IN_PORT(this,p) (&this->in_ports[p]) diff --git a/spa/plugins/ffmpeg/ffmpeg-enc.c b/spa/plugins/ffmpeg/ffmpeg-enc.c index ed6f4ef60..dd685b7c6 100644 --- a/spa/plugins/ffmpeg/ffmpeg-enc.c +++ b/spa/plugins/ffmpeg/ffmpeg-enc.c @@ -28,8 +28,8 @@ #include #include #include +#include -#include #define IS_VALID_PORT(this,d,id) ((id) == 0) #define GET_IN_PORT(this,p) (&this->in_ports[p]) diff --git a/spa/plugins/test/fakesink.c b/spa/plugins/test/fakesink.c index 4f1ded250..a6ec3bed3 100644 --- a/spa/plugins/test/fakesink.c +++ b/spa/plugins/test/fakesink.c @@ -34,8 +34,7 @@ #include #include #include - -#include +#include #define NAME "fakesink" diff --git a/spa/plugins/test/fakesrc.c b/spa/plugins/test/fakesrc.c index 2c2c0e7f3..24107d20c 100644 --- a/spa/plugins/test/fakesrc.c +++ b/spa/plugins/test/fakesrc.c @@ -34,8 +34,7 @@ #include #include #include - -#include +#include #define NAME "fakesrc" diff --git a/spa/plugins/v4l2/v4l2-monitor.c b/spa/plugins/v4l2/v4l2-monitor.c index d0d074c3e..9ff609b19 100644 --- a/spa/plugins/v4l2/v4l2-monitor.c +++ b/spa/plugins/v4l2/v4l2-monitor.c @@ -29,10 +29,9 @@ #include #include #include +#include #include -#include - #define NAME "v4l2-monitor" extern const struct spa_handle_factory spa_v4l2_source_factory; diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index 5799541a2..f66ca56bc 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -34,9 +34,7 @@ #include #include #include - -#include -#include +#include #define NAME "v4l2-source" diff --git a/spa/plugins/videotestsrc/videotestsrc.c b/spa/plugins/videotestsrc/videotestsrc.c index 5fe8ab1f1..58e120f8f 100644 --- a/spa/plugins/videotestsrc/videotestsrc.c +++ b/spa/plugins/videotestsrc/videotestsrc.c @@ -34,8 +34,7 @@ #include #include #include - -#include +#include #define NAME "videotestsrc" diff --git a/spa/plugins/volume/volume.c b/spa/plugins/volume/volume.c index ce38e241d..d342ff275 100644 --- a/spa/plugins/volume/volume.c +++ b/spa/plugins/volume/volume.c @@ -30,8 +30,7 @@ #include #include #include - -#include +#include #define NAME "volume" diff --git a/src/modules/module-audio-dsp.c b/src/modules/module-audio-dsp.c index 8e5b53cbb..6233f95e6 100644 --- a/src/modules/module-audio-dsp.c +++ b/src/modules/module-audio-dsp.c @@ -24,6 +24,11 @@ #include "config.h" +#include +#include +#include +#include + #include "pipewire/core.h" #include "pipewire/interfaces.h" #include "pipewire/log.h" diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index b7815febb..0b723fcb9 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -29,7 +29,7 @@ #include #include -#include +#include #include "pipewire/pipewire.h" #include "pipewire/interfaces.h" diff --git a/src/modules/module-media-session/floatmix.c b/src/modules/module-media-session/floatmix.c index dc0b91de1..f47f0668c 100644 --- a/src/modules/module-media-session/floatmix.c +++ b/src/modules/module-media-session/floatmix.c @@ -30,8 +30,7 @@ #include #include #include - -#include +#include #define NAME "floatmix" diff --git a/src/pipewire/global.c b/src/pipewire/global.c index f4dcc174a..9269e242f 100644 --- a/src/pipewire/global.c +++ b/src/pipewire/global.c @@ -22,8 +22,6 @@ #include #include -#include - #include #include #include diff --git a/src/pipewire/link.c b/src/pipewire/link.c index 79bada726..65d560b05 100644 --- a/src/pipewire/link.c +++ b/src/pipewire/link.c @@ -22,10 +22,10 @@ #include #include +#include #include #include -#include #include "pipewire.h" #include "private.h" diff --git a/src/pipewire/node.c b/src/pipewire/node.c index bf53e8a41..4b9d9842a 100644 --- a/src/pipewire/node.c +++ b/src/pipewire/node.c @@ -23,7 +23,6 @@ #include #include -#include #include #include "pipewire/pipewire.h" diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 5fb32e19b..4c5cc04fe 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -25,7 +25,6 @@ #include #include -#include #include "pipewire/pipewire.h" #include "pipewire/private.h" diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index c78cd5266..d994ac0f4 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -29,9 +29,8 @@ #include #include #include - +#include #include -#include #include "pipewire/pipewire.h" #include "pipewire/stream.h"