Nieuwe awesome parser des doods voor RAW tcpflow logs van F4M streams, en hopelijk fix voor F4M streams zelf, nieuwe dataparser voor FLV streams, en awesomeheid in het algemeen

This commit is contained in:
Thulinma 2011-03-21 00:40:49 +01:00
parent ef99414220
commit 4613a1d306
7 changed files with 233 additions and 11 deletions

19
HTTP_Box_Parser/Makefile Normal file
View file

@ -0,0 +1,19 @@
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
OUT = Box_Parser
INCLUDES =
CCFLAGS = -Wall -Wextra -funsigned-char -g
CC = $(CROSS)g++
LD = $(CROSS)ld
AR = $(CROSS)ar
LIBS = -lssl -lcrypto
.SUFFIXES: .cpp
.PHONY: clean default
default: $(OUT)
.cpp.o:
$(CC) $(INCLUDES) $(CCFLAGS) -c $< -o $@
$(OUT): $(OBJ)
$(CC) $(LIBS) -o $(OUT) $(OBJ)
clean:
rm -rf $(OBJ) $(OUT) Makefile.bak *~

46
HTTP_Box_Parser/main.cpp Normal file
View file

@ -0,0 +1,46 @@
#include <stdint.h>
#include <iostream>
#include <string>
#include "../util/http_parser.cpp"
#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;
HTTPReader H;
FLV_Pack * F = 0;
unsigned int P = 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());
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;
}
}
delete TestBox;
}else{
std::cout << "Skipped too small fragment" << std::endl;
}
}
}