jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
5.1KB

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