Jack2
1.9.10
|
00001 00002 /* 00003 Copyright (C) 2003 Robert Ham <rah@bash.sh> 00004 Copyright (C) 2005 Torben Hohn <torbenh@gmx.de> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __NETJACK_H__ 00022 #define __NETJACK_H__ 00023 00024 #include <unistd.h> 00025 00026 #include <jack/types.h> 00027 #include <jack/jack.h> 00028 #include <jack/transport.h> 00029 #include "jack/jslist.h" 00030 00031 #if HAVE_CELT 00032 #include <celt/celt.h> 00033 #endif 00034 00035 #if HAVE_OPUS 00036 #include <opus/opus.h> 00037 #include <opus/opus_custom.h> 00038 #endif 00039 00040 #ifdef __cplusplus 00041 extern "C" 00042 { 00043 #endif 00044 00045 struct _packet_cache; 00046 00047 typedef struct _netjack_driver_state netjack_driver_state_t; 00048 00049 struct _netjack_driver_state { 00050 jack_nframes_t net_period_up; 00051 jack_nframes_t net_period_down; 00052 00053 jack_nframes_t sample_rate; 00054 jack_nframes_t bitdepth; 00055 jack_nframes_t period_size; 00056 jack_time_t period_usecs; 00057 int dont_htonl_floats; 00058 int always_deadline; 00059 00060 jack_nframes_t codec_latency; 00061 00062 unsigned int listen_port; 00063 00064 unsigned int capture_channels; 00065 unsigned int playback_channels; 00066 unsigned int capture_channels_audio; 00067 unsigned int playback_channels_audio; 00068 unsigned int capture_channels_midi; 00069 unsigned int playback_channels_midi; 00070 00071 JSList *capture_ports; 00072 JSList *playback_ports; 00073 JSList *playback_srcs; 00074 JSList *capture_srcs; 00075 00076 jack_client_t *client; 00077 00078 #ifdef WIN32 00079 SOCKET sockfd; 00080 SOCKET outsockfd; 00081 #else 00082 int sockfd; 00083 int outsockfd; 00084 #endif 00085 00086 struct sockaddr_in syncsource_address; 00087 00088 int reply_port; 00089 int srcaddress_valid; 00090 00091 int sync_state; 00092 unsigned int handle_transport_sync; 00093 00094 unsigned int *rx_buf; 00095 unsigned int rx_bufsize; 00096 //unsigned int tx_bufsize; 00097 unsigned int mtu; 00098 unsigned int latency; 00099 unsigned int redundancy; 00100 00101 jack_nframes_t expected_framecnt; 00102 int expected_framecnt_valid; 00103 unsigned int num_lost_packets; 00104 jack_time_t next_deadline; 00105 jack_time_t deadline_offset; 00106 int next_deadline_valid; 00107 int packet_data_valid; 00108 int resync_threshold; 00109 int running_free; 00110 int deadline_goodness; 00111 jack_time_t time_to_deadline; 00112 unsigned int use_autoconfig; 00113 unsigned int resample_factor; 00114 unsigned int resample_factor_up; 00115 int jitter_val; 00116 struct _packet_cache * packcache; 00117 #if HAVE_CELT 00118 CELTMode *celt_mode; 00119 #endif 00120 #if HAVE_OPUS 00121 OpusCustomMode* opus_mode; 00122 #endif 00123 }; 00124 00125 int netjack_wait( netjack_driver_state_t *netj ); 00126 void netjack_send_silence( netjack_driver_state_t *netj, int syncstate ); 00127 void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ; 00128 void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate ); 00129 void netjack_attach( netjack_driver_state_t *netj ); 00130 void netjack_detach( netjack_driver_state_t *netj ); 00131 00132 netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj, 00133 jack_client_t * client, 00134 const char *name, 00135 unsigned int capture_ports, 00136 unsigned int playback_ports, 00137 unsigned int capture_ports_midi, 00138 unsigned int playback_ports_midi, 00139 jack_nframes_t sample_rate, 00140 jack_nframes_t period_size, 00141 unsigned int listen_port, 00142 unsigned int transport_sync, 00143 unsigned int resample_factor, 00144 unsigned int resample_factor_up, 00145 unsigned int bitdepth, 00146 unsigned int use_autoconfig, 00147 unsigned int latency, 00148 unsigned int redundancy, 00149 int dont_htonl_floats, 00150 int always_deadline, 00151 int jitter_val ); 00152 00153 void netjack_release( netjack_driver_state_t *netj ); 00154 int netjack_startup( netjack_driver_state_t *netj ); 00155 00156 #ifdef __cplusplus 00157 } 00158 #endif 00159 00160 #endif