root/branches/streaming-rework/libfreebob/freebob.h

Revision 386, 5.0 kB (checked in by pieterpalmers, 16 years ago)

- moved files around to the place they belong
- fixed all compile warnings

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* freebob.h
2  * Copyright (C) 2005 Pieter Palmers
3  * Copyright (C) 2006 Daniel Wagner
4  *
5  * This file is part of FreeBoB
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301 USA
21  */
22
23 #ifndef FREEBOB_H
24 #define FREEBOB_H
25
26 #define FREEBOB_MAX_NAME_LEN 256
27
28 #define FREEBOB_BOUNCE_SERVER_VENDORNAME  "FreeBoB Server"
29 #define FREEBOB_BOUNCE_SERVER_MODELNAME   "freebob-server"
30
31 #define FREEBOB_BOUNCE_SERVER_GETXMLDESCRIPTION_CMD
32 #define AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER      0x0D
33
34 #define FREEBOB_API_VERSION 2
35
36 enum freebob_direction {
37     FREEBOB_CAPTURE  = 0,
38     FREEBOB_PLAYBACK = 1,
39 };
40
41 typedef struct freebob_handle* freebob_handle_t;
42
43 /*
44  * Buffer specification
45  */
46 typedef struct _freebob_stream_spec freebob_stream_spec_t;
47 typedef struct _freebob_stream_info freebob_stream_info_t;
48 typedef struct _freebob_connection_spec freebob_connection_spec_t;
49 typedef struct _freebob_connection_info freebob_connection_info_t;
50 typedef struct _freebob_supported_stream_format_spec freebob_supported_stream_format_spec_t;
51 typedef struct _freebob_supported_stream_format_info freebob_supported_stream_format_info_t;
52
53 /*
54  * Stream specification
55  */
56 struct _freebob_stream_spec {
57     int location;
58     int position;
59     int format;
60     int type;
61     int destination_port;
62     char name[FREEBOB_MAX_NAME_LEN];
63 };
64
65 struct _freebob_stream_info {
66     int nb_streams;
67     freebob_stream_spec_t** streams;
68 };
69
70 /*
71  * Connection specification
72  */
73 struct _freebob_connection_spec {
74     int id;
75     int port;
76     int node;
77     int plug;
78     int dimension;  /* due to the midi stuff, the dimension isn't equal */
79                     /* to the number of streams */
80     int samplerate; /* this should be equal for all connections when */
81                     /* using jack. maybe not when using other api's */
82     int iso_channel;
83     enum freebob_direction direction;
84     int is_master;
85     freebob_stream_info_t* stream_info;
86 };
87
88 /*
89  * topology info
90  */
91 struct _freebob_connection_info {
92     int direction;
93     int nb_connections;
94     freebob_connection_spec_t** connections;
95 };
96
97 /*
98  * Supported stream formats
99  */
100 struct _freebob_supported_stream_format_spec {
101     int samplerate;
102     int nb_audio_channels;
103     int nb_midi_channels;
104 };
105
106 struct _freebob_supported_stream_format_info {
107     int direction;
108     int nb_formats;
109     freebob_supported_stream_format_spec_t** formats;
110 };
111
112
113 #ifdef __cplusplus
114 extern "C" {
115 #endif
116
117 freebob_handle_t
118 freebob_new_handle( int port );
119
120 int
121 freebob_destroy_handle( freebob_handle_t freebob_handle );
122
123 int
124 freebob_discover_devices( freebob_handle_t freebob_handle, int verbose_level );
125
126
127 freebob_connection_info_t*
128 freebob_get_connection_info( freebob_handle_t freebob_handle,
129                              int node_id,
130                              enum freebob_direction direction );
131
132 freebob_supported_stream_format_info_t*
133 freebob_get_supported_stream_format_info( freebob_handle_t freebob_handle,
134                                           int node_id,
135                                           enum freebob_direction direction );
136
137 void
138 freebob_free_connection_info( freebob_connection_info_t* connection_info );
139 void
140 freebob_free_connection_spec( freebob_connection_spec_t* connection_spec );
141 void
142 freebob_free_stream_info( freebob_stream_info_t* stream_info );
143 void
144 freebob_free_stream_spec( freebob_stream_spec_t* stream_spec );
145 void
146 freebob_free_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info );
147 void
148 freebob_free_supported_stream_format_spec( freebob_supported_stream_format_spec_t* stream_spec );
149
150
151
152 void
153 freebob_print_connection_info( freebob_connection_info_t* connection_info );
154 void
155 freebob_print_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info );
156
157 int freebob_node_is_valid_freebob_device(freebob_handle_t fb_handle, int node_id);
158 int freebob_get_nb_devices_on_bus(freebob_handle_t fb_handle);
159
160 int freebob_get_device_node_id(freebob_handle_t fb_handle, int device_nr);
161 int freebob_set_samplerate(freebob_handle_t freebob_handle, int node_id, int samplerate);
162
163 /* debug function */
164 void
165 freebob_print_xml_description( freebob_handle_t freebob_handle,
166                                int node_id,
167                                enum freebob_direction direction );
168
169 const char*
170 freebob_get_version();
171
172 int
173 freebob_get_api_version();
174
175 /* various function */
176
177 /* workaround: wait usec after each AVC command.
178    will disapear as soon bug is fixed */   
179 void freebob_sleep_after_avc_command( int time );
180
181 #ifdef __cplusplus
182 }
183 #endif
184
185 #endif /* FREEBOB_H */
Note: See TracBrowser for help on using the browser.