Esempio n. 1
0
int main(int argc, char *argv[]) {
    pa_queue *q;

    pa_assert_se(q = pa_queue_new());

    pa_assert(pa_queue_is_empty(q));

    pa_queue_push(q, (void*) "eins");
    pa_log("%s\n", (char*) pa_queue_pop(q));

    pa_assert(pa_queue_is_empty(q));

    pa_queue_push(q, (void*) "zwei");
    pa_queue_push(q, (void*) "drei");
    pa_queue_push(q, (void*) "vier");

    pa_log("%s\n", (char*) pa_queue_pop(q));
    pa_log("%s\n", (char*) pa_queue_pop(q));

    pa_queue_push(q, (void*) "fuenf");

    pa_log("%s\n", (char*) pa_queue_pop(q));
    pa_log("%s\n", (char*) pa_queue_pop(q));

    pa_assert(pa_queue_is_empty(q));

    pa_queue_push(q, (void*) "sechs");
    pa_queue_push(q, (void*) "sieben");

    pa_queue_free(q, NULL, NULL);

    return 0;
}
static void cmtspeech_dl_sideinfo_flush(struct userdata *u) {
    pa_assert(u);
    ENTER();

    while (pa_queue_pop(u->local_sideinfoq))
        ;

    if (u->voice_sideinfoq) {
        while (pa_queue_pop(u->voice_sideinfoq))
            ;
    }
}
Esempio n. 3
0
void pa_queue_free(pa_queue *q, pa_free_cb_t free_func) {
    void *data;
    pa_assert(q);

    while ((data = pa_queue_pop(q)))
        if (free_func)
            free_func(data);

    pa_assert(!q->front);
    pa_assert(!q->back);
    pa_assert(q->length == 0);

    pa_xfree(q);
}
static void cmtspeech_dl_sideinfo_drop(struct userdata *u, int length) {

    pa_assert(u);
    pa_assert(length % u->dl_frame_size == 0);

    if (NULL == u->voice_sideinfoq)
        return;

    while (length) {
        pa_queue_pop(u->local_sideinfoq);
        length -= u->dl_frame_size;
    }

    u->continuous_dl_stream = FALSE;
}
static void cmtspeech_dl_sideinfo_forward(struct userdata *u) {
    unsigned int spc_flags = 0;

    pa_assert(u);

    if (NULL == u->voice_sideinfoq)
        return;

    spc_flags = PA_PTR_TO_UINT(pa_queue_pop(u->local_sideinfoq));

    if (spc_flags == 0) {
        pa_log_warn("Local sideinfo queue empty.");
        spc_flags = VOICE_SIDEINFO_FLAG_BAD|VOICE_SIDEINFO_FLAG_BOGUS;
    }
    else if (!u->continuous_dl_stream)
        spc_flags |= VOICE_SIDEINFO_FLAG_BAD;

    u->continuous_dl_stream = TRUE;

    pa_queue_push(u->voice_sideinfoq, PA_UINT_TO_PTR(spc_flags));
}