Changeset e25e47662420fc69da94bd54e36cc09fd8379dec
- Timestamp:
- 04/07/03 16:06:48
(5 years ago)
- Author:
- Mohammed Adnène Trojette <adn@videolan.org>
- git-committer:
- Mohammed Adnène Trojette <adn@videolan.org> 1057327608 +0000
- git-parent:
[348be7c1796d2d0f94e4d4e0016237dea950de9e]
- git-author:
- Mohammed Adnène Trojette <adn@videolan.org> 1057327608 +0000
- Message:
* Fix Bug thanks to Cif: url form was "IP:port" and port 1234 was
systematically sent separately.
* Multicast IP form is "@IP" and not "IP". Right ?
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r7c0d835 |
re25e476 |
|
| 47 | 47 | #define SAP_IPV6_ADDR_2 "::2:7FFE" |
|---|
| 48 | 48 | |
|---|
| | 49 | /**************************************************************************** |
|---|
| | 50 | * Split : split a string into two parts: the one which is before the delim |
|---|
| | 51 | * and the one which is after. |
|---|
| | 52 | * NULL is returned if delim is not found |
|---|
| | 53 | ****************************************************************************/ |
|---|
| | 54 | |
|---|
| | 55 | static char * split( char *p_in, char *p_out1, char *p_out2, char delim) |
|---|
| | 56 | { |
|---|
| | 57 | unsigned int i_count=0; /*pos in input string*/ |
|---|
| | 58 | unsigned int i_pos1=0; /*pos in out2 string */ |
|---|
| | 59 | unsigned int i_pos2=0; |
|---|
| | 60 | char *p_cur; /*store the pos of the first delim found */ |
|---|
| | 61 | |
|---|
| | 62 | /*skip spaces at the beginning*/ |
|---|
| | 63 | while(p_in[i_count] == ' ' && i_count < strlen(p_in)) |
|---|
| | 64 | { |
|---|
| | 65 | i_count++; |
|---|
| | 66 | } |
|---|
| | 67 | if(i_count == strlen(p_in)) |
|---|
| | 68 | return NULL; |
|---|
| | 69 | |
|---|
| | 70 | /*Look for delim*/ |
|---|
| | 71 | while(p_in[i_count] != delim && i_count < strlen(p_in)) |
|---|
| | 72 | { |
|---|
| | 73 | p_out1[i_pos1] = p_in[i_count]; |
|---|
| | 74 | i_count++; |
|---|
| | 75 | i_pos1++; |
|---|
| | 76 | } |
|---|
| | 77 | /* Mark the end of out1 */ |
|---|
| | 78 | p_out1[i_pos1] = 0; |
|---|
| | 79 | |
|---|
| | 80 | if(i_count == strlen(p_in)) |
|---|
| | 81 | return NULL; |
|---|
| | 82 | |
|---|
| | 83 | /*store pos of the first delim*/ |
|---|
| | 84 | p_cur = &p_in[i_count]; |
|---|
| | 85 | |
|---|
| | 86 | |
|---|
| | 87 | |
|---|
| | 88 | /*skip all delim and all spaces*/ |
|---|
| | 89 | while((p_in[i_count] == ' ' || p_in[i_count] == delim) && i_count < strlen(p_in)) |
|---|
| | 90 | { |
|---|
| | 91 | i_count++; |
|---|
| | 92 | } |
|---|
| | 93 | |
|---|
| | 94 | if(i_count == strlen(p_in)) |
|---|
| | 95 | return p_cur; |
|---|
| | 96 | |
|---|
| | 97 | /*Store the second string*/ |
|---|
| | 98 | while(i_count < strlen(p_in)) |
|---|
| | 99 | { |
|---|
| | 100 | p_out2[i_pos2] = p_in[i_count]; |
|---|
| | 101 | i_pos2++; |
|---|
| | 102 | i_count++; |
|---|
| | 103 | } |
|---|
| | 104 | p_out2[i_pos2] = 0; |
|---|
| | 105 | |
|---|
| | 106 | return p_cur; |
|---|
| | 107 | } |
|---|
| | 108 | |
|---|
| 49 | 109 | /***************************************************************************** |
|---|
| 50 | 110 | * sout_SAPNew: Creates a SAP Session |
|---|
| … | … | |
| 68 | 128 | return NULL; |
|---|
| 69 | 129 | } |
|---|
| 70 | | |
|---|
| | 130 | |
|---|
| 71 | 131 | /* Fill the information in the structure */ |
|---|
| 72 | | sprintf ( p_new->psz_url , "%s" , psz_url_arg ); |
|---|
| | 132 | split(psz_url_arg,p_new->psz_url,p_new->psz_port,':'); |
|---|
| | 133 | // sprintf ( p_new->psz_url , "%s" , psz_url_arg ); |
|---|
| 73 | 134 | sprintf ( p_new->psz_name , "%s" , psz_name_arg ); |
|---|
| | 135 | |
|---|
| 74 | 136 | /* Port is not implemented in sout */ |
|---|
| 75 | | sprintf ( p_new->psz_port, "%s" , psz_port_arg ); |
|---|
| | 137 | //sprintf ( p_new->psz_port, "%s" , psz_port_arg ); |
|---|
| 76 | 138 | |
|---|
| 77 | 139 | p_new->i_ip_version = ip_version; |
|---|
| … | … | |
| 222 | 284 | "t=0 0\n" |
|---|
| 223 | 285 | "m=audio %s udp 14\n" |
|---|
| 224 | | "c=IN IP4 %s/15\n" |
|---|
| | 286 | "c=IN IP4 @%s/15\n" |
|---|
| 225 | 287 | "a=type:test\n", |
|---|
| 226 | 288 | p_this->psz_name , p_this->psz_port , p_this->psz_url ); |
|---|
| 227 | | |
|---|
| | 289 | |
|---|
| | 290 | fprintf(stderr,"Sending : <%s>\n",sap_msg); |
|---|
| 228 | 291 | i_msg_size = strlen( sap_msg ); |
|---|
| 229 | 292 | i_size = i_msg_size + i_header_size; |
|---|