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.

101 lines
3.6KB

  1. /*
  2. Copyright (C) 2008-2011 Torben Horn
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #ifndef __JackNetDriver__
  16. #define __JackNetDriver__
  17. #include "JackTimedDriver.h"
  18. #include "netjack.h"
  19. #include "netjack_packet.h"
  20. namespace Jack
  21. {
  22. /**
  23. \Brief This class describes the Net Backend
  24. */
  25. class JackNetOneDriver : public JackWaiterDriver
  26. {
  27. private:
  28. netjack_driver_state_t netj;
  29. void
  30. render_payload_to_jack_ports_float(void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats);
  31. void
  32. render_jack_ports_to_payload_float(JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats );
  33. #if HAVE_CELT
  34. void
  35. render_payload_to_jack_ports_celt(void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes);
  36. void
  37. render_jack_ports_to_payload_celt(JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up);
  38. #endif
  39. #if HAVE_OPUS
  40. void
  41. render_payload_to_jack_ports_opus(void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes);
  42. void
  43. render_jack_ports_to_payload_opus(JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up);
  44. #endif
  45. void
  46. render_payload_to_jack_ports(int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats);
  47. void
  48. render_jack_ports_to_payload(int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats);
  49. public:
  50. JackNetOneDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
  51. int port, int mtu, int capture_ports, int playback_ports, int midi_input_ports, int midi_output_ports,
  52. int sample_rate, int period_size, int resample_factor,
  53. const char* net_name, uint transport_sync, int bitdepth, int use_autoconfig,
  54. int latency, int redundancy, int dont_htonl_floats, int always_deadline, int jitter_val);
  55. virtual ~JackNetOneDriver();
  56. int Close();
  57. int Attach();
  58. int Detach();
  59. int Read();
  60. int Write();
  61. bool Initialize();
  62. int AllocPorts();
  63. void FreePorts();
  64. // BufferSize can't be changed
  65. bool IsFixedBufferSize()
  66. {
  67. return true;
  68. }
  69. int SetBufferSize(jack_nframes_t buffer_size)
  70. {
  71. return -1;
  72. }
  73. int SetSampleRate(jack_nframes_t sample_rate)
  74. {
  75. return -1;
  76. }
  77. };
  78. }
  79. #endif