From f0d3f1f9d2d489e39d6a41bf7088715b0aaa24e2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 7 May 2021 09:15:06 +1000 Subject: [PATCH] doc: remove trailing whitespace My vim/git setup wants to fix those on every commit which gets a bit annoying, let's just remove them: sed -i 's/ *$//g' $(git ls-files doc) --- doc/spa/buffer.md | 2 +- doc/spa/pod.md | 26 +++++++++--------- doc/tutorial1.md | 2 +- doc/tutorial2.md | 70 +++++++++++++++++++++++------------------------ doc/tutorial4.md | 2 +- 5 files changed, 51 insertions(+), 51 deletions(-) diff --git a/doc/spa/buffer.md b/doc/spa/buffer.md index 9a9a791f6..e20bdd5bf 100644 --- a/doc/spa/buffer.md +++ b/doc/spa/buffer.md @@ -59,5 +59,5 @@ The reason why is this set up like this is that the metadata memory, the data an * +>| data | memory for n_datas data, aligned * | ... blocks | according to alignments * +==============================+ - + Taken from [here](https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/11f95fe11e07192cec19fddb4fafc708e023e49c/spa/include/spa/buffer/alloc.h). diff --git a/doc/spa/pod.md b/doc/spa/pod.md index 6231fc90e..a17e59a06 100644 --- a/doc/spa/pod.md +++ b/doc/spa/pod.md @@ -14,7 +14,7 @@ followed by the pod contents. This makes it possible to skip over unknown POD types. The POD start is always aligned to 8 bytes. PODs can be efficiently constructed and parsed in real-time threads without -requiring memory allocations. +requiring memory allocations. PODs use the SPA type system for the basic types and containers. See the SPA types for more info. @@ -30,23 +30,23 @@ PODs can contain a number of basic SPA types: various numeral types, 32 and 64 bits. * `SPA_TYPE_String`: a string * `SPA_TYPE_Bytes`: a byte array - * `SPA_TYPE_Rectangle`: a rectangle with width and height + * `SPA_TYPE_Rectangle`: a rectangle with width and height * `SPA_TYPE_Fraction`: a fraction with numerator and denominator - * `SPA_TYPE_Bitmap`: an array of bits + * `SPA_TYPE_Bitmap`: an array of bits PODs can be grouped together in these container types: - * `SPA_TYPE_Array`: an array of equal sized objects + * `SPA_TYPE_Array`: an array of equal sized objects * `SPA_TYPE_Struct`: a collection of types and objects * `SPA_TYPE_Object`: an object with properties - * `SPA_TYPE_Sequence`: a timed sequence of PODs + * `SPA_TYPE_Sequence`: a timed sequence of PODs PODs can also contain some extra types: - * `SPA_TYPE_Pointer`: a typed pointer in memory + * `SPA_TYPE_Pointer`: a typed pointer in memory * `SPA_TYPE_Fd`: a file descriptor - * `SPA_TYPE_Choice`: a choice of values - * `SPA_TYPE_Pod`: a generic type for the POD itself + * `SPA_TYPE_Choice`: a choice of values + * `SPA_TYPE_Pod`: a generic type for the POD itself # Constructing a POD @@ -65,7 +65,7 @@ the stack allocated buffer. ```c uint8_t buffer[4096]; struct spa_pod_builder b; -spa_pod_builder_init(&b, buffer, sizeof(buffer)); +spa_pod_builder_init(&b, buffer, sizeof(buffer)); ``` Next we need to write some object into the builder. Let's write @@ -176,7 +176,7 @@ interpreted in different ways: * `SPA_CHOICE_None`: no choice, first value is current * `SPA_CHOICE_Range`: range: default, min, max * `SPA_CHOICE_Step`: range with step: default, min, max, step - * `SPA_CHOICE_Enum`: enum: default, alternative,... + * `SPA_CHOICE_Enum`: enum: default, alternative,... * `SPA_CHOICE_Flags`: bitmask of flags Let's illustrate this with a Props object that specifies a range of @@ -233,7 +233,7 @@ pod = spa_pod_builder_add_object(&b, ## Fixate -We can remove all choice values from the object with the +We can remove all choice values from the object with the `spa_pod_object_fixate()` method. This modifies the pod in-place and sets all choice properties to `SPA_CHOICE_None`, forcing the default value as the only available value in the choice. @@ -345,7 +345,7 @@ spa_pod_parser_push_struct(&p, &f); ``` You need to store the context in a `struct spa_pod_frame` to be able -to exit the container again later. +to exit the container again later. You can then parse each field. The parser takes care of moving to the next field. @@ -415,7 +415,7 @@ Use the iterator for this. The parser will handle Choice values as long as they are of type None. It will then parse the single value from the choice. When -dealing with other choice values, it's possible to parse the +dealing with other choice values, it's possible to parse the property values into a `struct spa_pod` and then inspect the Choice manually, if needed. diff --git a/doc/tutorial1.md b/doc/tutorial1.md index 6dbdc08de..80c8c43b7 100644 --- a/doc/tutorial1.md +++ b/doc/tutorial1.md @@ -11,7 +11,7 @@ environment. Let get started with the simplest application. ```c -#include +#include int main(int argc, char *argv[]) { diff --git a/doc/tutorial2.md b/doc/tutorial2.md index 1f0fbfbf7..e9ff30ea6 100644 --- a/doc/tutorial2.md +++ b/doc/tutorial2.md @@ -23,41 +23,41 @@ static const struct pw_registry_events registry_events = { .global = registry_event_global, }; -int main(int argc, char *argv[]) -{ - struct pw_main_loop *loop; - struct pw_context *context; - struct pw_core *core; - struct pw_registry *registry; - struct spa_hook registry_listener; - - pw_init(&argc, &argv); - - loop = pw_main_loop_new(NULL /* properties */); - context = pw_context_new(pw_main_loop_get_loop(loop), - NULL /* properties */, - 0 /* user_data size */); - - core = pw_context_connect(context, - NULL /* properties */, - 0 /* user_data size */); - - registry = pw_core_get_registry(core, PW_VERSION_REGISTRY, - 0 /* user_data size */); - - spa_zero(registry_listener); - pw_registry_add_listener(registry, ®istry_listener, - ®istry_events, NULL); - - pw_main_loop_run(loop); - - pw_proxy_destroy((struct pw_proxy*)registry); - pw_core_disconnect(core); - pw_context_destroy(context); - pw_main_loop_destroy(loop); - - return 0; -} +int main(int argc, char *argv[]) +{ + struct pw_main_loop *loop; + struct pw_context *context; + struct pw_core *core; + struct pw_registry *registry; + struct spa_hook registry_listener; + + pw_init(&argc, &argv); + + loop = pw_main_loop_new(NULL /* properties */); + context = pw_context_new(pw_main_loop_get_loop(loop), + NULL /* properties */, + 0 /* user_data size */); + + core = pw_context_connect(context, + NULL /* properties */, + 0 /* user_data size */); + + registry = pw_core_get_registry(core, PW_VERSION_REGISTRY, + 0 /* user_data size */); + + spa_zero(registry_listener); + pw_registry_add_listener(registry, ®istry_listener, + ®istry_events, NULL); + + pw_main_loop_run(loop); + + pw_proxy_destroy((struct pw_proxy*)registry); + pw_core_disconnect(core); + pw_context_destroy(context); + pw_main_loop_destroy(loop); + + return 0; +} ``` To compile the simple test application, copy it into a tutorial2.c file and diff --git a/doc/tutorial4.md b/doc/tutorial4.md index 4ba6d1b9c..d0afe1872 100644 --- a/doc/tutorial4.md +++ b/doc/tutorial4.md @@ -184,7 +184,7 @@ static const struct pw_stream_events stream_events = { ``` We are for the moment only interested now in the `process` event. This event -is called whenever we need to produce more data. We'll see how that function +is called whenever we need to produce more data. We'll see how that function is implemented but first we need to setup the format of the stream: ```c