mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
merge glitch-free branch back into trunk
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2445 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
91f092eadc
commit
045c1d602d
189 changed files with 12559 additions and 4959 deletions
|
|
@ -44,7 +44,7 @@ static void producer(void *_q) {
|
|||
pa_asyncq_push(q, PA_UINT_TO_PTR(i+1), 1);
|
||||
}
|
||||
|
||||
pa_asyncq_push(q, PA_UINT_TO_PTR(-1), 1);
|
||||
pa_asyncq_push(q, PA_UINT_TO_PTR(-1), TRUE);
|
||||
printf("pushed end\n");
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ static void consumer(void *_q) {
|
|||
sleep(1);
|
||||
|
||||
for (i = 0;; i++) {
|
||||
p = pa_asyncq_pop(q, 1);
|
||||
p = pa_asyncq_pop(q, TRUE);
|
||||
|
||||
if (p == PA_UINT_TO_PTR(-1))
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <pulse/channelmap.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
||||
char cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <signal.h>
|
||||
|
||||
#include <pulse/mainloop.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#ifdef TEST2
|
||||
#include <pulse/mainloop-signal.h>
|
||||
|
|
|
|||
|
|
@ -42,10 +42,9 @@ static pa_context *context = NULL;
|
|||
static pa_stream *stream = NULL;
|
||||
static pa_mainloop_api *mainloop_api = NULL;
|
||||
|
||||
static void stream_write_cb(pa_stream *p, size_t length, void *userdata) {
|
||||
|
||||
static void stream_write_cb(pa_stream *p, size_t nbytes, void *userdata) {
|
||||
/* Just some silence */
|
||||
pa_stream_write(p, pa_xmalloc0(length), length, pa_xfree, 0, PA_SEEK_RELATIVE);
|
||||
pa_stream_write(p, pa_xmalloc0(nbytes), nbytes, pa_xfree, 0, PA_SEEK_RELATIVE);
|
||||
}
|
||||
|
||||
/* This is called whenever the context status changes */
|
||||
|
|
@ -63,7 +62,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
|
|||
static const pa_sample_spec ss = {
|
||||
.format = PA_SAMPLE_S16LE,
|
||||
.rate = 44100,
|
||||
.channels = 1
|
||||
.channels = 2
|
||||
};
|
||||
|
||||
fprintf(stderr, "Connection established.\n");
|
||||
|
|
@ -112,9 +111,10 @@ int main(int argc, char *argv[]) {
|
|||
pa_threaded_mainloop_start(m);
|
||||
|
||||
for (k = 0; k < 5000; k++) {
|
||||
int success = 0, changed = 0;
|
||||
pa_bool_t success = FALSE, changed = FALSE;
|
||||
pa_usec_t t, rtc;
|
||||
struct timeval now, tv;
|
||||
pa_bool_t playing = FALSE;
|
||||
|
||||
pa_threaded_mainloop_lock(m);
|
||||
|
||||
|
|
@ -122,22 +122,26 @@ int main(int argc, char *argv[]) {
|
|||
const pa_timing_info *info;
|
||||
|
||||
if (pa_stream_get_time(stream, &t) >= 0)
|
||||
success = 1;
|
||||
success = TRUE;
|
||||
|
||||
if ((info = pa_stream_get_timing_info(stream)))
|
||||
if (last_info.tv_usec != info->timestamp.tv_usec || last_info.tv_sec != info->timestamp.tv_sec) {
|
||||
changed = 1;
|
||||
if ((info = pa_stream_get_timing_info(stream))) {
|
||||
if (memcmp(&last_info, &info->timestamp, sizeof(struct timeval))) {
|
||||
changed = TRUE;
|
||||
last_info = info->timestamp;
|
||||
}
|
||||
if (info->playing)
|
||||
playing = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
pa_threaded_mainloop_unlock(m);
|
||||
|
||||
if (success) {
|
||||
pa_gettimeofday(&now);
|
||||
pa_gettimeofday(&now);
|
||||
|
||||
if (success) {
|
||||
rtc = pa_timeval_diff(&now, &start);
|
||||
printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\n", k, (unsigned long long) rtc, (unsigned long long) t, (unsigned long long) (rtc-old_rtc), (unsigned long long) (t-old_t), changed);
|
||||
printf("%i\t%llu\t%llu\t%llu\t%llu\t%u\t%u\n", k, (unsigned long long) rtc, (unsigned long long) t, (unsigned long long) (rtc-old_rtc), (unsigned long long) (t-old_t), changed, playing);
|
||||
fflush(stdout);
|
||||
old_t = t;
|
||||
old_rtc = rtc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <pulse/timeval.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#include <pulsecore/core-util.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
|
||||
#ifdef GLIB_MAIN_LOOP
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#include <pulsecore/core-util.h>
|
||||
#include <pulsecore/mcalign.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
|
||||
/* A simple program for testing pa_mcalign */
|
||||
|
||||
|
|
|
|||
|
|
@ -31,22 +31,48 @@
|
|||
#include <pulsecore/memblockq.h>
|
||||
#include <pulsecore/log.h>
|
||||
|
||||
static void dump(pa_memblockq *bq) {
|
||||
printf(">");
|
||||
|
||||
for (;;) {
|
||||
pa_memchunk out;
|
||||
char *e;
|
||||
size_t n;
|
||||
void *q;
|
||||
|
||||
if (pa_memblockq_peek(bq, &out) < 0)
|
||||
break;
|
||||
|
||||
q = pa_memblock_acquire(out.memblock);
|
||||
for (e = (char*) q + out.index, n = 0; n < out.length; n++)
|
||||
printf("%c", *e);
|
||||
pa_memblock_release(out.memblock);
|
||||
|
||||
pa_memblock_unref(out.memblock);
|
||||
pa_memblockq_drop(bq, out.length);
|
||||
}
|
||||
|
||||
printf("<\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret;
|
||||
|
||||
pa_mempool *p;
|
||||
pa_memblockq *bq;
|
||||
pa_memchunk chunk1, chunk2, chunk3, chunk4;
|
||||
pa_memblock *silence;
|
||||
pa_memchunk silence;
|
||||
|
||||
pa_log_set_maximal_level(PA_LOG_DEBUG);
|
||||
|
||||
p = pa_mempool_new(0);
|
||||
|
||||
silence = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
|
||||
assert(silence);
|
||||
silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
|
||||
assert(silence.memblock);
|
||||
silence.index = 0;
|
||||
silence.length = pa_memblock_get_length(silence.memblock);
|
||||
|
||||
bq = pa_memblockq_new(0, 40, 10, 2, 4, 4, silence);
|
||||
bq = pa_memblockq_new(0, 40, 10, 2, 4, 4, 40, &silence);
|
||||
assert(bq);
|
||||
|
||||
chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);
|
||||
|
|
@ -72,13 +98,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);
|
||||
ret = pa_memblockq_push(bq, &chunk3);
|
||||
assert(ret == 0);
|
||||
|
||||
ret = pa_memblockq_push(bq, &chunk4);
|
||||
assert(ret == 0);
|
||||
|
||||
pa_memblockq_seek(bq, -6, 0);
|
||||
|
|
@ -86,7 +112,7 @@ int main(int argc, char *argv[]) {
|
|||
assert(ret == 0);
|
||||
|
||||
pa_memblockq_seek(bq, -2, 0);
|
||||
ret = pa_memblockq_push(bq, &chunk3);
|
||||
ret = pa_memblockq_push(bq, &chunk1);
|
||||
assert(ret == 0);
|
||||
|
||||
pa_memblockq_seek(bq, -10, 0);
|
||||
|
|
@ -119,35 +145,22 @@ int main(int argc, char *argv[]) {
|
|||
ret = pa_memblockq_push(bq, &chunk3);
|
||||
assert(ret == 0);
|
||||
|
||||
pa_memblockq_shorten(bq, pa_memblockq_get_length(bq)-2);
|
||||
pa_memblockq_seek(bq, 30, PA_SEEK_RELATIVE);
|
||||
|
||||
printf(">");
|
||||
dump(bq);
|
||||
|
||||
for (;;) {
|
||||
pa_memchunk out;
|
||||
char *e;
|
||||
size_t n;
|
||||
pa_memblockq_rewind(bq, 52);
|
||||
|
||||
if (pa_memblockq_peek(bq, &out) < 0)
|
||||
break;
|
||||
|
||||
p = pa_memblock_acquire(out.memblock);
|
||||
for (e = (char*) p + out.index, n = 0; n < out.length; n++)
|
||||
printf("%c", *e);
|
||||
pa_memblock_release(out.memblock);
|
||||
|
||||
pa_memblock_unref(out.memblock);
|
||||
pa_memblockq_drop(bq, out.length);
|
||||
}
|
||||
|
||||
printf("<\n");
|
||||
dump(bq);
|
||||
|
||||
pa_memblockq_free(bq);
|
||||
pa_memblock_unref(silence);
|
||||
pa_memblock_unref(silence.memblock);
|
||||
pa_memblock_unref(chunk1.memblock);
|
||||
pa_memblock_unref(chunk2.memblock);
|
||||
pa_memblock_unref(chunk3.memblock);
|
||||
pa_memblock_unref(chunk4.memblock);
|
||||
|
||||
pa_mempool_free(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <pulse/simple.h>
|
||||
#include <pulse/error.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <pulse/simple.h>
|
||||
#include <pulse/error.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
|
|
|
|||
|
|
@ -28,25 +28,26 @@
|
|||
#include <pulse/proplist.h>
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulsecore/macro.h>
|
||||
#include <pulsecore/core-util.h>
|
||||
|
||||
int main(int argc, char*argv[]) {
|
||||
pa_proplist *a, *b;
|
||||
char *s, *t;
|
||||
|
||||
a = pa_proplist_new();
|
||||
pa_assert_se(pa_proplist_puts(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
|
||||
pa_assert_se(pa_proplist_puts(a, PA_PROP_MEDIA_ARTIST, "Johann Sebastian Bach") == 0);
|
||||
pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
|
||||
pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_ARTIST, "Johann Sebastian Bach") == 0);
|
||||
|
||||
b = pa_proplist_new();
|
||||
pa_assert_se(pa_proplist_puts(b, PA_PROP_MEDIA_TITLE, "Goldbergvariationen") == 0);
|
||||
pa_assert_se(pa_proplist_put(b, PA_PROP_MEDIA_ICON, "\0\1\2\3\4\5\6\7", 8) == 0);
|
||||
pa_assert_se(pa_proplist_sets(b, PA_PROP_MEDIA_TITLE, "Goldbergvariationen") == 0);
|
||||
pa_assert_se(pa_proplist_set(b, PA_PROP_MEDIA_ICON, "\0\1\2\3\4\5\6\7", 8) == 0);
|
||||
|
||||
pa_proplist_merge(a, b);
|
||||
pa_proplist_update(a, PA_UPDATE_MERGE, b);
|
||||
|
||||
pa_assert_se(!pa_proplist_gets(a, PA_PROP_MEDIA_ICON));
|
||||
|
||||
printf("%s\n", pa_strnull(pa_proplist_gets(a, PA_PROP_MEDIA_TITLE)));
|
||||
pa_assert_se(pa_proplist_remove(b, PA_PROP_MEDIA_TITLE) == 0);
|
||||
pa_assert_se(pa_proplist_unset(b, PA_PROP_MEDIA_TITLE) == 0);
|
||||
|
||||
s = pa_proplist_to_string(a);
|
||||
t = pa_proplist_to_string(b);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_rtpoll_item_set_before_callback(w, worker);
|
||||
|
||||
pa_rtpoll_install(p);
|
||||
pa_rtpoll_set_timer_periodic(p, 10000000); /* 10 s */
|
||||
pa_rtpoll_set_timer_relative(p, 10000000); /* 10 s */
|
||||
|
||||
pa_rtpoll_run(p, 1);
|
||||
|
||||
|
|
|
|||
119
src/tests/rtstutter.c
Normal file
119
src/tests/rtstutter.c
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/* $Id$ */
|
||||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
Copyright 2008 Lennart Poettering
|
||||
|
||||
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
|
||||
USA.
|
||||
***/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <sched.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <pulse/timeval.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#include <pulsecore/log.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
static int msec_lower, msec_upper;
|
||||
|
||||
static void* work(void *p) PA_GCC_NORETURN;
|
||||
|
||||
static void* work(void *p) {
|
||||
cpu_set_t mask;
|
||||
struct sched_param param;
|
||||
|
||||
pa_log_notice("CPU%i: Created thread.", PA_PTR_TO_INT(p));
|
||||
|
||||
memset(¶m, 0, sizeof(param));
|
||||
param.sched_priority = 12;
|
||||
pa_assert_se(pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m) == 0);
|
||||
|
||||
CPU_ZERO(&mask);
|
||||
CPU_SET(PA_PTR_TO_INT(p), &mask);
|
||||
pa_assert_se(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
|
||||
|
||||
for (;;) {
|
||||
struct timespec now, end;
|
||||
uint64_t nsec;
|
||||
|
||||
pa_log_notice("CPU%i: Sleeping for 1s", PA_PTR_TO_INT(p));
|
||||
sleep(1);
|
||||
|
||||
pa_assert_se(clock_gettime(CLOCK_REALTIME, &end) == 0);
|
||||
|
||||
nsec =
|
||||
(uint64_t) ((((double) rand())*(msec_upper-msec_lower)*PA_NSEC_PER_MSEC)/RAND_MAX) +
|
||||
(uint64_t) (msec_lower*PA_NSEC_PER_MSEC);
|
||||
|
||||
pa_log_notice("CPU%i: Freezing for %ims", PA_PTR_TO_INT(p), (int) (nsec/PA_NSEC_PER_MSEC));
|
||||
|
||||
end.tv_sec += nsec / PA_NSEC_PER_SEC;
|
||||
end.tv_nsec += nsec % PA_NSEC_PER_SEC;
|
||||
|
||||
while (end.tv_nsec > PA_NSEC_PER_SEC) {
|
||||
end.tv_sec++;
|
||||
end.tv_nsec -= PA_NSEC_PER_SEC;
|
||||
}
|
||||
|
||||
do {
|
||||
pa_assert_se(clock_gettime(CLOCK_REALTIME, &now) == 0);
|
||||
} while (now.tv_sec < end.tv_sec ||
|
||||
(now.tv_sec == end.tv_sec && now.tv_nsec < end.tv_nsec));
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char*argv[]) {
|
||||
int n;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
if (argc >= 3) {
|
||||
msec_lower = atoi(argv[1]);
|
||||
msec_upper = atoi(argv[2]);
|
||||
} else if (argc >= 2) {
|
||||
msec_lower = 0;
|
||||
msec_upper = atoi(argv[1]);
|
||||
} else {
|
||||
msec_lower = 0;
|
||||
msec_upper = 1000;
|
||||
}
|
||||
|
||||
pa_assert(msec_upper > 0);
|
||||
pa_assert(msec_upper >= msec_lower);
|
||||
|
||||
pa_log_notice("Creating random latencies in the range of %ims to %ims.", msec_lower, msec_upper);
|
||||
|
||||
for (n = 1; n < sysconf(_SC_NPROCESSORS_CONF); n++) {
|
||||
pthread_t t;
|
||||
pa_assert_se(pthread_create(&t, NULL, work, PA_INT_TO_PTR(n)) == 0);
|
||||
}
|
||||
|
||||
work(PA_INT_TO_PTR(0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -47,25 +47,25 @@ int main(int argc, char*argv[]) {
|
|||
|
||||
srand(0);
|
||||
|
||||
for (m = 0, u = 0; u < PA_ELEMENTSOF(msec)-2; u+= 2) {
|
||||
for (m = 0, u = 0; u < PA_ELEMENTSOF(msec); u+= 2) {
|
||||
|
||||
msec[u] = m+1;
|
||||
msec[u+1] = m + rand() % 2000 - 1000;
|
||||
msec[u] = m+1 + (rand() % 100) - 50;
|
||||
msec[u+1] = m + (rand() % 2000) - 1000;
|
||||
|
||||
m += rand() % 100;
|
||||
|
||||
if (msec[u] < 0)
|
||||
msec[u] = 0;
|
||||
|
||||
if (msec[u+1] < 0)
|
||||
msec[u+1] = 0;
|
||||
}
|
||||
|
||||
msec[PA_ELEMENTSOF(msec)-2] = 0;
|
||||
msec[PA_ELEMENTSOF(msec)-1] = 0;
|
||||
|
||||
s = pa_smoother_new(1000*PA_USEC_PER_MSEC, 2000*PA_USEC_PER_MSEC, TRUE);
|
||||
s = pa_smoother_new(700*PA_USEC_PER_MSEC, 2000*PA_USEC_PER_MSEC, TRUE, 6);
|
||||
|
||||
for (x = 0, u = 0; x < PA_USEC_PER_SEC * 10; x += PA_USEC_PER_MSEC) {
|
||||
|
||||
while (msec[u] > 0 && (pa_usec_t) msec[u]*PA_USEC_PER_MSEC < x) {
|
||||
while (u < PA_ELEMENTSOF(msec) && (pa_usec_t) msec[u]*PA_USEC_PER_MSEC < x) {
|
||||
pa_smoother_put(s, msec[u]*PA_USEC_PER_MSEC, msec[u+1]*PA_USEC_PER_MSEC);
|
||||
printf("%i\t\t%i\n", msec[u], msec[u+1]);
|
||||
u += 2;
|
||||
|
|
|
|||
72
src/tests/stripnul.c
Normal file
72
src/tests/stripnul.c
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/* $Id$ */
|
||||
|
||||
/***
|
||||
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
|
||||
USA.
|
||||
***/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *i, *o;
|
||||
size_t granularity;
|
||||
pa_bool_t found;
|
||||
uint8_t *zero;
|
||||
|
||||
pa_assert_se(argc >= 2);
|
||||
pa_assert_se((granularity = atoi(argv[1])) >= 1);
|
||||
pa_assert_se((i = (argc >= 3) ? fopen(argv[2], "r") : stdin));
|
||||
pa_assert_se((o = (argc >= 4) ? fopen(argv[3], "w") : stdout));
|
||||
|
||||
zero = pa_xmalloc0(granularity);
|
||||
|
||||
for (;;) {
|
||||
uint8_t buffer[16*1024], *p;
|
||||
size_t k;
|
||||
|
||||
k = fread(buffer, granularity, sizeof(buffer)/granularity, i);
|
||||
|
||||
if (k <= 0)
|
||||
break;
|
||||
|
||||
if (found)
|
||||
pa_assert_se(fwrite(buffer, granularity, k, o) == k);
|
||||
else {
|
||||
for (p = buffer; (p-buffer)/granularity < k; p += granularity)
|
||||
if (memcmp(p, zero, granularity)) {
|
||||
size_t left;
|
||||
found = TRUE;
|
||||
left = k - (p-buffer)/granularity;
|
||||
pa_assert_se(fwrite(p, granularity, left, o) == left);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fflush(o);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#include <pulsecore/strlist.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
|
||||
int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char* argv[]) {
|
||||
char *t, *u;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
#include <pulse/timeval.h>
|
||||
#include <pulse/util.h>
|
||||
#include <pulse/thread-mainloop.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
#include <pulsecore/gccmacro.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
static void tcb(pa_mainloop_api*a, pa_time_event *e, const struct timeval *tv, void *userdata) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <pulse/volume.h>
|
||||
#include <pulsecore/gccmacro.h>
|
||||
#include <pulse/gccmacro.h>
|
||||
|
||||
int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
|
||||
pa_volume_t v;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue