Werkende RTMP connector! WHEEEE! Also, RTMPf weggegooit. Er is geen ruimte voor faal in dit bedrijf!

This commit is contained in:
Thulinma 2010-11-17 01:05:36 +01:00
parent c1c4f30498
commit be1b8068a4
2 changed files with 12 additions and 12 deletions

View file

@ -46,12 +46,12 @@ int DDV_Listen(int port){
if (ret == 0){ if (ret == 0){
return s; return s;
}else{ }else{
printf("Listen failed! Error: %s\n", strerror(errno)); fprintf(stderr, "Listen failed! Error: %s\n", strerror(errno));
close(s); close(s);
return 0; return 0;
} }
}else{ }else{
printf("Binding failed! Error: %s\n", strerror(errno)); fprintf(stderr, "Binding failed! Error: %s\n", strerror(errno));
close(s); close(s);
return 0; return 0;
} }
@ -77,7 +77,7 @@ bool DDV_write(void * buffer, int todo, int sock){
case EWOULDBLOCK: socketBlocking = true; break; case EWOULDBLOCK: socketBlocking = true; break;
default: default:
socketError = true; socketError = true;
printf("Could not write! %s\n", strerror(errno)); fprintf(stderr, "Could not write! %s\n", strerror(errno));
return false; return false;
break; break;
} }
@ -87,14 +87,14 @@ bool DDV_write(void * buffer, int todo, int sock){
return true; return true;
} }
bool DDV_ready(int sock){ signed int DDV_ready(int sock){
char tmp; char tmp;
int preflags = fcntl(sock, F_GETFL, 0); int preflags = fcntl(sock, F_GETFL, 0);
int postflags = preflags | O_NONBLOCK; int postflags = preflags | O_NONBLOCK;
fcntl(sock, F_SETFL, postflags); fcntl(sock, F_SETFL, postflags);
int r = recv(sock, &tmp, 1, MSG_PEEK); int r = recv(sock, &tmp, 1, MSG_PEEK);
fcntl(sock, F_SETFL, preflags); fcntl(sock, F_SETFL, preflags);
return (r == 1); return r;
} }
bool DDV_read(void * buffer, int todo, int sock){ bool DDV_read(void * buffer, int todo, int sock){
@ -107,7 +107,7 @@ bool DDV_read(void * buffer, int todo, int sock){
case EWOULDBLOCK: socketBlocking = true; break; case EWOULDBLOCK: socketBlocking = true; break;
default: default:
socketError = true; socketError = true;
printf("Could not read! %s\n", strerror(errno)); fprintf(stderr, "Could not read! %s\n", strerror(errno));
return false; return false;
break; break;
} }
@ -129,7 +129,7 @@ int DDV_iwrite(void * buffer, int todo, int sock){
case EWOULDBLOCK: break; case EWOULDBLOCK: break;
default: default:
socketError = true; socketError = true;
printf("Could not write! %s\n", strerror(errno)); fprintf(stderr, "Could not write! %s\n", strerror(errno));
return false; return false;
break; break;
} }
@ -144,7 +144,7 @@ int DDV_iread(void * buffer, int todo, int sock){
case EWOULDBLOCK: break; case EWOULDBLOCK: break;
default: default:
socketError = true; socketError = true;
printf("Could not read! %s\n", strerror(errno)); fprintf(stderr, "Could not read! %s\n", strerror(errno));
return false; return false;
break; break;
} }

View file

@ -69,6 +69,7 @@ bool FLV_GetPacket(FLV_Pack *& p, int sock){
if (FLV_Checkheader(p->data)){ if (FLV_Checkheader(p->data)){
sofar = 0; sofar = 0;
memcpy(FLVHeader, p->data, 13); memcpy(FLVHeader, p->data, 13);
//fwrite(p->data, 13, 1, stdout);//output raw stream
}else{ }else{
All_Hell_Broke_Loose = true; All_Hell_Broke_Loose = true;
fprintf(stderr, "Invalid FLV header. All Hell Broke Loose!\n"); fprintf(stderr, "Invalid FLV header. All Hell Broke Loose!\n");
@ -94,12 +95,11 @@ bool FLV_GetPacket(FLV_Pack *& p, int sock){
testlen += (p->data[p->len-2] << 8); testlen += (p->data[p->len-2] << 8);
testlen += (p->data[p->len-3] << 16); testlen += (p->data[p->len-3] << 16);
testlen += (p->data[p->len-4] << 24); testlen += (p->data[p->len-4] << 24);
if (p->len == testlen){ //fwrite(p->data, p->len, 1, stdout);//output raw stream
fprintf(stderr, "Correct length tag...\n"); if (p->len != testlen){
}else{
fprintf(stderr, "Len: %i, testlen: %i\n", p->len, testlen); fprintf(stderr, "Len: %i, testlen: %i\n", p->len, testlen);
All_Hell_Broke_Loose = true; All_Hell_Broke_Loose = true;
fprintf(stderr, "ReadUntil fail: > 500kb tag? All Hell Broke Loose!\n", strerror(errno)); fprintf(stderr, "ReadUntil fail: Wrong size tag? All Hell Broke Loose!\n");
return false; return false;
} }
done = true; done = true;