]> code.delx.au - pulseaudio/commitdiff
replace "spawn" parameter of pa_context_new() with a proper flags parameter
authorLennart Poettering <lennart@poettering.net>
Mon, 20 Feb 2006 16:10:20 +0000 (16:10 +0000)
committerLennart Poettering <lennart@poettering.net>
Mon, 20 Feb 2006 16:10:20 +0000 (16:10 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@523 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/polyp/context.c
src/polyp/context.h
src/polyp/def.h

index e2d9d33d20d1a068624f5b882c00ec0287d5dd3f..b174b505ce0b95ba9e1dc896046c911fbe66262a 100644 (file)
@@ -593,7 +593,7 @@ finish:
     pa_context_unref(c);
 }
 
-int pa_context_connect(pa_context *c, const char *server, int spawn, const pa_spawn_api *api) {
+int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api) {
     int r = -1;
     assert(c && c->ref >= 1 && c->state == PA_CONTEXT_UNCONNECTED);
 
@@ -632,7 +632,7 @@ int pa_context_connect(pa_context *c, const char *server, int spawn, const pa_sp
         c->server_list = pa_strlist_prepend(c->server_list, pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET, ufn, sizeof(ufn)));
 
         /* Wrap the connection attempts in a single transaction for sane autospawn locking */
-        if (spawn && c->conf->autospawn) {
+        if (!(flags & PA_CONTEXT_NOAUTOSPAWN) && c->conf->autospawn) {
             char lf[PATH_MAX];
 
             pa_runtime_path(AUTOSPAWN_LOCK, lf, sizeof(lf));
index 1c06c4342f1cd42dbf536850b71cb7e81b58364f..a299400ae696dcb8b5fb0464f661754044a812a1 100644 (file)
@@ -84,11 +84,11 @@ pa_context_state_t pa_context_get_state(pa_context *c);
 /** Connect the context to the specified server. If server is NULL,
 connect to the default server. This routine may but will not always
 return synchronously on error. Use pa_context_set_state_callback() to
-be notified when the connection is established. If spawn is non-zero
-and no specific server is specified or accessible a new daemon is
-spawned. If api is non-NULL, the functions specified in the structure
-are used when forking a new child process. */
-int pa_context_connect(pa_context *c, const char *server, int spawn, const pa_spawn_api *api);
+be notified when the connection is established. If flags doesn't have
+PA_NOAUTOSPAWN set and no specific server is specified or accessible a
+new daemon is spawned. If api is non-NULL, the functions specified in
+the structure are used when forking a new child process. */
+int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api);
 
 /** Terminate the context connection immediately */
 void pa_context_disconnect(pa_context *c);
index f8e0bed42d11fb34e71032d0e7dfa7924bad12fd..e94da25309faee147dce9c11f769bf4d5c74813a 100644 (file)
@@ -64,6 +64,11 @@ typedef enum pa_operation_state {
 /** An invalid index */
 #define PA_INVALID_INDEX ((uint32_t) -1)
 
+/** Some special flags for contexts. \ since 0.8 */
+typedef enum pa_context_flags {
+    PA_CONTEXT_NOAUTOSPAWN = 1 /**< Disabled autospawning of the polypaudio daemon if required */
+} pa_context_flags_t;
+
 /** The direction of a pa_stream object */ 
 typedef enum pa_stream_direction {
     PA_STREAM_NODIRECTION,   /**< Invalid direction */