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.
26 #include <jack/types.h>
27 #include <jack/jack.h>
28 #include <jack/transport.h>
29 #include "jack/jslist.h"
32 #include <celt/celt.h>
36 #include <opus/opus.h>
37 #include <opus/opus_custom.h>
47 typedef struct _netjack_driver_state netjack_driver_state_t
;
49 struct _netjack_driver_state
{
50 jack_nframes_t net_period_up
;
51 jack_nframes_t net_period_down
;
53 jack_nframes_t sample_rate
;
54 jack_nframes_t bitdepth
;
55 jack_nframes_t period_size
;
56 jack_time_t period_usecs
;
57 int dont_htonl_floats
;
60 jack_nframes_t codec_latency
;
62 unsigned int listen_port
;
64 unsigned int capture_channels
;
65 unsigned int playback_channels
;
66 unsigned int capture_channels_audio
;
67 unsigned int playback_channels_audio
;
68 unsigned int capture_channels_midi
;
69 unsigned int playback_channels_midi
;
71 JSList
*capture_ports
;
72 JSList
*playback_ports
;
73 JSList
*playback_srcs
;
76 jack_client_t
*client
;
86 struct sockaddr_in syncsource_address
;
92 unsigned int handle_transport_sync
;
95 unsigned int rx_bufsize
;
96 //unsigned int tx_bufsize;
99 unsigned int redundancy
;
101 jack_nframes_t expected_framecnt
;
102 int expected_framecnt_valid
;
103 unsigned int num_lost_packets
;
104 jack_time_t next_deadline
;
105 jack_time_t deadline_offset
;
106 int next_deadline_valid
;
107 int packet_data_valid
;
108 int resync_threshold
;
110 int deadline_goodness
;
111 jack_time_t time_to_deadline
;
112 unsigned int use_autoconfig
;
113 unsigned int resample_factor
;
114 unsigned int resample_factor_up
;
116 struct _packet_cache
* packcache
;
121 OpusCustomMode
* opus_mode
;
125 int netjack_wait( netjack_driver_state_t
*netj
);
126 void netjack_send_silence( netjack_driver_state_t
*netj
, int syncstate
);
127 void netjack_read( netjack_driver_state_t
*netj
, jack_nframes_t nframes
) ;
128 void netjack_write( netjack_driver_state_t
*netj
, jack_nframes_t nframes
, int syncstate
);
129 void netjack_attach( netjack_driver_state_t
*netj
);
130 void netjack_detach( netjack_driver_state_t
*netj
);
132 netjack_driver_state_t
*netjack_init (netjack_driver_state_t
*netj
,
133 jack_client_t
* client
,
135 unsigned int capture_ports
,
136 unsigned int playback_ports
,
137 unsigned int capture_ports_midi
,
138 unsigned int playback_ports_midi
,
139 jack_nframes_t sample_rate
,
140 jack_nframes_t period_size
,
141 unsigned int listen_port
,
142 unsigned int transport_sync
,
143 unsigned int resample_factor
,
144 unsigned int resample_factor_up
,
145 unsigned int bitdepth
,
146 unsigned int use_autoconfig
,
147 unsigned int latency
,
148 unsigned int redundancy
,
149 int dont_htonl_floats
,
153 void netjack_release( netjack_driver_state_t
*netj
);
154 int netjack_startup( netjack_driver_state_t
*netj
);