RTMP Connector multistreaming support
This commit is contained in:
		
							parent
							
								
									145f86f3df
								
							
						
					
					
						commit
						006da11595
					
				
					 2 changed files with 8 additions and 3 deletions
				
			
		|  | @ -61,7 +61,7 @@ int main(){ | ||||||
|     if (ready4data){ |     if (ready4data){ | ||||||
|       if (!inited){ |       if (!inited){ | ||||||
|         //we are ready, connect the socket!
 |         //we are ready, connect the socket!
 | ||||||
|         if (!ss.connect("/tmp/shared_socket")){ |         if (!ss.connect(streamname.c_str())){ | ||||||
|           #ifdef DEBUG |           #ifdef DEBUG | ||||||
|           fprintf(stderr, "Could not connect to server!\n"); |           fprintf(stderr, "Could not connect to server!\n"); | ||||||
|           #endif |           #endif | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| #include "chunkstream.cpp" //chunkstream decoding
 | #include "chunkstream.cpp" //chunkstream decoding
 | ||||||
| #include "amf.cpp" //simple AMF0 parsing
 | #include "amf.cpp" //simple AMF0 parsing
 | ||||||
| 
 | std::string streamname = "/tmp/shared_socket"; | ||||||
| 
 | 
 | ||||||
| //gets and parses one chunk
 | //gets and parses one chunk
 | ||||||
| void parseChunk(){ | void parseChunk(){ | ||||||
|  | @ -182,6 +182,11 @@ void parseChunk(){ | ||||||
|       }//checkBandwidth
 |       }//checkBandwidth
 | ||||||
|       if ((amfdata.getContentP(0)->StrValue() == "play") || (amfdata.getContentP(0)->StrValue() == "play2")){ |       if ((amfdata.getContentP(0)->StrValue() == "play") || (amfdata.getContentP(0)->StrValue() == "play2")){ | ||||||
|         //send streambegin
 |         //send streambegin
 | ||||||
|  |         streamname = amfdata.getContentP(3)->StrValue(); | ||||||
|  |         for (std::string::iterator i=streamname.end()-1; i>=streamname.begin(); --i){ | ||||||
|  |           if (!isalpha(*i) && !isdigit(*i)){streamname.erase(i);}else{*i=tolower(*i);} | ||||||
|  |         } | ||||||
|  |         streamname = "/tmp/" + streamname; | ||||||
|         SendUSR(0, 1);//send UCM StreamBegin (0), stream 1
 |         SendUSR(0, 1);//send UCM StreamBegin (0), stream 1
 | ||||||
|         //send a status reply
 |         //send a status reply
 | ||||||
|         AMFType amfreply("container", (unsigned char)0xFF); |         AMFType amfreply("container", (unsigned char)0xFF); | ||||||
|  | @ -216,7 +221,7 @@ void parseChunk(){ | ||||||
|         SendCTL(1, chunk_snd_max);//send chunk size max (msg 1)
 |         SendCTL(1, chunk_snd_max);//send chunk size max (msg 1)
 | ||||||
|         ready4data = true;//start sending video data!
 |         ready4data = true;//start sending video data!
 | ||||||
|         #ifdef DEBUG |         #ifdef DEBUG | ||||||
|         fprintf(stderr, "AMF0 command: play result\n"); |         fprintf(stderr, "AMF0 command: play result (%s)\n", streamname.c_str()); | ||||||
|         #endif |         #endif | ||||||
|         parsed = true; |         parsed = true; | ||||||
|       }//createStream
 |       }//createStream
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma