On 11/11/2011 12:17 AM, David Henningsson wrote:
Do you think we can merge these different views and come up with an
agreed client API within a couple of days?

Ok, so I can happily say that we had a great IRC conversation on the topic today. The outcome was:

 * Not to register port objects with the core (for the time being)

* Not to add "inactive" sinks/sources to the client API (for the time being)

 * When port availability changes, fire a subscription event for the card.

* I'm not sure we got consensus on if/when the sink/source should also get a subscription event, but that can be discussed later.

* To change the existing proposal's "is_input" and "is_output" to a bitfield. Thus the new client API proposal is now attached. I'll start working on implementing this next week unless I hear massive complaints.

One detail though: should the enums be declared as is (e g "pa_direction_t direction;") or as ints ("int direction;")? I remember someone saying enums were more likely to change size than ints.

--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
diff --git a/src/pulse/def.h b/src/pulse/def.h
index ca74dfc..ef82370 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -124,6 +124,20 @@ typedef enum pa_context_flags {
 #define PA_CONTEXT_NOFAIL PA_CONTEXT_NOFAIL
 /** \endcond */
 
+/** Direction bitfield - while we currently do not expose anything 
bidirectional,
+    one should test against the bit instead of the value (e g if (d & 
PA_DIRECTION_OUTPUT)),
+    because we might add bidirectional stuff in the future. \since 2.0 
+*/
+typedef enum pa_direction {
+    PA_DIRECTION_OUTPUT = 0x0001U,  /**< Output direction */
+    PA_DIRECTION_INPUT = 0x0002U    /**< Input direction */
+} pa_direction_t;
+
+/** \cond fulldocs */
+#define PA_DIRECTION_OUTPUT PA_DIRECTION_OUTPUT
+#define PA_DIRECTION_INPUT PA_DIRECTION_INPUT
+/** \endcond */
+
 /** The type of device we are dealing with */
 typedef enum pa_device_type {
     PA_DEVICE_TYPE_SINK,     /**< Playback device */
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index 07c7233..b15633f 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -454,6 +454,19 @@ typedef struct pa_card_profile_info {
     uint32_t priority;                  /**< The higher this value is the more 
useful this profile is as a default */
 } pa_card_profile_info;
 
+/** Stores information about a specific port of a card.  Please
+ * note that this structure can be extended as part of evolutionary
+ * API updates at any time in any new release. \since 2.0 */
+typedef struct pa_card_port_info {
+    const char *name;                   /**< Name of this port */
+    const char *description;            /**< Description of this port */
+    uint32_t priority;                  /**< The higher this value is the more 
useful this port is as a default */
+    pa_port_available_t available;      /**< Is this port currently available? 
\since 2.0 */
+    int direction;                      /**< This is a \link pa_direction_t 
enum */
+    uint32_t n_profiles;                /**< Number of entries in profile 
array */
+    pa_card_profile_info** profiles;    /**< Array of pointers available 
profile, or NULL. Array is terminated by an entry set to NULL. */
+} pa_card_port_info;
+
 /** Stores information about cards. Please note that this structure
  * can be extended as part of evolutionary API updates at any time in
  * any new release.  \since 0.9.15 */
@@ -466,6 +479,8 @@ typedef struct pa_card_info {
     pa_card_profile_info* profiles;      /**< Array of available profile, or 
NULL. Array is terminated by an entry with name set to NULL. Number of entries 
is stored in n_profiles */
     pa_card_profile_info* active_profile; /**< Pointer to active profile in 
the array, or NULL */
     pa_proplist *proplist;               /**< Property list */
+    uint32_t n_ports;                    /**< Number of entries in port array 
*/
+    pa_card_port_info **ports;           /**< Array of pointers to ports, or 
NULL. Array is terminated by an entry set to NULL. */
 } pa_card_info;
 
 /** Callback prototype for pa_context_get_card_info_...() \since 0.9.15 */
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to