Logo Search packages:      
Sourcecode: pulseaudio version File versions

int pa_simple_flush ( pa_simple s,
int *  error 
)

Flush the playback buffer.

Since:
0.5

Definition at line 392 of file simple.c.

References pa_simple::direction, pa_simple::mainloop, pa_simple::operation_success, PA_ERR_BADSTATE, PA_OPERATION_DONE, PA_STREAM_PLAYBACK, and pa_simple::stream.

                                               {
    pa_operation *o = NULL;

    assert(p);

    CHECK_VALIDITY_RETURN_ANY(rerror, p->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE, -1);

    pa_threaded_mainloop_lock(p->mainloop);
    CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);

    o = pa_stream_flush(p->stream, success_cb, p);
    CHECK_SUCCESS_GOTO(p, rerror, o, unlock_and_fail);

    p->operation_success = 0;
    while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
        pa_threaded_mainloop_wait(p->mainloop);
        CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
    }
    CHECK_SUCCESS_GOTO(p, rerror, p->operation_success, unlock_and_fail);

    pa_operation_unref(o);
    pa_threaded_mainloop_unlock(p->mainloop);

    return 0;

unlock_and_fail:

    if (o) {
        pa_operation_cancel(o);
        pa_operation_unref(o);
    }

    pa_threaded_mainloop_unlock(p->mainloop);
    return -1;
}


Generated by  Doxygen 1.6.0   Back to index