Alles werkend - maar echte flash clients zijn het daar niet meer eens, raar genoeg...
This commit is contained in:
parent
268fd2c37d
commit
6f34364989
2 changed files with 2 additions and 25 deletions
|
@ -94,7 +94,7 @@ public:
|
||||||
// noWait - operations block but only once
|
// noWait - operations block but only once
|
||||||
// useful with blocking w. select()
|
// useful with blocking w. select()
|
||||||
// nonblocking - don't block (you should use select())
|
// nonblocking - don't block (you should use select())
|
||||||
enum block_type{blocking, noWait, nonblocking};
|
enum block_type{nonblocking, noWait, blocking};
|
||||||
|
|
||||||
|
|
||||||
// Connection methods
|
// Connection methods
|
||||||
|
|
25
util/flv.cpp
25
util/flv.cpp
|
@ -17,18 +17,6 @@ void Magic_Read(char * buf, int len, int file){
|
||||||
|
|
||||||
//reads a FLV header and checks for correctness
|
//reads a FLV header and checks for correctness
|
||||||
//returns true if everything is alright, false otherwise
|
//returns true if everything is alright, false otherwise
|
||||||
bool FLV_Readheader(int file){
|
|
||||||
Magic_Read(FLVHeader,13,file);
|
|
||||||
if (FLVHeader[0] != 'F') return false;
|
|
||||||
if (FLVHeader[1] != 'L') return false;
|
|
||||||
if (FLVHeader[2] != 'V') return false;
|
|
||||||
if (FLVHeader[8] != 0x09) return false;
|
|
||||||
if (FLVHeader[9] != 0) return false;
|
|
||||||
if (FLVHeader[10] != 0) return false;
|
|
||||||
if (FLVHeader[11] != 0) return false;
|
|
||||||
if (FLVHeader[12] != 0) return false;
|
|
||||||
return true;
|
|
||||||
}//FLV_Readheader
|
|
||||||
bool FLV_Readheader(){
|
bool FLV_Readheader(){
|
||||||
fread(FLVHeader,1,13,stdin);
|
fread(FLVHeader,1,13,stdin);
|
||||||
if (FLVHeader[0] != 'F') return false;
|
if (FLVHeader[0] != 'F') return false;
|
||||||
|
@ -46,17 +34,6 @@ bool FLV_Readheader(){
|
||||||
//will assign pointer if null
|
//will assign pointer if null
|
||||||
//resizes FLV_Pack data field bigger if data doesn't fit
|
//resizes FLV_Pack data field bigger if data doesn't fit
|
||||||
// (does not auto-shrink for speed!)
|
// (does not auto-shrink for speed!)
|
||||||
void FLV_GetPacket(FLV_Pack *& p, int file){
|
|
||||||
if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));}
|
|
||||||
if (p->buf < 15){p->data = (char*)realloc(p->data, 15); p->buf = 15;}
|
|
||||||
Magic_Read(p->data,11,file);
|
|
||||||
p->len = p->data[3] + 15;
|
|
||||||
p->len += (p->data[2] << 8);
|
|
||||||
p->len += (p->data[1] << 16);
|
|
||||||
if (p->buf < p->len){p->data = (char*)realloc(p->data, p->len);}
|
|
||||||
Magic_Read(p->data+11,p->len-11,file);
|
|
||||||
}//FLV_GetPacket
|
|
||||||
|
|
||||||
void FLV_GetPacket(FLV_Pack *& p){
|
void FLV_GetPacket(FLV_Pack *& p){
|
||||||
if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));}
|
if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));}
|
||||||
if (p->buf < 15){p->data = (char*)realloc(p->data, 15); p->buf = 15;}
|
if (p->buf < 15){p->data = (char*)realloc(p->data, 15); p->buf = 15;}
|
||||||
|
@ -64,6 +41,6 @@ void FLV_GetPacket(FLV_Pack *& p){
|
||||||
p->len = p->data[3] + 15;
|
p->len = p->data[3] + 15;
|
||||||
p->len += (p->data[2] << 8);
|
p->len += (p->data[2] << 8);
|
||||||
p->len += (p->data[1] << 16);
|
p->len += (p->data[1] << 16);
|
||||||
if (p->buf < p->len){p->data = (char*)realloc(p->data, p->len);}
|
if (p->buf < p->len){p->data = (char*)realloc(p->data, p->len);p->buf = p->len;}
|
||||||
fread(p->data+11,1,p->len-11,stdin);
|
fread(p->data+11,1,p->len-11,stdin);
|
||||||
}//FLV_GetPacket
|
}//FLV_GetPacket
|
||||||
|
|
Loading…
Add table
Reference in a new issue