diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-08-17 17:17:22 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-08-17 17:17:22 +0000 |
commit | ca2265f37277081b4fe82e375923483c2e03931d (patch) | |
tree | 1766658296f7ea550e9148bd467e6d0a89781c10 /polyp/pacat-simple.c | |
parent | f693aa4c8811b67377a4fcc55887d03876fb48be (diff) |
Documentation work
add pkg-config support for GLIB main loop
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@133 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/pacat-simple.c')
-rw-r--r-- | polyp/pacat-simple.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/polyp/pacat-simple.c b/polyp/pacat-simple.c index f2aae2e4..f5b696a8 100644 --- a/polyp/pacat-simple.c +++ b/polyp/pacat-simple.c @@ -34,15 +34,19 @@ #define BUFSIZE 1024 int main(int argc, char*argv[]) { + + /* The Sample format to use */ static const struct pa_sample_spec ss = { .format = PA_SAMPLE_S16LE, .rate = 44100, .channels = 2 }; + struct pa_simple *s = NULL; int ret = 1; int error; + /* Create a new playback stream */ if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, &error))) { fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error)); goto finish; @@ -51,22 +55,24 @@ int main(int argc, char*argv[]) { for (;;) { uint8_t buf[BUFSIZE]; ssize_t r; - + + /* Read some data ... */ if ((r = read(STDIN_FILENO, buf, sizeof(buf))) <= 0) { - if (r == 0) /* eof */ + if (r == 0) /* EOF */ break; fprintf(stderr, __FILE__": read() failed: %s\n", strerror(errno)); goto finish; } + /* ... and play it */ if (pa_simple_write(s, buf, r, &error) < 0) { fprintf(stderr, __FILE__": pa_simple_write() failed: %s\n", pa_strerror(error)); goto finish; } } - /* Make sure that every single sample way played */ + /* Make sure that every single sample was played */ if (pa_simple_drain(s, &error) < 0) { fprintf(stderr, __FILE__": pa_simple_drain() failed: %s\n", pa_strerror(error)); goto finish; |