Logo Search packages:      
Sourcecode: pulseaudio version File versions

pa_operation* pa_context_play_sample_with_proplist ( pa_context c,
const char *  name,
const char *  dev,
pa_volume_t  volume,
pa_proplist *  proplist,
pa_context_play_sample_cb_t  cb,
void *  userdata 
)

Play a sample from the sample cache to the specified device, allowing specification of a property list for the playback stream. If the latter is NULL use the default sink. Returns an operation object.

Since:
0.9.11
Parameters:
c  Context
name  Name of the sample to play
dev  Sink to play this sample on
volume  Volume to play this sample with. Starting with 0.9.15 you may pass here (pa_volume_t) -1 which will leave the decision about the volume to the server side which is a good idea.
proplist  Property list for this sound. The property list of the cached entry will be merged into this property list
cb  Call this function after successfully starting playback, or NULL
userdata  Userdata to pass to the callback

Definition at line 208 of file scache.c.

References PA_CONTEXT_READY, PA_ERR_BADSTATE, PA_ERR_INVALID, PA_ERR_NOTSUPPORTED, PA_INVALID_INDEX, PA_VOLUME_NORM, and pa_volume_t.

                                                                                                                                                                                         {
    pa_operation *o;
    pa_tagstruct *t;
    uint32_t tag;

    pa_assert(c);
    pa_assert(PA_REFCNT_VALUE(c) >= 1);

    PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
    PA_CHECK_VALIDITY_RETURN_NULL(c, name && *name, PA_ERR_INVALID);
    PA_CHECK_VALIDITY_RETURN_NULL(c, !dev || *dev, PA_ERR_INVALID);
    PA_CHECK_VALIDITY_RETURN_NULL(c, p, PA_ERR_INVALID);
    PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 13, PA_ERR_NOTSUPPORTED);

    o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);

    if (!dev)
        dev = c->conf->default_sink;

    t = pa_tagstruct_command(c, PA_COMMAND_PLAY_SAMPLE, &tag);
    pa_tagstruct_putu32(t, PA_INVALID_INDEX);
    pa_tagstruct_puts(t, dev);

    if (volume == (pa_volume_t) -1 && c->version < 15)
        volume = PA_VOLUME_NORM;

    pa_tagstruct_putu32(t, volume);
    pa_tagstruct_puts(t, name);
    pa_tagstruct_put_proplist(t, p);

    pa_pstream_send_tagstruct(c->pstream, t);
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, play_sample_with_proplist_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);

    return o;
}


Generated by  Doxygen 1.6.0   Back to index