Logo Search packages:      
Sourcecode: pulseaudio version File versions  Download package

pa_operation* pa_stream_set_buffer_attr ( pa_stream s,
const pa_buffer_attr attr,
pa_stream_success_cb_t  cb,
void *  userdata 
)

Change the buffer metrics of the stream during playback. The server might have chosen different buffer metrics then requested. The selected metrics may be queried with pa_stream_get_buffer_attr() as soon as the callback is called. Only valid after the stream has been connected successfully and if the server is at least PulseAudio 0.9.8.

Since:
0.9.8

Definition at line 1698 of file stream.c.

References pa_buffer_attr::fragsize, pa_buffer_attr::maxlength, pa_buffer_attr::minreq, PA_ERR_BADSTATE, PA_ERR_NOTSUPPORTED, PA_STREAM_PLAYBACK, PA_STREAM_READY, PA_STREAM_RECORD, PA_STREAM_UPLOAD, pa_buffer_attr::prebuf, and pa_buffer_attr::tlength.

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

    pa_assert(s);
    pa_assert(PA_REFCNT_VALUE(s) >= 1);
    pa_assert(attr);

    PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
    PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
    PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->context->version >= 12, PA_ERR_NOTSUPPORTED);

    o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);

    t = pa_tagstruct_command(
            s->context,
            s->direction == PA_STREAM_RECORD ? PA_COMMAND_SET_RECORD_STREAM_BUFFER_ATTR : PA_COMMAND_SET_PLAYBACK_STREAM_BUFFER_ATTR,
            &tag);
    pa_tagstruct_putu32(t, s->channel);

    pa_tagstruct_putu32(t, attr->maxlength);

    if (s->direction == PA_STREAM_PLAYBACK)
        pa_tagstruct_put(
                t,
                PA_TAG_U32, attr->tlength,
                PA_TAG_U32, attr->prebuf,
                PA_TAG_U32, attr->minreq,
                PA_TAG_INVALID);
    else
        pa_tagstruct_putu32(t, attr->fragsize);

    pa_pstream_send_tagstruct(s->context->pstream, t);
    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_set_buffer_attr_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);

    return o;
}


Generated by  Doxygen 1.6.0   Back to index