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

int pa_stream_peek ( pa_stream p,
const void **  data,
size_t *  bytes 
)

Read the next fragment from the buffer (for recording). data will point to the actual data and length will contain the size of the data in bytes (which can be less than a complete framgnet). Use pa_stream_drop() to actually remove the data from the buffer. If no data is available will return a NULL pointer

Since:
0.8
Parameters:
p  The stream to use
data  Pointer to pointer that will point to data
bytes  The length of the data read in bytes

Definition at line 896 of file stream.c.

References PA_ERR_BADSTATE, PA_STREAM_READY, and PA_STREAM_RECORD.

                                                                    {
    pa_assert(s);
    pa_assert(PA_REFCNT_VALUE(s) >= 1);
    pa_assert(data);
    pa_assert(length);

    PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
    PA_CHECK_VALIDITY(s->context, s->direction == PA_STREAM_RECORD, PA_ERR_BADSTATE);

    if (!s->peek_memchunk.memblock) {

        if (pa_memblockq_peek(s->record_memblockq, &s->peek_memchunk) < 0) {
            *data = NULL;
            *length = 0;
            return 0;
        }

        s->peek_data = pa_memblock_acquire(s->peek_memchunk.memblock);
    }

    pa_assert(s->peek_data);
    *data = (uint8_t*) s->peek_data + s->peek_memchunk.index;
    *length = s->peek_memchunk.length;
    return 0;
}


Generated by  Doxygen 1.6.0   Back to index