Jack2 1.9.10

JackNetOneDriver.h

00001 /*
00002 Copyright (C) 2008-2011 Torben Horn
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018 */
00019 
00020 #ifndef __JackNetDriver__
00021 #define __JackNetDriver__
00022 
00023 #include "JackTimedDriver.h"
00024 #include "netjack.h"
00025 #include "netjack_packet.h"
00026 
00027 namespace Jack
00028 {
00033 class JackNetOneDriver : public JackWaiterDriver
00034 {
00035     private:
00036 
00037         netjack_driver_state_t netj;
00038 
00039         void
00040         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);
00041         void
00042         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 );
00043 #if HAVE_CELT
00044         void
00045         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);
00046         void
00047         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);
00048 #endif
00049 #if HAVE_OPUS
00050         void
00051         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);
00052         void
00053         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);
00054 #endif
00055         void
00056         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);
00057         void
00058         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);
00059 
00060     public:
00061 
00062         JackNetOneDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
00063                            int port, int mtu, int capture_ports, int playback_ports, int midi_input_ports, int midi_output_ports,
00064                            int sample_rate, int period_size, int resample_factor,
00065                            const char* net_name, uint transport_sync, int bitdepth, int use_autoconfig,
00066                            int latency, int redundancy, int dont_htonl_floats, int always_deadline, int jitter_val);
00067         virtual ~JackNetOneDriver();
00068 
00069         int Close();
00070         int Attach();
00071         int Detach();
00072 
00073         int Read();
00074         int Write();
00075 
00076         bool Initialize();
00077         int AllocPorts();
00078         void FreePorts();
00079 
00080         // BufferSize can't be changed
00081         bool IsFixedBufferSize()
00082         {
00083             return true;
00084         }
00085 
00086         int SetBufferSize(jack_nframes_t buffer_size)
00087         {
00088             return -1;
00089         }
00090 
00091         int SetSampleRate(jack_nframes_t sample_rate)
00092         {
00093             return -1;
00094         }
00095 
00096 };
00097 
00098 }
00099 
00100 #endif