Logo Search packages:      
Sourcecode: pulseaudio version File versions

pa_operation* pa_stream_cork ( pa_stream s,
int  b,
pa_stream_success_cb_t  cb,
void *  userdata 
)

Pause (or resume) playback of this stream temporarily. Available on both playback and recording streams. If b is 1 the stream is paused. If b is 0 the stream is resumed. The pause/resume operation is executed as quickly as possible. If a cork is very quickly followed by an uncork or the other way round this might not actually have any effect on the stream that is output. You can use pa_stream_is_corked() to find out whether the stream is currently paused or not. Normally a stream will be created in uncorked state. If you pass PA_STREAM_START_CORKED as flag during connection of the stream it will be created in corked state.

Definition at line 2003 of file stream.c.

References PA_ERR_BADSTATE, PA_ERR_FORKED, PA_STREAM_PLAYBACK, PA_STREAM_READY, and PA_STREAM_UPLOAD.

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

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

    PA_CHECK_VALIDITY_RETURN_NULL(s->context, !pa_detect_fork(), PA_ERR_FORKED);
    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);

    s->corked = b;

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

    t = pa_tagstruct_command(
            s->context,
            (uint32_t) (s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_CORK_PLAYBACK_STREAM : PA_COMMAND_CORK_RECORD_STREAM),
            &tag);
    pa_tagstruct_putu32(t, s->channel);
    pa_tagstruct_put_boolean(t, !!b);
    pa_pstream_send_tagstruct(s->context->pstream, t);
    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);

    check_smoother_status(s, FALSE, FALSE, FALSE);

    /* This might cause the indexes to hang/start again, hence
     * let's request a timing update */
    request_auto_timing_update(s, TRUE);

    return o;
}


Generated by  Doxygen 1.6.0   Back to index