Logo Search packages:      
Sourcecode: pulseaudio version File versions

pa_context* pa_context_new_with_proplist ( pa_mainloop_api mainloop,
const char *  name,
pa_proplist *  proplist 
)

Instantiate a new connection context with an abstract mainloop API and an application name, and specify the the initial client property list.

Since:
0.9.11

Definition at line 126 of file context.c.

References PA_CONTEXT_UNCONNECTED, PA_INVALID_INDEX, PA_OK, and pa_xnew.

                                                                                                      {
    pa_context *c;

    pa_assert(mainloop);

    if (pa_detect_fork())
        return NULL;

    pa_init_i18n();

    c = pa_xnew(pa_context, 1);
    PA_REFCNT_INIT(c);

    c->proplist = p ? pa_proplist_copy(p) : pa_proplist_new();

    if (name)
        pa_proplist_sets(c->proplist, PA_PROP_APPLICATION_NAME, name);

    c->mainloop = mainloop;
    c->client = NULL;
    c->pstream = NULL;
    c->pdispatch = NULL;
    c->playback_streams = pa_dynarray_new();
    c->record_streams = pa_dynarray_new();
    c->client_index = PA_INVALID_INDEX;

    PA_LLIST_HEAD_INIT(pa_stream, c->streams);
    PA_LLIST_HEAD_INIT(pa_operation, c->operations);

    c->error = PA_OK;
    c->state = PA_CONTEXT_UNCONNECTED;
    c->ctag = 0;
    c->csyncid = 0;

    reset_callbacks(c);

    c->is_local = FALSE;
    c->server_list = NULL;
    c->server = NULL;

    c->do_shm = FALSE;

    c->do_autospawn = FALSE;
    memset(&c->spawn_api, 0, sizeof(c->spawn_api));

#ifndef MSG_NOSIGNAL
#ifdef SIGPIPE
    pa_check_signal_is_blocked(SIGPIPE);
#endif
#endif

    c->conf = pa_client_conf_new();
#ifdef HAVE_X11
    pa_client_conf_from_x11(c->conf, NULL);
#endif
    pa_client_conf_load(c->conf, NULL);
    pa_client_conf_env(c->conf);

    if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm, c->conf->shm_size))) {

        if (!c->conf->disable_shm)
            c->mempool = pa_mempool_new(FALSE, c->conf->shm_size);

        if (!c->mempool) {
            context_free(c);
            return NULL;
        }
    }

    return c;
}


Generated by  Doxygen 1.6.0   Back to index