box.cpp herschreven voor snelheid en bugloosheid. Plus, coole edits in het algemeen.

This commit is contained in:
Thulinma 2011-03-21 20:28:02 +01:00
parent c12c5d1f97
commit 95f62fde10
4 changed files with 27 additions and 69 deletions

View file

@ -10,20 +10,22 @@ int main(){
HTTPReader H;
FLV_Pack * F = 0;
unsigned int P = 0;
char * Payload = 0;
while (H.ReadSocket(stdin) || H.CleanForNext()){
if (H.body.size() > 10000){
Box * TestBox = new Box((uint8_t*)H.body.c_str(), H.body.size());
printf("First bytes: %2hhu %2hhu %2hhu %2hhu\n", ((char*)TestBox->Payload)[0], ((char*)TestBox->Payload)[1], ((char*)TestBox->Payload)[2], ((char*)TestBox->Payload)[3]);
Payload = (char*)TestBox->GetPayload();
printf("First bytes: %2hhu %2hhu %2hhu %2hhu\n", Payload[0], Payload[1], Payload[2], Payload[3]);
P = 0;
while (TestBox->PayloadSize > P){
if (FLV_GetPacket(F, (char*)TestBox->Payload, TestBox->PayloadSize, P)){
while (TestBox->GetPayloadSize() > P){
if (FLV_GetPacket(F, Payload, TestBox->GetPayloadSize(), P)){
std::cout << "Got a " << F->len << " bytes " << F->tagType() << " FLV tag of time " << F->tagTime() << "." << std::endl;
}
}
delete TestBox;
}else{
std::cout << "Skipped too small fragment" << std::endl;
std::cout << "Skipped too small fragment of size " << H.body.size() << std::endl;
}
}
}