[Jackrtp-cvs] jackrtp/src JThread.c,1.2,1.3 JackSink.cpp,1.1,1.2 JackSource.cpp,1.1.1.1,1.2 jackrtp_
Status: Alpha
Brought to you by:
p_tisserand
|
From: Schampijer, S. <er...@us...> - 2004-07-29 15:15:36
|
Update of /cvsroot/jackrtp/jackrtp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25156/src Modified Files: JThread.c JackSink.cpp JackSource.cpp jackrtp_receive.cpp jackrtp_send.cpp Log Message: - cleaned the code. Index: jackrtp_receive.cpp =================================================================== RCS file: /cvsroot/jackrtp/jackrtp/src/jackrtp_receive.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** jackrtp_receive.cpp 29 Jul 2004 13:04:58 -0000 1.1 --- jackrtp_receive.cpp 29 Jul 2004 15:15:18 -0000 1.2 *************** *** 31,41 **** #include <BasicUsageEnvironment.hh> #include <GroupsockHelper.hh> ! #include <jacklive/JackSink.hh> ! #include <jacklive/threadinfo.h> //the default ringbuffersize #define DEFAULT_RB_SIZE 16384 - const size_t sample_size = sizeof(jack_default_audio_sample_t); extern "C" --- 31,40 ---- #include <BasicUsageEnvironment.hh> #include <GroupsockHelper.hh> ! #include <jackrtp/JackSink.hh> ! #include <jackrtp/threadinfo.h> //the default ringbuffersize #define DEFAULT_RB_SIZE 16384 extern "C" *************** *** 45,51 **** /*jack functions*/ ! int process (jack_nframes_t nframes, void *args); void jack_shutdown (void *arg); ! void setup_ports(jack_thread_info_t *info); }; --- 44,50 ---- /*jack functions*/ ! int process_out(jack_nframes_t nframes, void *args); void jack_shutdown (void *arg); ! void setup_ports(jack_thread_info_t *info, int is_input); }; *************** *** 95,102 **** run the jackprocess*/ thread_info.can_process = 0; ! thread_info.can_read = 0; /*set the callback for our client*/ ! jack_set_process_callback (client, process, &thread_info); jack_on_shutdown (client, jack_shutdown, &thread_info); --- 94,101 ---- run the jackprocess*/ thread_info.can_process = 0; ! thread_info.setup_ports = 0; /*set the callback for our client*/ ! jack_set_process_callback (client, process_out, &thread_info); jack_on_shutdown (client, jack_shutdown, &thread_info); *************** *** 129,133 **** RTPSource* rtpSource; unsigned char rtpPayloadFormat = 96; ! char const* mimeType = "L8"; rtpSource = SimpleRTPSource::createNew(*env, &rtpGroupsock, rtpPayloadFormat, 0, mimeType, 0, True); --- 128,132 ---- RTPSource* rtpSource; unsigned char rtpPayloadFormat = 96; ! char const* mimeType = "L16"; rtpSource = SimpleRTPSource::createNew(*env, &rtpGroupsock, rtpPayloadFormat, 0, mimeType, 0, True); *************** *** 152,157 **** thread_info.channels = 2; ! /*Setup the Jack outputports*/ ! setup_ports(&thread_info); /*Activate the jackclient*/ --- 151,156 ---- thread_info.channels = 2; ! /*Setup the Jack ports of the client, 0 we create output ports*/ ! setup_ports(&thread_info, 0); /*Activate the jackclient*/ Index: jackrtp_send.cpp =================================================================== RCS file: /cvsroot/jackrtp/jackrtp/src/jackrtp_send.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** jackrtp_send.cpp 29 Jul 2004 11:37:07 -0000 1.1.1.1 --- jackrtp_send.cpp 29 Jul 2004 15:15:18 -0000 1.2 *************** *** 30,35 **** #include <BasicUsageEnvironment.hh> #include <GroupsockHelper.hh> ! #include <jacklive/JackSource.hh> ! #include <jacklive/threadinfo.h> /* the default ringbuffersize */ --- 30,35 ---- #include <BasicUsageEnvironment.hh> #include <GroupsockHelper.hh> ! #include <jackrtp/JackSource.hh> ! #include <jackrtp/threadinfo.h> /* the default ringbuffersize */ *************** *** 43,49 **** /* jack functions */ ! int process (jack_nframes_t nframes, void *args); void jack_shutdown (void *arg); ! void setup_ports(jack_thread_info_t *info); } --- 43,49 ---- /* jack functions */ ! int process_in(jack_nframes_t nframes, void *args); void jack_shutdown (void *arg); ! void setup_ports(jack_thread_info_t *info, int is_input); } *************** *** 94,100 **** thread_info.channels = NUMBER_CHANNELS; thread_info.can_process = 0; ! thread_info.can_capture = 0; ! jack_set_process_callback (client, process, &thread_info); jack_on_shutdown (client, jack_shutdown, &thread_info); --- 94,100 ---- thread_info.channels = NUMBER_CHANNELS; thread_info.can_process = 0; ! thread_info.setup_ports = 0; ! jack_set_process_callback (client, process_in, &thread_info); jack_on_shutdown (client, jack_shutdown, &thread_info); *************** *** 180,186 **** /*Note: This starts RTCP running automatically*/ ! ! /*setup ports*/ ! setup_ports(&thread_info); if (jack_activate (client)) --- 180,185 ---- /*Note: This starts RTCP running automatically*/ ! /*Setup the Jack ports of the client, 1 we create input ports*/ ! setup_ports(&thread_info, 1); if (jack_activate (client)) Index: JackSource.cpp =================================================================== RCS file: /cvsroot/jackrtp/jackrtp/src/JackSource.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** JackSource.cpp 29 Jul 2004 11:37:07 -0000 1.1.1.1 --- JackSource.cpp 29 Jul 2004 15:15:18 -0000 1.2 *************** *** 27,34 **** #include <unistd.h> #include <GroupsockHelper.hh> - #include <jacklive/threadinfo.h> #include <jack/jack.h> #include <jack/ringbuffer.h> ! #include <jacklive/JackSource.hh> #define MAX_RTP_PACKET_SIZE 1400 // maximun length for a RTP packet --- 27,35 ---- #include <unistd.h> #include <GroupsockHelper.hh> #include <jack/jack.h> #include <jack/ringbuffer.h> ! ! #include <jackrtp/threadinfo.h> ! #include <jackrtp/JackSource.hh> #define MAX_RTP_PACKET_SIZE 1400 // maximun length for a RTP packet *************** *** 63,67 **** ? desiredSamplesPerFrame : c_maxNumberOfSamples; m_PreferredFrameSize = samplesPerFrame * c_elemSize; - //m_thread_info->can_capture = 1; } --- 64,67 ---- *************** *** 84,88 **** /*Now the process function of Jack can write audio data into the ringbuffer*/ ! m_thread_info->can_capture = 1; // Try to read as many bytes as will fit in the buffer provided --- 84,88 ---- /*Now the process function of Jack can write audio data into the ringbuffer*/ ! m_thread_info->can_process = 1; // Try to read as many bytes as will fit in the buffer provided Index: JThread.c =================================================================== RCS file: /cvsroot/jackrtp/jackrtp/src/JThread.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JThread.c 29 Jul 2004 13:04:58 -0000 1.2 --- JThread.c 29 Jul 2004 15:15:18 -0000 1.3 *************** *** 22,26 **** #include <stdio.h> ! #include <jacklive/threadinfo.h> static long overruns = 0; --- 22,26 ---- #include <stdio.h> ! #include <jackrtp/threadinfo.h> static long overruns = 0; *************** *** 56,60 **** /* Do nothing until we're ready to begin. */ ! if ((!info->can_process) || (!info->can_capture)) return 0; --- 56,60 ---- /* Do nothing until we're ready to begin. */ ! if ((!info->setup_ports) || (!info->can_process)) return 0; *************** *** 85,89 **** /* Do nothing until we're ready to begin. */ ! if ((!info->can_process) || (!info->can_read)) return 0; --- 85,89 ---- /* Do nothing until we're ready to begin. */ ! if ((!info->setup_ports) || (!info->can_process)) return 0; *************** *** 126,134 **** * create a delay that would force JACK to shut us down. */ ! if (is_input) ! memset(in, 0, size); //fills the n-bytes(size) of the pointed memory area(in) else ! memset(out, 0, size); //fills the n-bytes(size) of the pointed memory area(in) ! //with that byte(0) ->in this case we initialize with zero memset( info->ringbuffer->buf, 0, info->ringbuffer->size); //same here --- 126,139 ---- * create a delay that would force JACK to shut us down. */ ! if (is_input == 1) ! { ! in = (jack_default_audio_sample_t **) malloc (size); ! memset(in, 0, size); //fills the n-bytes(size) of the pointed memory area(in) ! } else ! { ! out = (jack_default_audio_sample_t **) malloc (size); ! memset(out, 0, size); //fills the n-bytes(size) of the pointed memory area(in) ! } //with that byte(0) ->in this case we initialize with zero memset( info->ringbuffer->buf, 0, info->ringbuffer->size); //same here *************** *** 158,161 **** } ! info->can_process = 1; /* process() can start, now */ } --- 163,166 ---- } ! info->setup_ports = 1; /* process() can start, now */ } Index: JackSink.cpp =================================================================== RCS file: /cvsroot/jackrtp/jackrtp/src/JackSink.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JackSink.cpp 29 Jul 2004 13:04:58 -0000 1.1 --- JackSink.cpp 29 Jul 2004 15:15:18 -0000 1.2 *************** *** 25,32 **** #include <iostream> #include <liveMedia.hh> - #include <jacklive/threadinfo.h> - #include <jacklive/JackSink.hh> #include <GroupsockHelper.hh> ////////// JackSink ////////// --- 25,33 ---- #include <iostream> #include <liveMedia.hh> #include <GroupsockHelper.hh> + #include <jackrtp/threadinfo.h> + #include <jackrtp/JackSink.hh> + ////////// JackSink ////////// *************** *** 63,67 **** Boolean JackSink::continuePlaying() { ! m_thread_info->can_read = 1; short sample; --- 64,68 ---- Boolean JackSink::continuePlaying() { ! m_thread_info->can_process = 1; short sample; |