mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Huge trailing whitespace cleanup. Let's keep the tree pure from here on,
mmmkay? git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
1a460ee40a
commit
521daf6f0a
283 changed files with 3742 additions and 3742 deletions
|
|
@ -11,23 +11,23 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
pa_channel_map map, map2;
|
||||
|
||||
pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_AIFF);
|
||||
|
||||
|
||||
fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
|
||||
|
||||
pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_AUX);
|
||||
|
||||
|
||||
fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
|
||||
|
||||
pa_channel_map_init_auto(&map, 6, PA_CHANNEL_MAP_ALSA);
|
||||
|
||||
|
||||
fprintf(stderr, "map: <%s>\n", pa_channel_map_snprint(cm, sizeof(cm), &map));
|
||||
|
||||
|
||||
pa_channel_map_parse(&map2, cm);
|
||||
|
||||
assert(pa_channel_map_equal(&map, &map2));
|
||||
|
||||
pa_channel_map_parse(&map2, "left,test");
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -47,7 +47,7 @@ static time_t start;
|
|||
static void func(pa_mainloop_api *m, PA_GCC_UNUSED pa_signal_event *e, PA_GCC_UNUSED int sig, PA_GCC_UNUSED void *userdata) {
|
||||
time_t now;
|
||||
time(&now);
|
||||
|
||||
|
||||
if ((now - start) >= 30) {
|
||||
m->quit(m, 1);
|
||||
fprintf(stderr, "Test failed\n");
|
||||
|
|
@ -59,7 +59,7 @@ static void func(pa_mainloop_api *m, PA_GCC_UNUSED pa_signal_event *e, PA_GCC_UN
|
|||
|
||||
int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
||||
pa_mainloop *m;
|
||||
|
||||
|
||||
m = pa_mainloop_new();
|
||||
assert(m);
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
for (;;) {
|
||||
time_t now;
|
||||
time(&now);
|
||||
|
||||
|
||||
if ((now - start) >= 30) {
|
||||
fprintf(stderr, "Test failed\n");
|
||||
break;
|
||||
|
|
@ -86,7 +86,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
#endif
|
||||
|
||||
pa_cpu_limit_done();
|
||||
|
||||
|
||||
pa_mainloop_free(m);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -41,7 +41,7 @@ static int quit = 0;
|
|||
|
||||
static void spin(void) {
|
||||
int k;
|
||||
|
||||
|
||||
/* Spin a little */
|
||||
k = rand() % 10000;
|
||||
for (; k > 0; k--)
|
||||
|
|
@ -100,6 +100,6 @@ int main(int argc, char* argv[]) {
|
|||
pa_thread_free(threads[i]);
|
||||
|
||||
pa_flist_free(flist, pa_xfree);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot1");
|
||||
slot = pa_hook_connect(&hook, (pa_hook_cb_t) func2, (void*) "slot2");
|
||||
pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot3");
|
||||
|
||||
|
||||
pa_hook_fire(&hook, (void*) "call1");
|
||||
|
||||
pa_hook_slot_free(slot);
|
||||
|
|
@ -30,6 +30,6 @@ int main(int argc, char *argv[]) {
|
|||
pa_hook_fire(&hook, (void*) "call2");
|
||||
|
||||
pa_hook_free(&hook);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -57,7 +57,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
case PA_CONTEXT_AUTHORIZING:
|
||||
case PA_CONTEXT_SETTING_NAME:
|
||||
break;
|
||||
|
||||
|
||||
case PA_CONTEXT_READY: {
|
||||
|
||||
static const pa_sample_spec ss = {
|
||||
|
|
@ -65,18 +65,18 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
.rate = 44100,
|
||||
.channels = 1
|
||||
};
|
||||
|
||||
|
||||
fprintf(stderr, "Connection established.\n");
|
||||
|
||||
stream = pa_stream_new(c, "interpol-test", &ss, NULL);
|
||||
assert(stream);
|
||||
|
||||
|
||||
pa_stream_connect_playback(stream, NULL, NULL, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL);
|
||||
pa_stream_set_write_callback(stream, stream_write_cb, NULL);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case PA_CONTEXT_TERMINATED:
|
||||
break;
|
||||
|
||||
|
|
@ -108,19 +108,19 @@ int main(int argc, char *argv[]) {
|
|||
assert(r >= 0);
|
||||
|
||||
pa_gettimeofday(&start);
|
||||
|
||||
|
||||
pa_threaded_mainloop_start(m);
|
||||
|
||||
for (k = 0; k < 5000; k++) {
|
||||
int success = 0, changed = 0;
|
||||
pa_usec_t t, rtc;
|
||||
struct timeval now, tv;
|
||||
|
||||
|
||||
pa_threaded_mainloop_lock(m);
|
||||
|
||||
if (stream) {
|
||||
const pa_timing_info *info;
|
||||
|
||||
|
||||
if (pa_stream_get_time(stream, &t) >= 0)
|
||||
success = 1;
|
||||
|
||||
|
|
@ -130,9 +130,9 @@ int main(int argc, char *argv[]) {
|
|||
last_info = info->timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pa_threaded_mainloop_unlock(m);
|
||||
|
||||
|
||||
if (success) {
|
||||
pa_gettimeofday(&now);
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_stream_disconnect(stream);
|
||||
pa_stream_unref(stream);
|
||||
}
|
||||
|
||||
|
||||
if (context) {
|
||||
pa_context_disconnect(context);
|
||||
pa_context_unref(context);
|
||||
|
|
@ -164,6 +164,6 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if (m)
|
||||
pa_threaded_mainloop_free(m);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ int main(int argc, char *argv[]) {
|
|||
int r;
|
||||
pa_ip_acl *acl;
|
||||
|
||||
fd = socket(PF_INET, SOCK_STREAM, 0);
|
||||
fd = socket(PF_INET, SOCK_STREAM, 0);
|
||||
assert(fd >= 0);
|
||||
|
||||
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(22);
|
||||
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
|
||||
|
||||
r = connect(fd, (struct sockaddr*) &sa, sizeof(sa));
|
||||
assert(r >= 0);
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ int main(int argc, char *argv[]) {
|
|||
assert(acl);
|
||||
printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
|
||||
pa_ip_acl_free(acl);
|
||||
|
||||
|
||||
acl = pa_ip_acl_new("127.0.0.2");
|
||||
assert(acl);
|
||||
printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
|
||||
|
|
@ -86,7 +86,7 @@ int main(int argc, char *argv[]) {
|
|||
assert(acl);
|
||||
printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
|
||||
pa_ip_acl_free(acl);
|
||||
|
||||
|
||||
close(fd);
|
||||
|
||||
fd = socket(PF_INET6, SOCK_STREAM, 0);
|
||||
|
|
@ -96,7 +96,7 @@ int main(int argc, char *argv[]) {
|
|||
sa6.sin6_family = AF_INET6;
|
||||
sa6.sin6_port = htons(22);
|
||||
inet_pton(AF_INET6, "::1", &sa6.sin6_addr);
|
||||
|
||||
|
||||
r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
|
||||
assert(r >= 0);
|
||||
|
||||
|
|
@ -131,6 +131,6 @@ int main(int argc, char *argv[]) {
|
|||
pa_ip_acl_free(acl);
|
||||
|
||||
close(fd);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -121,6 +121,6 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
#else
|
||||
pa_mainloop_free(m);
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -45,7 +45,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
p = pa_mempool_new(0);
|
||||
|
||||
a = pa_mcalign_new(11);
|
||||
|
||||
|
||||
pa_memchunk_reset(&c);
|
||||
|
||||
srand(time(NULL));
|
||||
|
|
@ -64,7 +64,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
l = c.memblock->length - c.index;
|
||||
|
||||
l = l <= 1 ? l : rand() % (l-1) +1 ;
|
||||
|
||||
|
||||
if ((r = read(STDIN_FILENO, (uint8_t*) c.memblock->data + c.index, l)) <= 0) {
|
||||
fprintf(stderr, "read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
|
|||
size_t offset, size;
|
||||
|
||||
const char txt[] = "This is a test!";
|
||||
|
||||
|
||||
pool_a = pa_mempool_new(1);
|
||||
pool_b = pa_mempool_new(1);
|
||||
pool_c = pa_mempool_new(1);
|
||||
|
|
@ -86,9 +86,9 @@ int main(int argc, char *argv[]) {
|
|||
pa_mempool_get_shm_id(pool_a, &id_a);
|
||||
pa_mempool_get_shm_id(pool_b, &id_b);
|
||||
pa_mempool_get_shm_id(pool_c, &id_c);
|
||||
|
||||
|
||||
assert(pool_a && pool_b && pool_c);
|
||||
|
||||
|
||||
blocks[0] = pa_memblock_new_fixed(pool_a, (void*) txt, sizeof(txt), 1);
|
||||
blocks[1] = pa_memblock_new(pool_a, sizeof(txt));
|
||||
snprintf(blocks[1]->data, blocks[1]->length, "%s", txt);
|
||||
|
|
@ -102,23 +102,23 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
mb_a = blocks[i];
|
||||
assert(mb_a);
|
||||
|
||||
|
||||
export_a = pa_memexport_new(pool_a, revoke_cb, (void*) "A");
|
||||
export_b = pa_memexport_new(pool_b, revoke_cb, (void*) "B");
|
||||
|
||||
|
||||
assert(export_a && export_b);
|
||||
|
||||
|
||||
import_b = pa_memimport_new(pool_b, release_cb, (void*) "B");
|
||||
import_c = pa_memimport_new(pool_c, release_cb, (void*) "C");
|
||||
|
||||
|
||||
assert(import_b && import_c);
|
||||
|
||||
|
||||
r = pa_memexport_put(export_a, mb_a, &id, &shm_id, &offset, &size);
|
||||
assert(r >= 0);
|
||||
assert(shm_id == id_a);
|
||||
|
||||
printf("A: Memory block exported as %u\n", id);
|
||||
|
||||
|
||||
mb_b = pa_memimport_get(import_b, id, shm_id, offset, size);
|
||||
assert(mb_b);
|
||||
r = pa_memexport_put(export_b, mb_b, &id, &shm_id, &offset, &size);
|
||||
|
|
@ -127,7 +127,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_memblock_unref(mb_b);
|
||||
|
||||
printf("B: Memory block exported as %u\n", id);
|
||||
|
||||
|
||||
mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
|
||||
assert(mb_c);
|
||||
printf("1 data=%s\n", (char*) mb_c->data);
|
||||
|
|
@ -135,21 +135,21 @@ int main(int argc, char *argv[]) {
|
|||
print_stats(pool_a, "A");
|
||||
print_stats(pool_b, "B");
|
||||
print_stats(pool_c, "C");
|
||||
|
||||
|
||||
pa_memexport_free(export_b);
|
||||
printf("2 data=%s\n", (char*) mb_c->data);
|
||||
pa_memblock_unref(mb_c);
|
||||
|
||||
|
||||
pa_memimport_free(import_b);
|
||||
|
||||
|
||||
pa_memblock_unref(mb_a);
|
||||
|
||||
|
||||
pa_memimport_free(import_c);
|
||||
pa_memexport_free(export_a);
|
||||
}
|
||||
|
||||
printf("vaccuuming...\n");
|
||||
|
||||
|
||||
pa_mempool_vacuum(pool_a);
|
||||
pa_mempool_vacuum(pool_b);
|
||||
pa_mempool_vacuum(pool_c);
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_log_set_maximal_level(PA_LOG_DEBUG);
|
||||
|
||||
p = pa_mempool_new(0);
|
||||
|
||||
|
||||
silence = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
|
||||
assert(silence);
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ int main(int argc, char *argv[]) {
|
|||
chunk1.index = 0;
|
||||
chunk1.length = 2;
|
||||
assert(chunk1.memblock);
|
||||
|
||||
|
||||
chunk2.memblock = pa_memblock_new_fixed(p, (char*) "TTBB", 4, 1);
|
||||
chunk2.index = 2;
|
||||
chunk2.length = 2;
|
||||
|
|
@ -70,13 +70,13 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
ret = pa_memblockq_push(bq, &chunk1);
|
||||
assert(ret == 0);
|
||||
|
||||
|
||||
ret = pa_memblockq_push(bq, &chunk1);
|
||||
assert(ret == 0);
|
||||
|
||||
|
||||
ret = pa_memblockq_push(bq, &chunk2);
|
||||
assert(ret == 0);
|
||||
|
||||
|
||||
ret = pa_memblockq_push(bq, &chunk2);
|
||||
assert(ret == 0);
|
||||
|
||||
|
|
@ -115,19 +115,19 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
chunk3.index += 2;
|
||||
chunk3.length -= 2;
|
||||
|
||||
|
||||
ret = pa_memblockq_push(bq, &chunk3);
|
||||
assert(ret == 0);
|
||||
|
||||
|
||||
printf(">");
|
||||
|
||||
pa_memblockq_shorten(bq, 6);
|
||||
|
||||
|
||||
for (;;) {
|
||||
pa_memchunk out;
|
||||
char *e;
|
||||
size_t n;
|
||||
|
||||
|
||||
if (pa_memblockq_peek(bq, &out) < 0)
|
||||
break;
|
||||
|
||||
|
|
@ -137,15 +137,15 @@ int main(int argc, char *argv[]) {
|
|||
pa_memblock_unref(out.memblock);
|
||||
pa_memblockq_drop(bq, &out, out.length);
|
||||
}
|
||||
|
||||
|
||||
printf("<\n");
|
||||
|
||||
|
||||
pa_memblockq_free(bq);
|
||||
pa_memblock_unref(silence);
|
||||
pa_memblock_unref(chunk1.memblock);
|
||||
pa_memblock_unref(chunk2.memblock);
|
||||
pa_memblock_unref(chunk3.memblock);
|
||||
pa_memblock_unref(chunk4.memblock);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -43,7 +43,7 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
|
|||
.rate = 44100,
|
||||
.channels = 2
|
||||
};
|
||||
|
||||
|
||||
pa_simple *s = NULL;
|
||||
int ret = 1;
|
||||
int error;
|
||||
|
|
@ -61,10 +61,10 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
|
|||
fprintf(stderr, __FILE__": dup2() failed: %s\n", strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
/* Create a new playback stream */
|
||||
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, NULL, &error))) {
|
||||
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
|
||||
|
|
@ -90,7 +90,7 @@ int main(PA_GCC_UNUSED int argc, char*argv[]) {
|
|||
if ((r = read(STDIN_FILENO, buf, sizeof(buf))) <= 0) {
|
||||
if (r == 0) /* EOF */
|
||||
break;
|
||||
|
||||
|
||||
fprintf(stderr, __FILE__": read() failed: %s\n", strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
|
@ -114,6 +114,6 @@ finish:
|
|||
|
||||
if (s)
|
||||
pa_simple_free(s);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -46,7 +46,7 @@ static ssize_t loop_write(int fd, const void*data, size_t size) {
|
|||
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
|
||||
ret += r;
|
||||
data = (const uint8_t*) data + r;
|
||||
size -= r;
|
||||
|
|
@ -95,6 +95,6 @@ finish:
|
|||
|
||||
if (s)
|
||||
pa_simple_free(s);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char* argv[]) {
|
|||
|
||||
t = pa_strlist_tostring(l);
|
||||
pa_strlist_free(l);
|
||||
|
||||
|
||||
fprintf(stderr, "1: %s\n", t);
|
||||
|
||||
l = pa_strlist_parse(t);
|
||||
|
|
@ -29,9 +29,9 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char* argv[]) {
|
|||
l = pa_strlist_pop(l, &u);
|
||||
fprintf(stderr, "3: %s\n", u);
|
||||
pa_xfree(u);
|
||||
|
||||
|
||||
l = pa_strlist_remove(l, "c");
|
||||
|
||||
|
||||
t = pa_strlist_tostring(l);
|
||||
fprintf(stderr, "4: %s\n", t);
|
||||
pa_xfree(t);
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -67,7 +67,7 @@ static void underflow_cb(struct pa_stream *s, void *userdata) {
|
|||
int i = (int) (long) userdata;
|
||||
|
||||
fprintf(stderr, "Stream %i finished\n", i);
|
||||
|
||||
|
||||
if (++n_streams_ready >= 2*NSTREAMS) {
|
||||
fprintf(stderr, "We're done\n");
|
||||
mainloop_api->quit(mainloop_api, 0);
|
||||
|
|
@ -89,19 +89,19 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
|
|||
int r, i = (int) (long) userdata;
|
||||
|
||||
fprintf(stderr, "Writing data to stream %i.\n", i);
|
||||
|
||||
|
||||
r = pa_stream_write(s, data, sizeof(data), nop_free_cb, sizeof(data) * i, PA_SEEK_ABSOLUTE);
|
||||
assert(r == 0);
|
||||
|
||||
/* Be notified when this stream is drained */
|
||||
pa_stream_set_underflow_callback(s, underflow_cb, userdata);
|
||||
|
||||
|
||||
/* All streams have been set up, let's go! */
|
||||
if (++n_streams_ready >= NSTREAMS) {
|
||||
fprintf(stderr, "Uncorking\n");
|
||||
pa_operation_unref(pa_stream_cork(s, 0, NULL, NULL));
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
case PA_CONTEXT_AUTHORIZING:
|
||||
case PA_CONTEXT_SETTING_NAME:
|
||||
break;
|
||||
|
||||
|
||||
case PA_CONTEXT_READY: {
|
||||
|
||||
int i;
|
||||
|
|
@ -131,18 +131,18 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
char name[64];
|
||||
|
||||
fprintf(stderr, "Creating stream %i\n", i);
|
||||
|
||||
|
||||
snprintf(name, sizeof(name), "stream #%i", i);
|
||||
|
||||
|
||||
streams[i] = pa_stream_new(c, name, &sample_spec, NULL);
|
||||
assert(streams[i]);
|
||||
pa_stream_set_state_callback(streams[i], stream_state_callback, (void*) (long) i);
|
||||
pa_stream_connect_playback(streams[i], NULL, &buffer_attr, PA_STREAM_START_CORKED, NULL, i == 0 ? NULL : streams[0]);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case PA_CONTEXT_TERMINATED:
|
||||
mainloop_api->quit(mainloop_api, 0);
|
||||
break;
|
||||
|
|
@ -163,7 +163,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
for (i = 0; i < NSTREAMS; i++)
|
||||
streams[i] = NULL;
|
||||
|
||||
|
||||
/* Set up a new main loop */
|
||||
m = pa_mainloop_new();
|
||||
assert(m);
|
||||
|
|
@ -187,6 +187,6 @@ int main(int argc, char *argv[]) {
|
|||
pa_stream_unref(streams[i]);
|
||||
|
||||
pa_mainloop_free(m);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -53,19 +53,19 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
pa_threaded_mainloop_start(m);
|
||||
|
||||
pa_threaded_mainloop_lock(m);
|
||||
|
||||
|
||||
pa_gettimeofday(&tv);
|
||||
tv.tv_sec += 5;
|
||||
a->time_new(a, &tv, tcb, m);
|
||||
|
||||
|
||||
fprintf(stderr, "waiting 5s (signal)\n");
|
||||
pa_threaded_mainloop_wait(m);
|
||||
fprintf(stderr, "wait completed\n");
|
||||
pa_threaded_mainloop_accept(m);
|
||||
fprintf(stderr, "signal accepted\n");
|
||||
|
||||
|
||||
pa_threaded_mainloop_unlock(m);
|
||||
|
||||
|
||||
fprintf(stderr, "waiting 5s (sleep)\n");
|
||||
pa_msleep(5000);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -48,7 +48,7 @@ static void thread_func(void *data) {
|
|||
pa_tls_set(tls, data);
|
||||
|
||||
pa_log("thread_func() for %s starting...", (char*) pa_tls_get(tls));
|
||||
|
||||
|
||||
pa_mutex_lock(mutex);
|
||||
|
||||
for (;;) {
|
||||
|
|
@ -57,13 +57,13 @@ static void thread_func(void *data) {
|
|||
pa_log("%s waiting ...", (char*) pa_tls_get(tls));
|
||||
|
||||
for (;;) {
|
||||
|
||||
|
||||
if (magic_number < 0)
|
||||
goto quit;
|
||||
|
||||
if (magic_number != 0)
|
||||
break;
|
||||
|
||||
|
||||
pa_cond_wait(cond1, mutex);
|
||||
}
|
||||
|
||||
|
|
@ -75,18 +75,18 @@ static void thread_func(void *data) {
|
|||
pa_once(&once, once_func);
|
||||
|
||||
pa_cond_signal(cond2, 0);
|
||||
|
||||
|
||||
pa_log("%s got number %i", (char*) pa_tls_get(tls), k);
|
||||
|
||||
|
||||
/* Spin! */
|
||||
for (n = 0; n < k; n++)
|
||||
pa_thread_yield();
|
||||
|
||||
|
||||
pa_mutex_lock(mutex);
|
||||
}
|
||||
|
||||
quit:
|
||||
|
||||
|
||||
pa_mutex_unlock(mutex);
|
||||
|
||||
pa_log("thread_func() for %s done...", (char*) pa_tls_get(tls));
|
||||
|
|
@ -97,25 +97,25 @@ int main(int argc, char *argv[]) {
|
|||
pa_thread* t[THREADS_MAX];
|
||||
|
||||
assert(pa_thread_is_running(pa_thread_self()));
|
||||
|
||||
|
||||
mutex = pa_mutex_new(0);
|
||||
cond1 = pa_cond_new();
|
||||
cond2 = pa_cond_new();
|
||||
tls = pa_tls_new(pa_xfree);
|
||||
|
||||
|
||||
for (i = 0; i < THREADS_MAX; i++) {
|
||||
t[i] = pa_thread_new(thread_func, pa_sprintf_malloc("Thread #%i", i+1));
|
||||
assert(t[i]);
|
||||
}
|
||||
|
||||
pa_mutex_lock(mutex);
|
||||
|
||||
|
||||
pa_log("loop-init");
|
||||
|
||||
for (k = 0; k < 100; k++) {
|
||||
assert(magic_number == 0);
|
||||
|
||||
|
||||
|
||||
magic_number = (int) rand() % 0x10000;
|
||||
|
||||
pa_log("iteration %i (%i)", k, magic_number);
|
||||
|
|
@ -126,10 +126,10 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
pa_log("loop-exit");
|
||||
|
||||
|
||||
magic_number = -1;
|
||||
pa_cond_signal(cond1, 1);
|
||||
|
||||
|
||||
pa_mutex_unlock(mutex);
|
||||
|
||||
for (i = 0; i < THREADS_MAX; i++)
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *c;
|
||||
|
||||
|
||||
assert(pa_utf8_valid("hallo"));
|
||||
assert(pa_utf8_valid("hallo\n"));
|
||||
assert(!pa_utf8_valid("hüpfburg\n"));
|
||||
assert(pa_utf8_valid("hallo\n"));
|
||||
assert(pa_utf8_valid("hüpfburg\n"));
|
||||
|
||||
|
||||
printf("LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
|
||||
pa_xfree(c);
|
||||
printf("UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
|||
|
||||
double dB = pa_sw_volume_to_dB(v);
|
||||
double f = pa_sw_volume_to_linear(v);
|
||||
|
||||
|
||||
printf("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i\n",
|
||||
v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue