make docs now works (needs doxygen installed), added documentation to a LOT of stuff, refactored most utility functions, complete rewrites of DDV sockets and the FLV parsers, updated HTTP_Box_Parser and Connector_HTTP to be able to cope with these new changes - Connector_RTMP, Buffer and Connector_RAW are currently broken. Need to be fixed ASAP.

This commit is contained in:
Thulinma 2011-04-06 03:53:30 +02:00
parent 1ea85a27df
commit cc78697ba2
19 changed files with 1470 additions and 918 deletions

40
util/flv_tag.h Normal file
View file

@ -0,0 +1,40 @@
#pragma once
#include "ddv_socket.h"
#include <string>
/// This namespace holds all FLV-parsing related functionality.
namespace FLV {
//variables
extern char Header[13]; ///< Holds the last FLV header parsed.
extern bool Parse_Error; ///< This variable is set to true if a problem is encountered while parsing the FLV.
//functions
bool check_header(char * header); ///< Checks a FLV Header for validness.
bool is_header(char * header); ///< Checks the first 3 bytes for the string "FLV".
/// This class is used to hold, work with and get information about a single FLV tag.
class Tag {
public:
int len; ///< Actual length of tag.
bool isKeyframe; ///< True if current tag is a video keyframe.
char * data; ///< Pointer to tag buffer.
std::string tagType(); ///< Returns a std::string describing the tag in detail.
unsigned int tagTime(); ///< Returns the 32-bit timestamp of this tag.
void tagTime(unsigned int T); ///< Sets the 32-bit timestamp of this tag.
Tag(); ///< Constructor for a new, empty, tag.
Tag(const Tag& O); ///< Copy constructor, copies the contents of an existing tag.
Tag & operator= (const Tag& O); ///< Assignment operator - works exactly like the copy constructor.
//loader functions
bool MemLoader(char * D, unsigned int S, unsigned int & P);
bool SockLoader(int sock);
bool SockLoader(DDV::Socket sock);
bool FileLoader(FILE * f);
protected:
int buf; ///< Maximum length of buffer space.
//loader helper functions
bool MemReadUntil(char * buffer, unsigned int count, unsigned int & sofar, char * D, unsigned int S, unsigned int & P);
bool SockReadUntil(char * buffer, unsigned int count, unsigned int & sofar, DDV::Socket & sock);
bool FileReadUntil(char * buffer, unsigned int count, unsigned int & sofar, FILE * f);
};//Tag
};//FLV namespace