void Ts2Rtp::process( unsigned char *buf, int size ) { int i, n; unsigned char *buffer=buf; if ( writePsi ) { i = 0; while ( i<psiPackets ) { n = psiPackets-i; if ( n>8 ) n = 8; sendrtp( (char*)(psiBuffer+(TS_SIZE*i)), TS_SIZE*n ); i+= n; } writePsi = false; } for ( i=0; i<size; i+=TS_SIZE ) { memcpy( thBuf+thWrite, buffer, TS_SIZE ); thWrite+=TS_SIZE; if ( thWrite==(TS_SIZE*8 ) ) { sendrtp( (char*)thBuf, TS_SIZE*8 ); thWrite = 0; } buffer+=TS_SIZE; } }
void rtp_output(const char *mp3buffer, const int mp3size) { sendrtp(rtpsocket, &rtpsi, &RTPheader, mp3buffer, mp3size); RTPheader.timestamp += 5; RTPheader.b.sequence++; }