Finished FLV2DTSC code, fixed a lot of bugs in new code, added DTSC info tool.

This commit is contained in:
Thulinma 2011-09-13 17:20:39 +02:00
parent e23fbfd109
commit 1b7ab627b5
7 changed files with 432 additions and 58 deletions

23
DTSC_Analyser/Makefile Normal file
View file

@ -0,0 +1,23 @@
SRC = main.cpp ../util/dtsc.cpp
OBJ = $(SRC:.cpp=.o)
OUT = DTSC_Info
INCLUDES =
DEBUG = 4
OPTIMIZE = -g
CCFLAGS = -Wall -Wextra -funsigned-char $(OPTIMIZE) -DDEBUG=$(DEBUG)
CC = $(CROSS)g++
LD = $(CROSS)ld
AR = $(CROSS)ar
LIBS =
.SUFFIXES: .cpp
.PHONY: clean default
default: $(OUT)
.cpp.o:
$(CC) $(INCLUDES) $(CCFLAGS) $(LIBS) -c $< -o $@
$(OUT): $(OBJ)
$(CC) $(LIBS) -o $(OUT) $(OBJ)
clean:
rm -rf $(OBJ) $(OUT) Makefile.bak *~
install: $(OUT)
cp -f ./$(OUT) /usr/bin/

38
DTSC_Analyser/main.cpp Normal file
View file

@ -0,0 +1,38 @@
/// \file DTSC_Analyser/main.cpp
/// Contains the code for the DTSC Analysing tool.
#include <fcntl.h>
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include "../util/dtsc.h" //DTSC support
/// Reads DTSC from stdin and outputs human-readable information to stderr.
int main() {
DTSC::Stream Strm;
std::string inBuffer;
char charBuffer[1024*10];
unsigned int charCount;
bool doneheader = false;
while(std::cin.good()){
//invalidate the current buffer
std::cin.read(charBuffer, 1024*10);
charCount = std::cin.gcount();
inBuffer.append(charBuffer, charCount);
if (Strm.parsePacket(inBuffer)){
if (!doneheader){
doneheader = true;
Strm.metadata.Print();
}
Strm.getPacket().Print();
}
}
return 0;
}