Commit 6000d23d authored by sletz's avatar sletz
Browse files

Support for BIG_ENDIAN machines in NetJack2 for transport data.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3400 0c269be4-1314-0410-8aa9-9f06e86f4224
parent acdb9da2
......@@ -23,6 +23,10 @@ Michael Voigt
Jackdmp changes log
---------------------------
2009-03-05 Stephane Letz <letz@grame.fr>
* Support for BIG_ENDIAN machines in NetJack2 for transport data.
2009-03-03 Stephane Letz <letz@grame.fr>
* More robust profiling tools when clients come and go.
......
......@@ -574,6 +574,7 @@ namespace Jack
//then, first step : transport
if (fParams.fTransportSync) {
EncodeTransportData();
TransportDataHToN( &fSendTransportData, &fSendTransportData);
//copy to TxBuffer
memcpy ( fTxData, &fSendTransportData, sizeof ( net_transport_data_t ) );
}
......@@ -588,6 +589,7 @@ namespace Jack
if (fParams.fTransportSync) {
//copy received transport data to transport data structure
memcpy ( &fReturnTransportData, fRxData, sizeof ( net_transport_data_t ) );
TransportDataNToH( &fReturnTransportData, &fReturnTransportData);
DecodeTransportData();
}
//then others
......@@ -949,19 +951,6 @@ namespace Jack
}
//network sync------------------------------------------------------------------------
void JackNetSlaveInterface::DecodeSyncPacket()
{
//this method contains every step of sync packet informations decoding process
//first : transport
if (fParams.fTransportSync) {
//copy received transport data to transport data structure
memcpy ( &fSendTransportData, fRxData, sizeof ( net_transport_data_t ) );
DecodeTransportData();
}
//then others
//...
}
void JackNetSlaveInterface::EncodeSyncPacket()
{
//this method contains every step of sync packet informations coding
......@@ -970,11 +959,26 @@ namespace Jack
//then first step : transport
if (fParams.fTransportSync) {
EncodeTransportData();
TransportDataHToN( &fReturnTransportData, &fReturnTransportData);
//copy to TxBuffer
memcpy ( fTxData, &fReturnTransportData, sizeof ( net_transport_data_t ) );
}
//then others
//...
}
void JackNetSlaveInterface::DecodeSyncPacket()
{
//this method contains every step of sync packet informations decoding process
//first : transport
if (fParams.fTransportSync) {
//copy received transport data to transport data structure
memcpy ( &fSendTransportData, fRxData, sizeof ( net_transport_data_t ) );
TransportDataNToH( &fSendTransportData, &fSendTransportData);
DecodeTransportData();
}
//then others
//...
}
}
......@@ -407,6 +407,56 @@ namespace Jack
dst_buffer->lost_events = ntohl(src_buffer->lost_events);
dst_buffer->mix_index = ntohl(src_buffer->mix_index);
}
SERVER_EXPORT void TransportDataHToN ( net_transport_data_t* src_params, net_transport_data_t* dst_params )
{
dst_params->fNewState = htonl(src_params->fNewState);
dst_params->fTimebaseMaster = htonl(src_params->fTimebaseMaster);
dst_params->fState = htonl(src_params->fState);
dst_params->fPosition.unique_1 = htonll(src_params->fPosition.unique_1);
dst_params->fPosition.usecs = htonl(src_params->fPosition.usecs);
dst_params->fPosition.frame_rate = htonl(src_params->fPosition.frame_rate);
dst_params->fPosition.frame = htonl(src_params->fPosition.frame);
dst_params->fPosition.bar = htonl(src_params->fPosition.bar);
dst_params->fPosition.beat = htonl(src_params->fPosition.beat);
dst_params->fPosition.tick = htonl(src_params->fPosition.tick);
dst_params->fPosition.bar_start_tick = htonll((uint64_t)src_params->fPosition.bar_start_tick);
dst_params->fPosition.beats_per_bar = htonl(src_params->fPosition.beats_per_bar);
dst_params->fPosition.beat_type = htonl(src_params->fPosition.beat_type);
dst_params->fPosition.ticks_per_beat = htonll((uint64_t)src_params->fPosition.ticks_per_beat);
dst_params->fPosition.beats_per_minute = htonll((uint64_t)src_params->fPosition.beats_per_minute);
dst_params->fPosition.frame_time = htonll((uint64_t)src_params->fPosition.frame_time);
dst_params->fPosition.next_time = htonll((uint64_t)src_params->fPosition.next_time);
dst_params->fPosition.bbt_offset = htonl(src_params->fPosition.bbt_offset);
dst_params->fPosition.audio_frames_per_video_frame = htonl(src_params->fPosition.audio_frames_per_video_frame);
dst_params->fPosition.video_offset = htonl(src_params->fPosition.video_offset);
dst_params->fPosition.unique_2 = htonll(src_params->fPosition.unique_2);
}
SERVER_EXPORT void TransportDataNToH ( net_transport_data_t* src_params, net_transport_data_t* dst_params )
{
dst_params->fNewState = ntohl(src_params->fNewState);
dst_params->fTimebaseMaster = ntohl(src_params->fTimebaseMaster);
dst_params->fState = ntohl(src_params->fState);
dst_params->fPosition.unique_1 = ntohll(src_params->fPosition.unique_1);
dst_params->fPosition.usecs = ntohl(src_params->fPosition.usecs);
dst_params->fPosition.frame_rate = ntohl(src_params->fPosition.frame_rate);
dst_params->fPosition.frame = ntohl(src_params->fPosition.frame);
dst_params->fPosition.bar = ntohl(src_params->fPosition.bar);
dst_params->fPosition.beat = ntohl(src_params->fPosition.beat);
dst_params->fPosition.tick = ntohl(src_params->fPosition.tick);
dst_params->fPosition.bar_start_tick = ntohll((uint64_t)src_params->fPosition.bar_start_tick);
dst_params->fPosition.beats_per_bar = ntohl(src_params->fPosition.beats_per_bar);
dst_params->fPosition.beat_type = ntohl(src_params->fPosition.beat_type);
dst_params->fPosition.ticks_per_beat = ntohll((uint64_t)src_params->fPosition.ticks_per_beat);
dst_params->fPosition.beats_per_minute = ntohll((uint64_t)src_params->fPosition.beats_per_minute);
dst_params->fPosition.frame_time = ntohll((uint64_t)src_params->fPosition.frame_time);
dst_params->fPosition.next_time = ntohll((uint64_t)src_params->fPosition.next_time);
dst_params->fPosition.bbt_offset = ntohl(src_params->fPosition.bbt_offset);
dst_params->fPosition.audio_frames_per_video_frame = ntohl(src_params->fPosition.audio_frames_per_video_frame);
dst_params->fPosition.video_offset = ntohl(src_params->fPosition.video_offset);
dst_params->fPosition.unique_2 = ntohll(src_params->fPosition.unique_2);
}
// Utility *******************************************************************************************************
......
......@@ -29,6 +29,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
using namespace std;
#ifndef htonll
#ifdef __BIG_ENDIAN__
#define htonll(x) (x)
#define ntohll(x) (x)
#else
#define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl(x >> 32))
#define ntohll(x) ((((uint64_t)ntohl(x)) << 32) + ntohl(x >> 32))
#endif
#endif
namespace Jack
{
typedef struct _session_params session_params_t;
......@@ -282,6 +292,8 @@ namespace Jack
SERVER_EXPORT void PacketHeaderNToH ( packet_header_t* src_header, packet_header_t* dst_header );
SERVER_EXPORT void MidiBufferHToN ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer );
SERVER_EXPORT void MidiBufferNToH ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer );
SERVER_EXPORT void TransportDataHToN ( net_transport_data_t* src_params, net_transport_data_t* dst_params );
SERVER_EXPORT void TransportDataNToH ( net_transport_data_t* src_params, net_transport_data_t* dst_params );
//display session parameters
SERVER_EXPORT void SessionParamsDisplay ( session_params_t* params );
//display packet header
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment