Werkendheid
This commit is contained in:
		
							parent
							
								
									27279d31c8
								
							
						
					
					
						commit
						fbd0520264
					
				
					 2 changed files with 31 additions and 1 deletions
				
			
		
							
								
								
									
										30
									
								
								Connector_RTMPf/flv_sock.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Connector_RTMPf/flv_sock.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,30 @@
 | 
				
			||||||
 | 
					SWBaseSocket::SWBaseError SWBerr;
 | 
				
			||||||
 | 
					char * FLVbuffer;
 | 
				
			||||||
 | 
					int FLV_len;
 | 
				
			||||||
 | 
					int FLVbs = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void FLV_Readheader(SWUnixSocket & ss){
 | 
				
			||||||
 | 
					  static char header[13];
 | 
				
			||||||
 | 
					  while (ss.frecv(header, 13, &SWBerr) != 13){
 | 
				
			||||||
 | 
					    //wait
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}//FLV_Readheader
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void FLV_Dump(){FLV_len = 0;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool FLV_GetPacket(SWUnixSocket & ss){
 | 
				
			||||||
 | 
					  if (FLVbs < 15){FLVbuffer = (char*)realloc(FLVbuffer, 15); FLVbs = 15;}
 | 
				
			||||||
 | 
					  //if received a whole header, receive a whole packet
 | 
				
			||||||
 | 
					  //if not, retry header next pass
 | 
				
			||||||
 | 
					  if (FLV_len == 0){
 | 
				
			||||||
 | 
					    if (ss.frecv(FLVbuffer, 11, &SWBerr) == 11){
 | 
				
			||||||
 | 
					      FLV_len = FLVbuffer[3] + 15;
 | 
				
			||||||
 | 
					      FLV_len += (FLVbuffer[2] << 8);
 | 
				
			||||||
 | 
					      FLV_len += (FLVbuffer[1] << 16);
 | 
				
			||||||
 | 
					      if (FLVbs < FLV_len){FLVbuffer = (char*)realloc(FLVbuffer, FLV_len);FLVbs = FLV_len;}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }else{
 | 
				
			||||||
 | 
					    if (ss.frecv(FLVbuffer+11, FLV_len-11, &SWBerr) == FLV_len-11){return true;}
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return false;
 | 
				
			||||||
 | 
					}//FLV_GetPacket
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ timeval lastrec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "parsechunks.cpp" //chunkstream parsing
 | 
					#include "parsechunks.cpp" //chunkstream parsing
 | 
				
			||||||
#include "handshake.cpp" //handshaking
 | 
					#include "handshake.cpp" //handshaking
 | 
				
			||||||
#include "../util/flv_sock.cpp" //FLV parsing with SocketW
 | 
					#include "flv_sock.cpp" //FLV parsing with SocketW
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(){
 | 
					int main(){
 | 
				
			||||||
  unsigned int ts;
 | 
					  unsigned int ts;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue