New FLV_Pack style, hopefully some fixes for HTTP dynamic

This commit is contained in:
Thulinma 2011-03-21 18:23:32 +01:00
parent b94b2e0cee
commit 97357aed98
7 changed files with 163 additions and 77 deletions

View file

@ -5,24 +5,7 @@
#include "../util/MP4/box_includes.h"
#include "../util/flv_data.cpp"
std::string tagType(FLV_Pack * F){
switch (F->data[0]){
case 0x09:
if (F->isKeyframe){
return "video keyframe";
}else{
return "video";
}
break;
case 0x08: return "audio"; break;
case 0x12: return "data"; break;
}
return "unknown";
}
int main( ) {
std::string temp;
int main(){
HTTPReader H;
FLV_Pack * F = 0;
unsigned int P = 0;
@ -30,11 +13,10 @@ int main( ) {
while (H.ReadSocket(stdin) || H.CleanForNext()){
if (H.body.size() > 10000){
Box * TestBox = new Box((uint8_t*)H.body.c_str(), H.body.size());
TestBox->Parse();
P = 0;
while (TestBox->PayloadSize > P){
if (FLV_GetPacket(F, (char*)TestBox->Payload, TestBox->PayloadSize, P)){
std::cout << "Got a " << F->len << " bytes " << tagType(F) << " FLV tag." << std::endl;
std::cout << "Got a " << F->len << " bytes " << F->tagType() << " FLV tag of time " << F->tagTime() << "." << std::endl;
}
}
delete TestBox;
@ -42,5 +24,4 @@ int main( ) {
std::cout << "Skipped too small fragment" << std::endl;
}
}
}