Correct netjack2 components help.
[jack2.git] / common / netjack.h
blob2ff3c29983f6eedbaa5cf920dad8791faaead496
2 /*
3 Copyright (C) 2003 Robert Ham <rah@bash.sh>
4 Copyright (C) 2005 Torben Hohn <torbenh@gmx.de>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __NETJACK_H__
22 #define __NETJACK_H__
24 #include <unistd.h>
26 #include <jack/types.h>
27 #include <jack/jack.h>
28 #include <jack/transport.h>
29 #include "jack/jslist.h"
31 #if HAVE_CELT
32 #include <celt/celt.h>
33 #endif
35 #ifdef __cplusplus
36 extern "C"
38 #endif
40 struct _packet_cache;
42 typedef struct _netjack_driver_state netjack_driver_state_t;
44 struct _netjack_driver_state {
45 jack_nframes_t net_period_up;
46 jack_nframes_t net_period_down;
48 jack_nframes_t sample_rate;
49 jack_nframes_t bitdepth;
50 jack_nframes_t period_size;
51 jack_time_t period_usecs;
52 int dont_htonl_floats;
53 int always_deadline;
55 jack_nframes_t codec_latency;
57 unsigned int listen_port;
59 unsigned int capture_channels;
60 unsigned int playback_channels;
61 unsigned int capture_channels_audio;
62 unsigned int playback_channels_audio;
63 unsigned int capture_channels_midi;
64 unsigned int playback_channels_midi;
66 JSList *capture_ports;
67 JSList *playback_ports;
68 JSList *playback_srcs;
69 JSList *capture_srcs;
71 jack_client_t *client;
73 #ifdef WIN32
74 SOCKET sockfd;
75 SOCKET outsockfd;
76 #else
77 int sockfd;
78 int outsockfd;
79 #endif
81 struct sockaddr_in syncsource_address;
83 int reply_port;
84 int srcaddress_valid;
86 int sync_state;
87 unsigned int handle_transport_sync;
89 unsigned int *rx_buf;
90 unsigned int rx_bufsize;
91 //unsigned int tx_bufsize;
92 unsigned int mtu;
93 unsigned int latency;
94 unsigned int redundancy;
96 jack_nframes_t expected_framecnt;
97 int expected_framecnt_valid;
98 unsigned int num_lost_packets;
99 jack_time_t next_deadline;
100 jack_time_t deadline_offset;
101 int next_deadline_valid;
102 int packet_data_valid;
103 int resync_threshold;
104 int running_free;
105 int deadline_goodness;
106 jack_time_t time_to_deadline;
107 unsigned int use_autoconfig;
108 unsigned int resample_factor;
109 unsigned int resample_factor_up;
110 int jitter_val;
111 struct _packet_cache * packcache;
112 #if HAVE_CELT
113 CELTMode *celt_mode;
114 #endif
117 int netjack_wait( netjack_driver_state_t *netj );
118 void netjack_send_silence( netjack_driver_state_t *netj, int syncstate );
119 void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ;
120 void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate );
121 void netjack_attach( netjack_driver_state_t *netj );
122 void netjack_detach( netjack_driver_state_t *netj );
124 netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
125 jack_client_t * client,
126 const char *name,
127 unsigned int capture_ports,
128 unsigned int playback_ports,
129 unsigned int capture_ports_midi,
130 unsigned int playback_ports_midi,
131 jack_nframes_t sample_rate,
132 jack_nframes_t period_size,
133 unsigned int listen_port,
134 unsigned int transport_sync,
135 unsigned int resample_factor,
136 unsigned int resample_factor_up,
137 unsigned int bitdepth,
138 unsigned int use_autoconfig,
139 unsigned int latency,
140 unsigned int redundancy,
141 int dont_htonl_floats,
142 int always_deadline,
143 int jitter_val );
145 void netjack_release( netjack_driver_state_t *netj );
146 int netjack_startup( netjack_driver_state_t *netj );
148 #ifdef __cplusplus
150 #endif
152 #endif