LIBFFADO  2.4.9
ffado.h
Go to the documentation of this file.
1 /* ffado.h
2  *
3  * Copyright (C) 2005-2008 by Pieter Palmers
4  * Copyright (C) 2005-2008 by Daniel Wagner
5  *
6  * This file is part of FFADO
7  * FFADO = Free FireWire (pro-)audio drivers for Linux
8  *
9  * FFADO is based upon FreeBoB
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 2 of the License, or
14  * (at your option) version 3 of the License.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  *
24  */
25 
26 #ifndef FFADO_H
27 #define FFADO_H
28 
29 #define FFADO_API_VERSION 9
30 
31 #define FFADO_MAX_NAME_LEN 256
32 
33 #include <stdint.h>
34 #include <stdlib.h>
35 
36 #define FFADO_STREAMING_MAX_URL_LENGTH 2048
37 
38 #define FFADO_IGNORE_CAPTURE (1<<0)
39 #define FFADO_IGNORE_PLAYBACK (1<<1)
40 
44 };
45 
46 typedef struct ffado_handle* ffado_handle_t;
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 #ifdef __APPLE__
53 #define WEAK_ATTRIBUTE weak_import
54 #else
55 #define WEAK_ATTRIBUTE __weak__
56 #endif
57 
58 #ifdef __GNUC__
59 #define FFADO_WEAK_EXPORT __attribute__((WEAK_ATTRIBUTE))
60 #else
61 /* Add support for non-gcc platforms here */
62 #endif
63 
64 /* ABI stuff */
65 const char*
67 
68 int
70 
71 /* various function */
72 
73 /* The basic operation of the API is as follows:
74  *
75  * ffado_streaming_init()
76  * ffado_streaming_start()
77  * while(running) {
78  * retval = ffado_streaming_wait();
79  * if (retval == -1) {
80  * ffado_streaming_reset();
81  * continue;
82  * }
83  *
84  * ffado_streaming_transfer_capture_buffers(dev);
85  *
86  * for(all channels) {
87  * // For both audio and MIDI channels, captured data is available
88  * // in the buffer previously set with a call to
89  * // ffado_streaming_set_capture_stream_buffer(dev, channel, buffer)
90  * switch (channel_type) {
91  * case audio:
92  * // Process incoming audio as needed
93  * case midi:
94  * // Process incoming MIDI data as needed
95  * }
96  * }
97  *
98  * for(all channels) {
99  * // For both audio and MIDI channels, data is written to buffers
100  * // previously associated with the playback channel streams using
101  * // ffado_streaming_set_playback_stream_buffer(dev, channel, buffer)
102  * switch (channel_type) {
103  * case audio:
104  * // Set audio playback buffer contents
105  * case midi:
106  * // Set MIDI playback buffer contents
107  * }
108  * }
109  * ffado_streaming_transfer_playback_buffers(dev);
110  *
111  * }
112  * ffado_streaming_stop();
113  * ffado_streaming_finish();
114  *
115  */
116 
117 typedef struct _ffado_device ffado_device_t;
118 
123 typedef unsigned int ffado_sample_t; // FIXME
124 typedef unsigned int ffado_nframes_t;
125 
126 #define FFADO_MAX_SPECSTRING_LENGTH 256
127 #define FFADO_MAX_SPECSTRINGS 64
128 
165 typedef struct ffado_device_info {
168 
169  /* add some extra space to allow for future API extention
170  w/o breaking binary compatibility */
171  int32_t reserved[32];
173 
177 typedef struct ffado_options {
178  /* driver related setup */
179  int32_t sample_rate; /*
180  * you can specify a value here or -1 to autodetect
181  */
182 
183  /* buffer setup */
184  int32_t period_size; /* one period is the amount of frames that
185  * has to be sent or received in order for
186  * a period boundary to be signalled.
187  * (unit: frames)
188  */
189  int32_t nb_buffers; /* the size of the frame buffer (in periods) */
190 
191  /* packetizer thread options */
192  int32_t realtime;
194 
195  /* verbosity */
196  int32_t verbose;
197 
198  /* slave mode */
199  int32_t slave_mode;
200  /* snoop mode */
201  int32_t snoop_mode;
202 
203  /* add some extra space to allow for future API extention
204  w/o breaking binary compatibility */
205  int32_t reserved[24];
206 
208 
224 typedef enum {
231 
237 typedef enum {
242 
248 typedef enum {
254 
271  ffado_device_info_t device_info,
272  ffado_options_t options);
273 
284  unsigned int period) FFADO_WEAK_EXPORT;
285 
294 
295 
303 
313 
323 
334 int ffado_streaming_get_capture_stream_name(ffado_device_t *dev, int number, char* buffer, size_t buffersize);
335 
346 int ffado_streaming_get_playback_stream_name(ffado_device_t *dev, int number, char* buffer, size_t buffersize);
347 
357 
367 /*
368  *
369  * Note: buffer handling will change in order to allow setting the sample type for *_read and *_write
370  * and separately indicate if you want to use a user buffer or a managed buffer.
371  *
372  */
373 
388 int ffado_streaming_set_capture_stream_buffer(ffado_device_t *dev, int number, char *buff);
389 int ffado_streaming_capture_stream_onoff(ffado_device_t *dev, int number, int on);
390 
403 int ffado_streaming_set_playback_stream_buffer(ffado_device_t *dev, int number, char *buff);
404 int ffado_streaming_playback_stream_onoff(ffado_device_t *dev, int number, int on);
405 
408 
418 
428 
438 
450 
460 
488 
507 
526 
527 #ifdef __cplusplus
528 }
529 #endif
530 
531 #endif /* FFADO_STREAMING */
int32_t verbose
Definition: ffado.h:196
unsigned int ffado_nframes_t
Definition: ffado.h:124
Definition: ffado.h:177
int32_t reserved[24]
Definition: ffado.h:205
Definition: ffado.h:251
int ffado_streaming_transfer_playback_buffers(ffado_device_t *dev)
int ffado_streaming_transfer_capture_buffers(ffado_device_t *dev)
Definition: ffado.h:229
ffado_streaming_stream_type ffado_streaming_get_capture_stream_type(ffado_device_t *dev, int number)
unsigned int ffado_sample_t
Definition: ffado.h:123
ffado_wait_response ffado_streaming_wait(ffado_device_t *dev)
Definition: ffado.h:250
Definition: ffado.h:42
Definition: ffado.h:227
int ffado_streaming_playback_stream_onoff(ffado_device_t *dev, int number, int on)
Definition: ffado.h:249
struct ffado_handle * ffado_handle_t
Definition: ffado.h:46
int ffado_streaming_capture_stream_onoff(ffado_device_t *dev, int number, int on)
int32_t packetizer_priority
Definition: ffado.h:193
int32_t sample_rate
Definition: ffado.h:179
Definition: ffado.h:43
int ffado_streaming_get_playback_stream_name(ffado_device_t *dev, int number, char *buffer, size_t buffersize)
ffado_streaming_stream_type ffado_streaming_get_playback_stream_type(ffado_device_t *dev, int number)
ffado_wait_response
Definition: ffado.h:248
Definition: ffado.h:225
unsigned int nb_device_spec_strings
Definition: ffado.h:166
int32_t realtime
Definition: ffado.h:192
int ffado_streaming_prepare(ffado_device_t *dev)
Definition: ffado.h:239
struct ffado_device_info ffado_device_info_t
int ffado_streaming_set_playback_stream_buffer(ffado_device_t *dev, int number, char *buff)
int ffado_streaming_set_capture_stream_buffer(ffado_device_t *dev, int number, char *buff)
const char * ffado_get_version()
struct _ffado_device ffado_device_t
Definition: ffado.h:117
Definition: ffado.h:226
void ffado_streaming_finish(ffado_device_t *dev)
char ** device_spec_strings
Definition: ffado.h:167
struct ffado_options ffado_options_t
int ffado_streaming_start(ffado_device_t *dev)
Definition: ffado.h:165
int ffado_streaming_set_audio_datatype(ffado_device_t *dev, ffado_streaming_audio_datatype t)
int ffado_streaming_set_period_size(ffado_device_t *dev, unsigned int period) FFADO_WEAK_EXPORT
ffado_device_t * ffado_streaming_init(ffado_device_info_t device_info, ffado_options_t options)
Definition: ffado.h:228
Definition: ffado.h:240
int ffado_streaming_get_capture_stream_name(ffado_device_t *dev, int number, char *buffer, size_t buffersize)
int ffado_streaming_stop(ffado_device_t *dev)
int ffado_streaming_transfer_buffers(ffado_device_t *dev)
int ffado_streaming_reset(ffado_device_t *dev)
ffado_streaming_audio_datatype
Definition: ffado.h:237
int32_t period_size
Definition: ffado.h:184
Definition: ffado.h:238
ffado_streaming_audio_datatype ffado_streaming_get_audio_datatype(ffado_device_t *dev)
int32_t slave_mode
Definition: ffado.h:199
int32_t snoop_mode
Definition: ffado.h:201
int32_t nb_buffers
Definition: ffado.h:189
int ffado_get_api_version()
Definition: ffado.h:252
int ffado_streaming_get_nb_playback_streams(ffado_device_t *dev)
int ffado_streaming_get_nb_capture_streams(ffado_device_t *dev)
ffado_direction
Definition: ffado.h:41
int32_t reserved[32]
Definition: ffado.h:171
ffado_streaming_stream_type
Definition: ffado.h:224