source: roaraudio/libroarpulse/simple.c @ 404:6e2026516643

Last change on this file since 404:6e2026516643 was 404:6e2026516643, checked in by phi, 16 years ago

added read(), write(), fsync()

File size: 2.4 KB
Line 
1//simple.c:
2
3#include <libroarpulse/libroarpulse.h>
4
5/** Create a new connection to the server */
6pa_simple* pa_simple_new(
7    const char *server,                 /**< Server name, or NULL for default */
8    const char *name,                   /**< A descriptive name for this client (application name, ...) */
9    pa_stream_direction_t dir,          /**< Open this stream for recording or playback? */
10    const char *dev,                    /**< Sink (resp. source) name, or NULL for default */
11    const char *stream_name,            /**< A descriptive name for this client (application name, song title, ...) */
12    const pa_sample_spec *ss,           /**< The sample type to use */
13    const pa_channel_map *map,          /**< The channel map to use, or NULL for default */
14    const pa_buffer_attr *attr,         /**< Buffering attributes, or NULL for default */
15    int *error                          /**< A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here. */
16    ) {
17 return NULL;
18}
19
20/** Close and free the connection to the server. The connection objects becomes invalid when this is called. */
21void pa_simple_free(pa_simple *s) {
22 struct roarpulse_simple * ss = (struct roarpulse_simple*) s;
23 if ( !s )
24  return;
25
26 free(s);
27}
28
29/** Write some data to the server */
30int pa_simple_write(pa_simple *s, const void*data, size_t length, int *error) {
31 struct roarpulse_simple * ss = (struct roarpulse_simple*) s;
32 if ( !s )
33  return -1;
34
35 return read(ss->data_fh, data, length);
36}
37
38/** Wait until all data already written is played by the daemon */
39int pa_simple_drain(pa_simple *s, int *error) {
40 struct roarpulse_simple * ss = (struct roarpulse_simple*) s;
41 if ( !s )
42  return -1;
43
44 return -1;
45}
46
47/** Read some data from the server */
48int pa_simple_read(pa_simple *s, void*data, size_t length, int *error) {
49 struct roarpulse_simple * ss = (struct roarpulse_simple*) s;
50 if ( !s )
51  return -1;
52
53 return read(ss->data_fh, data, legth);
54}
55
56/** Return the playback latency. \since 0.5 */
57pa_usec_t pa_simple_get_latency(pa_simple *s, int *error) {
58 struct roarpulse_simple * ss = (struct roarpulse_simple*) s;
59 if ( !s )
60  return -1;
61
62 return -1;
63}
64
65/** Flush the playback buffer. \since 0.5 */
66int pa_simple_flush(pa_simple *s, int *error) {
67 struct roarpulse_simple * ss = (struct roarpulse_simple*) s;
68 if ( !s )
69  return -1;
70
71 return fdatasync(ss->data_fh);
72}
73
74//ll
Note: See TracBrowser for help on using the repository browser.