]> code.delx.au - pulseaudio/blobdiff - src/pulse/def.h
move flat volume logic into the core. while doing so add n_volume_steps field to...
[pulseaudio] / src / pulse / def.h
index ace565740cb1c0fb4cc3bfefbccad04312a44687..7517a7aae4253f5f607c34b73d7cb42ec6a8a5c2 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <pulse/cdecl.h>
 #include <pulse/sample.h>
+#include <pulse/version.h>
 
 /** \file
  * Global definitions */
@@ -46,7 +47,7 @@ typedef enum pa_context_state {
     PA_CONTEXT_TERMINATED      /**< The connection was terminated cleanly */
 } pa_context_state_t;
 
-/** Return non-zero if the passed state is one of the connected states */
+/** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
 static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
     return
         x == PA_CONTEXT_CONNECTING ||
@@ -55,6 +56,10 @@ static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
         x == PA_CONTEXT_READY;
 }
 
+/** \cond fulldocs */
+#define PA_CONTEXT_IS_GOOD PA_CONTEXT_IS_GOOD
+/** \endcond */
+
 /** The state of a stream */
 typedef enum pa_stream_state {
     PA_STREAM_UNCONNECTED,  /**< The stream is not yet connected to any sink or source */
@@ -64,13 +69,17 @@ typedef enum pa_stream_state {
     PA_STREAM_TERMINATED    /**< The stream has been terminated cleanly */
 } pa_stream_state_t;
 
-/** Return non-zero if the passed state is one of the connected states */
+/** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
 static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) {
     return
         x == PA_STREAM_CREATING ||
         x == PA_STREAM_READY;
 }
 
+/** \cond fulldocs */
+#define PA_STREAM_IS_GOOD PA_STREAM_IS_GOOD
+/** \endcond */
+
 /** The state of an operation */
 typedef enum pa_operation_state {
     PA_OPERATION_RUNNING,      /**< The operation is still running */
@@ -226,13 +235,13 @@ typedef enum pa_stream_flags {
     PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 0x8000U,
     /**< If set this stream won't be taken into account when we it is
      * checked whether the device this stream is connected to should
-     * auto-suspend. \ since 0.9.14 */
+     * auto-suspend. \since 0.9.15 */
 
     PA_STREAM_START_UNMUTED = 0x10000U
     /**< Create in unmuted state. If neither PA_STREAM_START_UNMUTED
      * nor PA_STREAM_START_MUTED it is left to the server to decide
      * whether to create the stream in muted or in unmuted
-     * state. \since 0.9.14 */
+     * state. \since 0.9.15 */
 
 } pa_stream_flags_t;
 
@@ -348,6 +357,7 @@ enum {
     PA_ERR_NOTSUPPORTED,           /**< Operation not supported \since 0.9.5 */
     PA_ERR_UNKNOWN,                /**< The error code was unknown to the client */
     PA_ERR_NOEXTENSION,            /**< Extension does not exist. \since 0.9.12 */
+    PA_ERR_OBSOLETE,               /**< Obsolete functionality. \since 0.9.15 */
     PA_ERR_MAX                     /**< Not really an error but the first invalid error code */
 };
 
@@ -380,10 +390,15 @@ typedef enum pa_subscription_mask {
     PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
     /**< Other global server changes. */
 
+/** \cond fulldocs */
     PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
-    /**< Autoload table events. */
+    /**< \deprecated Autoload table events. */
+/** \endcond */
+
+    PA_SUBSCRIPTION_MASK_CARD = 0x0200U,
+    /**< Card events. \since 0.9.15 */
 
-    PA_SUBSCRIPTION_MASK_ALL = 0x01ffU
+    PA_SUBSCRIPTION_MASK_ALL = 0x02ffU
     /**< Catch all events */
 } pa_subscription_mask_t;
 
@@ -413,8 +428,13 @@ typedef enum pa_subscription_event_type {
     PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
     /**< Event type: Global server change, only occuring with PA_SUBSCRIPTION_EVENT_CHANGE. */
 
+/** \cond fulldocs */
     PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
-    /**< Event type: Autoload table changes. */
+    /**< \deprecated Event type: Autoload table changes. */
+/** \endcond */
+
+    PA_SUBSCRIPTION_EVENT_CARD = 0x0009U,
+    /**< Event type: Card \since 0.9.15 */
 
     PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
     /**< A mask to extract the event type from an event value */
@@ -428,7 +448,7 @@ typedef enum pa_subscription_event_type {
     PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U,
     /**< An object was removed */
 
-    PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U,
+    PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U
     /**< A mask to extract the event operation from an event value */
 
 } pa_subscription_event_type_t;
@@ -580,9 +600,13 @@ typedef enum pa_sink_flags {
     PA_SINK_HW_MUTE_CTRL = 0x0010U,
     /**< Supports hardware mute control \since 0.9.11 */
 
-    PA_SINK_DECIBEL_VOLUME = 0x0020U
+    PA_SINK_DECIBEL_VOLUME = 0x0020U,
     /**< Volume can be translated to dB with pa_sw_volume_to_dB()
      * \since 0.9.11 */
+
+    PA_SINK_FLAT_VOLUME = 0x0040U
+    /**< This sink is in flat volume mode, i.e. always the maximum of
+     * the volume of all connected inputs. \since 0.9.15 */
 } pa_sink_flags_t;
 
 /** \cond fulldocs */
@@ -590,8 +614,52 @@ typedef enum pa_sink_flags {
 #define PA_SINK_LATENCY PA_SINK_LATENCY
 #define PA_SINK_HARDWARE PA_SINK_HARDWARE
 #define PA_SINK_NETWORK PA_SINK_NETWORK
-#define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
+#define PA_SINK_HW_MUTE_CTRL PA_SINK_HW_MUTE_CTRL
 #define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME
+#define PA_SINK_FLAT_VOLUME PA_SINK_FLAT_VOLUME
+/** \endcond */
+
+/** Sink state. \since 0.9.15 */
+typedef enum pa_sink_state { /* enum serialized in u8 */
+    PA_SINK_INVALID_STATE = -1,
+    /**< This state is used when the server does not support sink state introspection \since 0.9.15 */
+
+    PA_SINK_RUNNING = 0,
+    /**< Running, sink is playing and used by at least one non-corked sink-input \since 0.9.15 */
+
+    PA_SINK_IDLE = 1,
+    /**< When idle, the sink is playing but there is no non-corked sink-input attached to it \since 0.9.15 */
+
+    PA_SINK_SUSPENDED = 2,
+    /**< When suspended, actual sink access can be closed, for instance \since 0.9.15 */
+
+/** \cond fulldocs */
+    /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
+     * SIDE! These values are *not* considered part of the official PA
+     * API/ABI. If you use them your application might break when PA
+     * is upgraded. Also, please note that these values are not useful
+     * on the client side anyway. */
+
+    PA_SINK_INIT = -2,
+    /**< Initialization state */
+
+    PA_SINK_UNLINKED = -3
+    /**< The state when the sink is getting unregistered and removed from client access */
+/** \endcond */
+
+} pa_sink_state_t;
+
+/** Returns non-zero if sink is playing: running or idle. \since 0.9.15 */
+static inline int PA_SINK_IS_OPENED(pa_sink_state_t x) {
+    return x == PA_SINK_RUNNING || x == PA_SINK_IDLE;
+}
+
+/** \cond fulldocs */
+#define PA_SINK_INVALID_STATE PA_SINK_INVALID_STATE
+#define PA_SINK_RUNNING PA_SINK_RUNNING
+#define PA_SINK_IDLE PA_SINK_IDLE
+#define PA_SINK_SUSPENDED PA_SINK_SUSPENDED
+#define PA_SINK_IS_OPENED PA_SINK_IS_OPENED
 /** \endcond */
 
 /** Special source flags.  */
@@ -607,7 +675,7 @@ typedef enum pa_source_flags {
      * "virtual"/software source \since 0.9.3 */
 
     PA_SOURCE_NETWORK = 0x0008U,
-    /**< Is a networked sink of some kind. \since 0.9.7 */
+    /**< Is a networked source of some kind. \since 0.9.7 */
 
     PA_SOURCE_HW_MUTE_CTRL = 0x0010U,
     /**< Supports hardware mute control \since 0.9.11 */
@@ -622,10 +690,53 @@ typedef enum pa_source_flags {
 #define PA_SOURCE_LATENCY PA_SOURCE_LATENCY
 #define PA_SOURCE_HARDWARE PA_SOURCE_HARDWARE
 #define PA_SOURCE_NETWORK PA_SOURCE_NETWORK
-#define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
+#define PA_SOURCE_HW_MUTE_CTRL PA_SOURCE_HW_MUTE_CTRL
 #define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME
 /** \endcond */
 
+/** Source state. \since 0.9.15 */
+typedef enum pa_source_state {
+    PA_SOURCE_INVALID_STATE = -1,
+    /**< This state is used when the server does not support source state introspection \since 0.9.15 */
+
+    PA_SOURCE_RUNNING = 0,
+    /**< Running, source is recording and used by at least one non-corked source-output \since 0.9.15 */
+
+    PA_SOURCE_IDLE = 1,
+    /**< When idle, the source is still recording but there is no non-corked source-output \since 0.9.15 */
+
+    PA_SOURCE_SUSPENDED = 2,
+    /**< When suspended, actual source access can be closed, for instance \since 0.9.15 */
+
+/** \cond fulldocs */
+    /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
+     * SIDE! These values are *not* considered part of the official PA
+     * API/ABI. If you use them your application might break when PA
+     * is upgraded. Also, please note that these values are not useful
+     * on the client side anyway. */
+
+    PA_SOURCE_INIT = -2,
+    /**< Initialization state */
+
+    PA_SOURCE_UNLINKED = -3
+    /**< The state when the source is getting unregistered and removed from client access */
+/** \endcond */
+
+} pa_source_state_t;
+
+/** Returns non-zero if source is recording: running or idle. \since 0.9.15 */
+static inline int PA_SOURCE_IS_OPENED(pa_source_state_t x) {
+    return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE;
+}
+
+/** \cond fulldocs */
+#define PA_SOURCE_INVALID_STATE PA_SOURCE_INVALID_STATE
+#define PA_SOURCE_RUNNING PA_SOURCE_RUNNING
+#define PA_SOURCE_IDLE PA_SOURCE_IDLE
+#define PA_SOURCE_SUSPENDED PA_SOURCE_SUSPENDED
+#define PA_SOURCE_IS_OPENED PA_SOURCE_IS_OPENED
+/** \endcond */
+
 /** A generic free() like callback prototype */
 typedef void (*pa_free_cb_t)(void *p);