Merge branch 'master' of projectlivestream.com:pls
This commit is contained in:
commit
a7618f37a8
1 changed files with 42 additions and 6 deletions
|
@ -33,6 +33,24 @@ timeval lastrec;
|
|||
#include "rtsp.cpp"
|
||||
#include "rtp.h"
|
||||
|
||||
void parse_ip(char* ip_addr, uint8_t * uitvoer) {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int tempint = 0;
|
||||
while( ip_addr[i] != '\0' ) {
|
||||
if( ip_addr[i] != '.' ) {
|
||||
tempint = tempint * 10;
|
||||
tempint += ip_addr[i] - '0';
|
||||
} else {
|
||||
uitvoer[j] = tempint;
|
||||
tempint = 0;
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
uitvoer[j] = tempint;
|
||||
}
|
||||
|
||||
int main(){
|
||||
unsigned int ts;
|
||||
unsigned int fts = 0;
|
||||
|
@ -70,9 +88,23 @@ int main(){
|
|||
transparams.SetPortbase(serverport);
|
||||
rtp_connection.Create(sessionparams,&transparams);
|
||||
|
||||
struct sockaddr_in i;
|
||||
int len;
|
||||
char * addr1;
|
||||
len = sizeof(i);
|
||||
if (getpeername( fileno(stdin), (sockaddr*)&i, (socklen_t*)&len ) == 0) {
|
||||
addr1 = (char *) inet_ntoa(i.sin_addr);
|
||||
DEBUG("%s\n", addr1 );
|
||||
} else {
|
||||
DEBUG("Blaah\n");
|
||||
}
|
||||
|
||||
uint8_t clientip[4];
|
||||
parse_ip(addr1,clientip);
|
||||
|
||||
//TODO: clientip ophalen uit stdin-socket: zie http://www.mail-archive.com/plug@lists.q-linux.com/msg16482.html
|
||||
uint8_t clientip[]={127,0,0,1};
|
||||
RTPIPv4Address addr(clientip,clientport);
|
||||
DEBUG("RTP Connected\n");
|
||||
|
||||
inited = true;
|
||||
}
|
||||
|
@ -100,18 +132,22 @@ int main(){
|
|||
|
||||
if( FLVbuffer[0] != 0x12 ) {//Metadata direct filteren.
|
||||
if( FLVbuffer[0] == 0x08 ) { //Audio Packet
|
||||
DEBUG("Audio Packet\n");
|
||||
rtp_connection.SetTimestampUnit(1.0/11025);//11025 samples/second
|
||||
// RTPSession::SendPacket( void * data , length , payload_type , marker , timestampincrement );
|
||||
//Audiodata heeft na de flv-tag nog 2 UI8 aan beschrijvingen die NIET bij de AAC-data horen
|
||||
//NOTE:Same als hieronder, wat moeten we doen met init-data van aac? die info wordt nu omitted.
|
||||
rtp_connection.SendPacket( &FLVbuffer[13], FLV_len - 17, 99 , false , 1 );
|
||||
rtp_connection.SendPacket( &FLVbuffer[13], FLV_len - 17, 99, false, 1);
|
||||
} else if ( FLVbuffer[0] == 0x09 ) { //Video Packet
|
||||
DEBUG("Video Packet\n");
|
||||
rtp_connection.SetTimestampUnit(1.0/90000);//90000 samples/second
|
||||
//Videodata heeft na de flv-tag nog 2 UI8 en een SI24 aan beschrijvingen die niet bij de NALU horen
|
||||
//NOTE:Moeten we eigenlijk wat adobe genereert als sequence headers/endings ook gwoon doorsturen? gebeurt nu wel
|
||||
rtp_connection.SendPacket( &FLVbuffer[16], FLV_len - 19, 98 , false , 1 );
|
||||
rtp_connection.SendPacket( &FLVbuffer[16], FLV_len - 19, 98, false, 1);
|
||||
}
|
||||
}//Datatype 0x12 = metadata, zouden we voor nu weggooien
|
||||
} else {//Datatype 0x12 = metadata, zouden we voor nu weggooien
|
||||
DEBUG("Metadata, throwing away\n");
|
||||
}
|
||||
FLV_Dump();//dump packet and get ready for next
|
||||
}
|
||||
if ((SWBerr != SWBaseSocket::ok) && (SWBerr != SWBaseSocket::notReady)){
|
||||
|
|
Loading…
Add table
Reference in a new issue