pulseaudio.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. #ifndef foopulseaudiohfoo
  2. #define foopulseaudiohfoo
  3. /***
  4. This file is part of PulseAudio.
  5. Copyright 2004-2006 Lennart Poettering
  6. Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
  7. PulseAudio is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU Lesser General Public License as
  9. published by the Free Software Foundation; either version 2.1 of the
  10. License, or (at your option) any later version.
  11. PulseAudio is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
  17. ***/
  18. #include <pulse/direction.h>
  19. #include <pulse/mainloop-api.h>
  20. #include <pulse/sample.h>
  21. #include <pulse/format.h>
  22. #include <pulse/def.h>
  23. #include <pulse/context.h>
  24. #include <pulse/stream.h>
  25. #include <pulse/introspect.h>
  26. #include <pulse/subscribe.h>
  27. #include <pulse/scache.h>
  28. #include <pulse/version.h>
  29. #include <pulse/error.h>
  30. #include <pulse/operation.h>
  31. #include <pulse/channelmap.h>
  32. #include <pulse/volume.h>
  33. #include <pulse/xmalloc.h>
  34. #include <pulse/utf8.h>
  35. #include <pulse/thread-mainloop.h>
  36. #include <pulse/mainloop.h>
  37. #include <pulse/mainloop-signal.h>
  38. #include <pulse/util.h>
  39. #include <pulse/timeval.h>
  40. #include <pulse/proplist.h>
  41. #include <pulse/rtclock.h>
  42. /** \file
  43. * Include all libpulse header files at once. The following files are
  44. * included: \ref direction.h, \ref mainloop-api.h, \ref sample.h, \ref def.h,
  45. * \ref context.h, \ref stream.h, \ref introspect.h, \ref subscribe.h, \ref
  46. * scache.h, \ref version.h, \ref error.h, \ref channelmap.h, \ref
  47. * operation.h,\ref volume.h, \ref xmalloc.h, \ref utf8.h, \ref
  48. * thread-mainloop.h, \ref mainloop.h, \ref util.h, \ref proplist.h,
  49. * \ref timeval.h, \ref rtclock.h and \ref mainloop-signal.h at
  50. * once */
  51. /** \mainpage
  52. *
  53. * \section intro_sec Introduction
  54. *
  55. * This document describes the client API for the PulseAudio sound
  56. * server. The API comes in two flavours to accommodate different styles
  57. * of applications and different needs in complexity:
  58. *
  59. * \li The complete but somewhat complicated to use asynchronous API
  60. * \li The simplified, easy to use, but limited synchronous API
  61. *
  62. * All strings in PulseAudio are in the UTF-8 encoding, regardless of current
  63. * locale. Some functions will filter invalid sequences from the string, some
  64. * will simply fail. To ensure reliable behaviour, make sure everything you
  65. * pass to the API is already in UTF-8.
  66. * \section simple_sec Simple API
  67. *
  68. * Use this if you develop your program in synchronous style and just
  69. * need a way to play or record data on the sound server. See
  70. * \subpage simple for more details.
  71. *
  72. * \section async_sec Asynchronous API
  73. *
  74. * Use this if you develop your programs in asynchronous, event loop
  75. * based style or if you want to use the advanced features of the
  76. * PulseAudio API. A guide can be found in \subpage async.
  77. *
  78. * By using the built-in threaded main loop, it is possible to achieve a
  79. * pseudo-synchronous API, which can be useful in synchronous applications
  80. * where the simple API is insufficient. See the \ref async page for
  81. * details.
  82. *
  83. * \section thread_sec Threads
  84. *
  85. * The PulseAudio client libraries are not designed to be directly
  86. * thread-safe. They are however designed to be reentrant and
  87. * threads-aware.
  88. *
  89. * To use the libraries in a threaded environment, you must assure that
  90. * all objects are only used in one thread at a time. Normally, this means
  91. * that all objects belonging to a single context must be accessed from the
  92. * same thread.
  93. *
  94. * The included main loop implementation is also not thread safe. Take care
  95. * to make sure event objects are not manipulated when any other code is
  96. * using the main loop.
  97. *
  98. * \section error_sec Error Handling
  99. *
  100. * Every function should explicitly document how errors are reported to
  101. * the caller. Unfortunately, currently a lot of that documentation is
  102. * missing. Here is an overview of the general conventions used.
  103. *
  104. * The PulseAudio API indicates error conditions by returning a negative
  105. * integer value or a NULL pointer. On success, zero or a positive integer
  106. * value or a valid pointer is returned.
  107. *
  108. * Functions of the \ref simple generally return -1 or NULL on failure and
  109. * can optionally store an error code (see ::pa_error_code) using a pointer
  110. * argument.
  111. *
  112. * Functions of the \ref async return an negative error code or NULL on
  113. * failure (see ::pa_error_code). In the later case, pa_context_errno()
  114. * can be used to obtain the error code of the last failed operation.
  115. *
  116. * An error code can be turned into a human readable message using
  117. * pa_strerror().
  118. *
  119. * \section logging_sec Logging
  120. *
  121. * You can configure different logging parameters for the PulseAudio client
  122. * libraries. The following environment variables are recognized:
  123. *
  124. * - `PULSE_LOG`: Maximum log level required. Bigger values result in a
  125. * more verbose logging output. The following values are recognized:
  126. * + `0`: Error messages
  127. * + `1`: Warning messages
  128. * + `2`: Notice messages
  129. * + `3`: Info messages
  130. * + `4`: Debug messages
  131. * - `PULSE_LOG_SYSLOG`: If defined, force all client libraries to log
  132. * their output using the syslog(3) mechanism. Default behavior is to
  133. * log all output to stderr.
  134. * - `PULSE_LOG_JOURNAL`: If defined, force all client libraries to log
  135. * their output using the systemd journal. If both `PULSE_LOG_JOURNAL`
  136. * and `PULSE_LOG_SYSLOG` are defined, logging to the systemd journal
  137. * takes a higher precedence. Each message originating library file name
  138. * and function are included by default through the journal fields
  139. * `CODE_FILE`, `CODE_FUNC`, and `CODE_LINE`. Any backtrace attached to
  140. * the logging message is sent through the PulseAudio-specific journal
  141. * field `PULSE_BACKTRACE`. This environment variable has no effect if
  142. * PulseAudio was compiled without systemd journal support.
  143. * - `PULSE_LOG_COLORS`: If defined, enables colored logging output.
  144. * - `PULSE_LOG_TIME`: If defined, include timestamps with each message.
  145. * - `PULSE_LOG_FILE`: If defined, include each message originating file
  146. * name.
  147. * - `PULSE_LOG_META`: If defined, include each message originating file
  148. * name and path relative to the PulseAudio source tree root.
  149. * - `PULSE_LOG_LEVEL`: If defined, include a log level prefix with each
  150. * message. Respectively, the prefixes "E", "W", "N", "I", "D" stands
  151. * for Error, Warning, Notice, Info, and Debugging.
  152. * - `PULSE_LOG_BACKTRACE`: Number of functions to display in the backtrace.
  153. * If this variable is not defined, or has a value of zero, no backtrace
  154. * is shown.
  155. * - `PULSE_LOG_BACKTRACE_SKIP`: Number of backtrace levels to skip, from
  156. * the function printing the log message downwards.
  157. * - `PULSE_LOG_NO_RATE_LIMIT`: If defined, do not rate limit the logging
  158. * output. Rate limiting skips certain log messages when their frequency
  159. * is considered too high.
  160. *
  161. * \section pkgconfig pkg-config
  162. *
  163. * The PulseAudio libraries provide pkg-config snippets for the different
  164. * modules:
  165. *
  166. * \li libpulse - The asynchronous API and the internal main loop implementation.
  167. * \li libpulse-mainloop-glib - GLIB 2.x main loop bindings.
  168. * \li libpulse-simple - The simple PulseAudio API.
  169. */
  170. #endif