Mercurial > mplayer.hg
comparison libmpdemux/librtsp/rtsp.c @ 18851:703273c5e860
2 more unused functions removal (trying to sync with xine)
author | ben |
---|---|
date | Thu, 29 Jun 2006 21:27:07 +0000 |
parents | bb64a42a4559 |
children | b17648e2762e |
comparison
equal
deleted
inserted
replaced
18850:bb64a42a4559 | 18851:703273c5e860 |
---|---|
112 | 112 |
113 /* | 113 /* |
114 * network utilities | 114 * network utilities |
115 */ | 115 */ |
116 | 116 |
117 static int host_connect_attempt(struct in_addr ia, int port) { | |
118 | |
119 int s; | |
120 struct sockaddr_in sin; | |
121 | |
122 s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); | |
123 if (s == -1) { | |
124 mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: socket(): %s\n", strerror(errno)); | |
125 return -1; | |
126 } | |
127 | |
128 sin.sin_family = AF_INET; | |
129 sin.sin_addr = ia; | |
130 sin.sin_port = htons(port); | |
131 | |
132 if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 | |
133 #ifndef HAVE_WINSOCK2 | |
134 && errno != EINPROGRESS) { | |
135 #else | |
136 && WSAGetLastError() == WSAEINPROGRESS) { | |
137 #endif | |
138 mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: connect(): %s\n", strerror(errno)); | |
139 closesocket(s); | |
140 return -1; | |
141 } | |
142 | |
143 return s; | |
144 } | |
145 | |
146 static int host_connect(const char *host, int port) { | |
147 | |
148 struct hostent *h; | |
149 int i, s; | |
150 | |
151 h = gethostbyname(host); | |
152 if (h == NULL) { | |
153 mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: unable to resolve '%s'.\n", host); | |
154 return -1; | |
155 } | |
156 | |
157 for (i = 0; h->h_addr_list[i]; i++) { | |
158 struct in_addr ia; | |
159 | |
160 memcpy (&ia, h->h_addr_list[i], 4); | |
161 s = host_connect_attempt(ia, port); | |
162 if(s != -1) | |
163 return s; | |
164 } | |
165 mp_msg(MSGT_OPEN, MSGL_ERR, "rtsp: unable to connect to '%s'.\n", host); | |
166 return -1; | |
167 } | |
168 | |
169 static int write_stream(int s, const char *buf, int len) { | 117 static int write_stream(int s, const char *buf, int len) { |
170 int total, timeout; | 118 int total, timeout; |
171 | 119 |
172 total = 0; timeout = 30; | 120 total = 0; timeout = 30; |
173 while (total < len){ | 121 while (total < len){ |