37 #ifdef CCXX_NAMESPACES
70 local_ip =
"127.0.0.1";
75 cerr <<
"Rx: IP address is not correct!" << endl;
82 ssrc = socket->getLocalSSRC();
86 cout << endl <<
"Destroying receiver -ID: " << hex
90 cout <<
"... " <<
"destroyed.";
101 socket->setSchedulingTimeout(20000);
102 socket->setExpireTimeout(3000000);
105 cerr <<
"Rx (" << hex << (
int)ssrc
106 <<
"): could not connect to port."
109 cout <<
"Rx (" << hex << (int)ssrc
110 <<
"): " << local_ip.getHostname()
111 <<
" is waiting for salutes in port "
115 socket->startRunning();
118 cout <<
"Rx (" << hex << (int)ssrc
119 <<
"): The queue is "
120 << ( socket->isActive() ?
"" :
"in")
121 <<
"active." << endl;
124 for(
int i = 0 ; true ; i++ ){
128 while ( NULL == adu ) {
130 adu = socket->
getData(socket->getFirstTimestamp());
135 time_t receiving_time = time(NULL);
137 strftime(tmstring,30,
"%X",localtime(&receiving_time));
138 cout <<
"Rx (" << hex << (int)ssrc
139 <<
"): [receiving at " << tmstring <<
"]: "
167 local_ip =
"127.0.0.1";
172 cerr <<
"Tx: IP address is not correct!" << endl;
177 ssrc = socket->getLocalSSRC();
181 cout << endl <<
"Destroying transmitter -ID: " << hex
185 cout <<
"... " <<
"destroyed.";
191 cout <<
"Tx (" << hex << (int)ssrc <<
"): " <<
192 local_ip.getHostname()
193 <<
" is going to salute perself through "
194 << local_ip <<
"..." << endl;
197 socket->setSchedulingTimeout(20000);
198 socket->setExpireTimeout(3000000);
200 cerr <<
"Tx (" << hex << (
int)ssrc
201 <<
"): could not connect to port."
204 cout <<
"Tx (" << hex << (int)ssrc <<
205 "): Transmitting salutes to port "
206 << RECEIVER_BASE <<
"..." << endl;
208 uint32 timestamp = 0;
210 TimerPort::setTimer(1000);
214 socket->startRunning();
217 cout <<
"Tx (" << hex << (int)ssrc <<
"): The queue is "
218 << ( socket->isActive()?
"" :
"in")
219 <<
"active." << endl;
221 for(
int i = 0 ; true ;i++ ){
226 unsigned char salute[50];
227 snprintf((
char *)salute,50,
228 "Hello, brave gnu world (#%u)!",i);
229 time_t sending_time = time(NULL);
232 timestamp = socket->getCurrentTimestamp();
236 timestamp += socket->getCurrentRTPClockRate();
239 socket->putData(timestamp,salute,
240 strlen((
char *)salute)+1);
243 strftime(tmstring,30,
"%X",
244 localtime(&sending_time));
245 cout <<
"Tx (" << hex << (int)ssrc
246 <<
"): sending salute " <<
"no " << dec << i
247 <<
", at " << tmstring
251 Thread::sleep(TimerPort::getTimer());
252 TimerPort::incTimer(1000);
257 int main(
int argc,
char *argv[])
264 cout <<
"This is rtphello, a very simple test program for ccRTP." <<
265 endl <<
"Strike [Enter] when you are fed up with it." << endl;
269 transmitter->start();
276 cout << endl <<
"That's all." << endl;
Interface (envelope) to data received over RTP packets.
Canonical end-point identifier.
SingleThreadRTPSession RTPSession
Uses two pairs of sockets for RTP data and RTCP transmission/reception.
const int TRANSMITTER_BASE
This template class adds the threading aspect to the RTPSessionBase template in one of the many possi...
int main(int argc, char *argv[])
const uint8 *const getData() const
Get data as it is received in RTP packets (i.e.
MPEG 2 Transport stream (RFCs 1890, 2250)
Generic and audio/video profile specific RTP interface of ccRTP.
__EXPORT RTPApplication & defaultApplication()
Get the RTPApplication object for the "default" application (the only one used by common applications...