diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-06-11 09:51:32 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-06-11 09:51:32 +0200 |
commit | 12afb2393889d92e1bc6a517a855092fe7971dd5 (patch) | |
tree | c6dd1d0fb83ef8b2a395ae564ee18d2445e307c6 /doc | |
parent | da9d17e73eb32c46d61fbb5c5c08b0b678d6cf32 (diff) |
docs: add some more docs
Diffstat (limited to 'doc')
-rw-r--r-- | doc/overview.md | 36 | ||||
-rw-r--r-- | doc/tutorial1.md | 45 | ||||
-rw-r--r-- | doc/tutorial2.md | 67 |
3 files changed, 148 insertions, 0 deletions
diff --git a/doc/overview.md b/doc/overview.md new file mode 100644 index 00000000..7f15da53 --- /dev/null +++ b/doc/overview.md @@ -0,0 +1,36 @@ +# PipeWire Overview + +PipeWire is a new low-level multimedia framework designed from scratch that +aims to provide + +* graph based processing +* support for out-of-process processing graphs with minimal overhead +* flexible and extensible media format negotiation and buffer allocation +* Hard real-time capable plugins +* achieve very low-latency for both audio and video processing + +The framework is used to build a modular daemon that can be configured to: + +* be a low-latency audio server with features like pulseaudio and/or jack +* a video capture server that can manage hardware video capture devices and + provide access to them +* a central hub where video can be made available for other applications + such as the gnome-shell screencast API. + +## Components + +Currently PipeWire ships with the following components: + +* a PipeWire daemon that implements the IPC and graph processing +* an example session manager that manages objects in the PipeWire + daemon. +* a set of tools to introspect and use the PipeWire daemon. +* a library to develop PipeWire applications and plugins. + +### The PipeWire daemon + +### The example session manager + +### Tools + +### Application development diff --git a/doc/tutorial1.md b/doc/tutorial1.md new file mode 100644 index 00000000..98889756 --- /dev/null +++ b/doc/tutorial1.md @@ -0,0 +1,45 @@ +# Tutorial 1 + +In this tutorial we show the basics of a simple PipeWire application. +Use this tutorial to get started and help you set up your development +environment. + +## Initialization + +Let get started with the simplest application. + +```c +#include <pipewire/pipewire.h> + +int main(int argc, char *argv[]) +{ + pw_init(&argc, &argv); + + fprintf(stdout, "Compiled with libpipewire %s\n" + "Linked with libpipewire %s\n", + pw_get_headers_version(), + pw_get_library_version()); + return 0; +} +``` + +Before you can use any PipeWire functions, you need to call `pw_init()`. + +## Compilation + +To compile the simple test application, copy it into a test1.c file and +use: + +``` +gcc -Wall test1.c -o test1 $(pkg-config --cflags --libs libpipewire-0.3) +``` + +then run it with: + +``` +# ./test1 +Compiled with libpipewire 0.3.5 +Linked with libpipewire 0.3.5 +# +``` + diff --git a/doc/tutorial2.md b/doc/tutorial2.md new file mode 100644 index 00000000..53ce179e --- /dev/null +++ b/doc/tutorial2.md @@ -0,0 +1,67 @@ +# Tutorial 2 + +In this tutorial we show how to connect to a PipeWire daemon and +enumerate the objects that it has. + +## Initialization + +Let take a look at the following application to start. + +```c +#include <pipewire/pipewire.h> + +static void registry_event_global(void *data, uint32_t id, + uint32_t permissions, const char *type, uint32_t version, + const struct spa_dict *props) +{ + printf("object: id:%u type:%s/%d\n", id, type, version); +} + +static const struct pw_registry_events registry_events = { + PW_VERSION_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; +} +``` + +To compile the simple test application, copy it into a test2.c file and +use: + +``` +gcc -Wall test2.c -o test2 $(pkg-config --cflags --libs libpipewire-0.3) +``` |