153a5a1b3Sopenharmony_ci#ifndef foopulseaudiohfoo
253a5a1b3Sopenharmony_ci#define foopulseaudiohfoo
353a5a1b3Sopenharmony_ci
453a5a1b3Sopenharmony_ci/***
553a5a1b3Sopenharmony_ci  This file is part of PulseAudio.
653a5a1b3Sopenharmony_ci
753a5a1b3Sopenharmony_ci  Copyright 2004-2006 Lennart Poettering
853a5a1b3Sopenharmony_ci  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
953a5a1b3Sopenharmony_ci
1053a5a1b3Sopenharmony_ci  PulseAudio is free software; you can redistribute it and/or modify
1153a5a1b3Sopenharmony_ci  it under the terms of the GNU Lesser General Public License as
1253a5a1b3Sopenharmony_ci  published by the Free Software Foundation; either version 2.1 of the
1353a5a1b3Sopenharmony_ci  License, or (at your option) any later version.
1453a5a1b3Sopenharmony_ci
1553a5a1b3Sopenharmony_ci  PulseAudio is distributed in the hope that it will be useful, but
1653a5a1b3Sopenharmony_ci  WITHOUT ANY WARRANTY; without even the implied warranty of
1753a5a1b3Sopenharmony_ci  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1853a5a1b3Sopenharmony_ci  Lesser General Public License for more details.
1953a5a1b3Sopenharmony_ci
2053a5a1b3Sopenharmony_ci  You should have received a copy of the GNU Lesser General Public
2153a5a1b3Sopenharmony_ci  License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
2253a5a1b3Sopenharmony_ci***/
2353a5a1b3Sopenharmony_ci
2453a5a1b3Sopenharmony_ci#include <pulse/direction.h>
2553a5a1b3Sopenharmony_ci#include <pulse/mainloop-api.h>
2653a5a1b3Sopenharmony_ci#include <pulse/sample.h>
2753a5a1b3Sopenharmony_ci#include <pulse/format.h>
2853a5a1b3Sopenharmony_ci#include <pulse/def.h>
2953a5a1b3Sopenharmony_ci#include <pulse/context.h>
3053a5a1b3Sopenharmony_ci#include <pulse/stream.h>
3153a5a1b3Sopenharmony_ci#include <pulse/introspect.h>
3253a5a1b3Sopenharmony_ci#include <pulse/subscribe.h>
3353a5a1b3Sopenharmony_ci#include <pulse/scache.h>
3453a5a1b3Sopenharmony_ci#include <pulse/version.h>
3553a5a1b3Sopenharmony_ci#include <pulse/error.h>
3653a5a1b3Sopenharmony_ci#include <pulse/operation.h>
3753a5a1b3Sopenharmony_ci#include <pulse/channelmap.h>
3853a5a1b3Sopenharmony_ci#include <pulse/volume.h>
3953a5a1b3Sopenharmony_ci#include <pulse/xmalloc.h>
4053a5a1b3Sopenharmony_ci#include <pulse/utf8.h>
4153a5a1b3Sopenharmony_ci#include <pulse/thread-mainloop.h>
4253a5a1b3Sopenharmony_ci#include <pulse/mainloop.h>
4353a5a1b3Sopenharmony_ci#include <pulse/mainloop-signal.h>
4453a5a1b3Sopenharmony_ci#include <pulse/util.h>
4553a5a1b3Sopenharmony_ci#include <pulse/timeval.h>
4653a5a1b3Sopenharmony_ci#include <pulse/proplist.h>
4753a5a1b3Sopenharmony_ci#include <pulse/rtclock.h>
4853a5a1b3Sopenharmony_ci
4953a5a1b3Sopenharmony_ci/** \file
5053a5a1b3Sopenharmony_ci * Include all libpulse header files at once. The following files are
5153a5a1b3Sopenharmony_ci * included: \ref direction.h, \ref mainloop-api.h, \ref sample.h, \ref def.h,
5253a5a1b3Sopenharmony_ci * \ref context.h, \ref stream.h, \ref introspect.h, \ref subscribe.h, \ref
5353a5a1b3Sopenharmony_ci * scache.h, \ref version.h, \ref error.h, \ref channelmap.h, \ref
5453a5a1b3Sopenharmony_ci * operation.h,\ref volume.h, \ref xmalloc.h, \ref utf8.h, \ref
5553a5a1b3Sopenharmony_ci * thread-mainloop.h, \ref mainloop.h, \ref util.h, \ref proplist.h,
5653a5a1b3Sopenharmony_ci * \ref timeval.h, \ref rtclock.h and \ref mainloop-signal.h at
5753a5a1b3Sopenharmony_ci * once */
5853a5a1b3Sopenharmony_ci
5953a5a1b3Sopenharmony_ci/** \mainpage
6053a5a1b3Sopenharmony_ci *
6153a5a1b3Sopenharmony_ci * \section intro_sec Introduction
6253a5a1b3Sopenharmony_ci *
6353a5a1b3Sopenharmony_ci * This document describes the client API for the PulseAudio sound
6453a5a1b3Sopenharmony_ci * server. The API comes in two flavours to accommodate different styles
6553a5a1b3Sopenharmony_ci * of applications and different needs in complexity:
6653a5a1b3Sopenharmony_ci *
6753a5a1b3Sopenharmony_ci * \li The complete but somewhat complicated to use asynchronous API
6853a5a1b3Sopenharmony_ci * \li The simplified, easy to use, but limited synchronous API
6953a5a1b3Sopenharmony_ci *
7053a5a1b3Sopenharmony_ci * All strings in PulseAudio are in the UTF-8 encoding, regardless of current
7153a5a1b3Sopenharmony_ci * locale. Some functions will filter invalid sequences from the string, some
7253a5a1b3Sopenharmony_ci * will simply fail. To ensure reliable behaviour, make sure everything you
7353a5a1b3Sopenharmony_ci * pass to the API is already in UTF-8.
7453a5a1b3Sopenharmony_ci
7553a5a1b3Sopenharmony_ci * \section simple_sec Simple API
7653a5a1b3Sopenharmony_ci *
7753a5a1b3Sopenharmony_ci * Use this if you develop your program in synchronous style and just
7853a5a1b3Sopenharmony_ci * need a way to play or record data on the sound server. See
7953a5a1b3Sopenharmony_ci * \subpage simple for more details.
8053a5a1b3Sopenharmony_ci *
8153a5a1b3Sopenharmony_ci * \section async_sec Asynchronous API
8253a5a1b3Sopenharmony_ci *
8353a5a1b3Sopenharmony_ci * Use this if you develop your programs in asynchronous, event loop
8453a5a1b3Sopenharmony_ci * based style or if you want to use the advanced features of the
8553a5a1b3Sopenharmony_ci * PulseAudio API. A guide can be found in \subpage async.
8653a5a1b3Sopenharmony_ci *
8753a5a1b3Sopenharmony_ci * By using the built-in threaded main loop, it is possible to achieve a
8853a5a1b3Sopenharmony_ci * pseudo-synchronous API, which can be useful in synchronous applications
8953a5a1b3Sopenharmony_ci * where the simple API is insufficient. See the \ref async page for
9053a5a1b3Sopenharmony_ci * details.
9153a5a1b3Sopenharmony_ci *
9253a5a1b3Sopenharmony_ci * \section thread_sec Threads
9353a5a1b3Sopenharmony_ci *
9453a5a1b3Sopenharmony_ci * The PulseAudio client libraries are not designed to be directly
9553a5a1b3Sopenharmony_ci * thread-safe. They are however designed to be reentrant and
9653a5a1b3Sopenharmony_ci * threads-aware.
9753a5a1b3Sopenharmony_ci *
9853a5a1b3Sopenharmony_ci * To use the libraries in a threaded environment, you must assure that
9953a5a1b3Sopenharmony_ci * all objects are only used in one thread at a time. Normally, this means
10053a5a1b3Sopenharmony_ci * that all objects belonging to a single context must be accessed from the
10153a5a1b3Sopenharmony_ci * same thread.
10253a5a1b3Sopenharmony_ci *
10353a5a1b3Sopenharmony_ci * The included main loop implementation is also not thread safe. Take care
10453a5a1b3Sopenharmony_ci * to make sure event objects are not manipulated when any other code is
10553a5a1b3Sopenharmony_ci * using the main loop.
10653a5a1b3Sopenharmony_ci *
10753a5a1b3Sopenharmony_ci * \section error_sec Error Handling
10853a5a1b3Sopenharmony_ci *
10953a5a1b3Sopenharmony_ci * Every function should explicitly document how errors are reported to
11053a5a1b3Sopenharmony_ci * the caller. Unfortunately, currently a lot of that documentation is
11153a5a1b3Sopenharmony_ci * missing. Here is an overview of the general conventions used.
11253a5a1b3Sopenharmony_ci *
11353a5a1b3Sopenharmony_ci * The PulseAudio API indicates error conditions by returning a negative
11453a5a1b3Sopenharmony_ci * integer value or a NULL pointer. On success, zero or a positive integer
11553a5a1b3Sopenharmony_ci * value or a valid pointer is returned.
11653a5a1b3Sopenharmony_ci *
11753a5a1b3Sopenharmony_ci * Functions of the \ref simple API generally return -1 or NULL on failure and
11853a5a1b3Sopenharmony_ci * can optionally store an error code (see ::pa_error_code) using a pointer
11953a5a1b3Sopenharmony_ci * argument.
12053a5a1b3Sopenharmony_ci *
12153a5a1b3Sopenharmony_ci * Functions of the \ref async API return an negative error code or NULL on
12253a5a1b3Sopenharmony_ci * failure (see ::pa_error_code). In the later case, pa_context_errno()
12353a5a1b3Sopenharmony_ci * can be used to obtain the error code of the last failed operation.
12453a5a1b3Sopenharmony_ci *
12553a5a1b3Sopenharmony_ci * An error code can be turned into a human readable message using
12653a5a1b3Sopenharmony_ci * pa_strerror().
12753a5a1b3Sopenharmony_ci *
12853a5a1b3Sopenharmony_ci * \section logging_sec Logging
12953a5a1b3Sopenharmony_ci *
13053a5a1b3Sopenharmony_ci * You can configure different logging parameters for the PulseAudio client
13153a5a1b3Sopenharmony_ci * libraries. The following environment variables are recognized:
13253a5a1b3Sopenharmony_ci *
13353a5a1b3Sopenharmony_ci *  - `PULSE_LOG`: Maximum log level required. Bigger values result in a
13453a5a1b3Sopenharmony_ci *     more verbose logging output. The following values are recognized:
13553a5a1b3Sopenharmony_ci *     + `0`: Error messages
13653a5a1b3Sopenharmony_ci *     + `1`: Warning messages
13753a5a1b3Sopenharmony_ci *     + `2`: Notice messages
13853a5a1b3Sopenharmony_ci *     + `3`: Info messages
13953a5a1b3Sopenharmony_ci *     + `4`: Debug messages
14053a5a1b3Sopenharmony_ci *  - `PULSE_LOG_SYSLOG`: If defined, force all client libraries to log
14153a5a1b3Sopenharmony_ci *     their output using the syslog(3) mechanism. Default behavior is to
14253a5a1b3Sopenharmony_ci *     log all output to stderr.
14353a5a1b3Sopenharmony_ci *  - `PULSE_LOG_JOURNAL`: If defined, force all client libraries to log
14453a5a1b3Sopenharmony_ci *     their output using the systemd journal. If both `PULSE_LOG_JOURNAL`
14553a5a1b3Sopenharmony_ci *     and `PULSE_LOG_SYSLOG` are defined, logging to the systemd journal
14653a5a1b3Sopenharmony_ci *     takes a higher precedence. Each message originating library file name
14753a5a1b3Sopenharmony_ci *     and function are included by default through the journal fields
14853a5a1b3Sopenharmony_ci *     `CODE_FILE`, `CODE_FUNC`, and `CODE_LINE`. Any backtrace attached to
14953a5a1b3Sopenharmony_ci *     the logging message is sent through the PulseAudio-specific journal
15053a5a1b3Sopenharmony_ci *     field `PULSE_BACKTRACE`. This environment variable has no effect if
15153a5a1b3Sopenharmony_ci *     PulseAudio was compiled without systemd journal support.
15253a5a1b3Sopenharmony_ci *  - `PULSE_LOG_COLORS`: If defined, enables colored logging output.
15353a5a1b3Sopenharmony_ci *  - `PULSE_LOG_TIME`: If defined, include timestamps with each message.
15453a5a1b3Sopenharmony_ci *  - `PULSE_LOG_FILE`: If defined, include each message originating file
15553a5a1b3Sopenharmony_ci *     name.
15653a5a1b3Sopenharmony_ci *  - `PULSE_LOG_META`: If defined, include each message originating file
15753a5a1b3Sopenharmony_ci *     name and path relative to the PulseAudio source tree root.
15853a5a1b3Sopenharmony_ci *  - `PULSE_LOG_LEVEL`: If defined, include a log level prefix with each
15953a5a1b3Sopenharmony_ci *     message. Respectively, the prefixes "E", "W", "N", "I", "D" stands
16053a5a1b3Sopenharmony_ci *     for Error, Warning, Notice, Info, and Debugging.
16153a5a1b3Sopenharmony_ci *  - `PULSE_LOG_BACKTRACE`: Number of functions to display in the backtrace.
16253a5a1b3Sopenharmony_ci *     If this variable is not defined, or has a value of zero, no backtrace
16353a5a1b3Sopenharmony_ci *     is shown.
16453a5a1b3Sopenharmony_ci *  - `PULSE_LOG_BACKTRACE_SKIP`: Number of backtrace levels to skip, from
16553a5a1b3Sopenharmony_ci *     the function printing the log message downwards.
16653a5a1b3Sopenharmony_ci *  - `PULSE_LOG_NO_RATE_LIMIT`: If defined, do not rate limit the logging
16753a5a1b3Sopenharmony_ci *     output. Rate limiting skips certain log messages when their frequency
16853a5a1b3Sopenharmony_ci *     is considered too high.
16953a5a1b3Sopenharmony_ci *
17053a5a1b3Sopenharmony_ci * \section pkgconfig pkg-config
17153a5a1b3Sopenharmony_ci *
17253a5a1b3Sopenharmony_ci * The PulseAudio libraries provide pkg-config snippets for the different
17353a5a1b3Sopenharmony_ci * modules:
17453a5a1b3Sopenharmony_ci *
17553a5a1b3Sopenharmony_ci * \li libpulse - The asynchronous API and the internal main loop implementation.
17653a5a1b3Sopenharmony_ci * \li libpulse-mainloop-glib - GLIB 2.x main loop bindings.
17753a5a1b3Sopenharmony_ci * \li libpulse-simple - The simple PulseAudio API.
17853a5a1b3Sopenharmony_ci */
17953a5a1b3Sopenharmony_ci
18053a5a1b3Sopenharmony_ci#endif
181