Return a filehandle to a HTTP audio stream. Definition at line 179 of file vfs_http.c. 00180 { 00181 struct httpstream *hs; 00182 FILE *ret; 00183 #ifdef __GLIBC__ 00184 cookie_io_functions_t iofn = { 00185 vfs_http_readfn, NULL, NULL, vfs_http_closefn }; 00186 #endif /* __GLIBC__ */ 00187 00188 /* Allocate the datastructure */ 00189 hs = g_slice_new(struct httpstream); 00190 hs->bufptr = hs->buflen = NULL; 00191 00192 /* Curl connection */ 00193 hs->con = curl_easy_init(); 00194 hs->url = g_strdup(ve->filename); 00195 curl_easy_setopt(hs->con, CURLOPT_URL, hs->url); 00196 curl_easy_setopt(hs->con, CURLOPT_CONNECTTIMEOUT, 5); 00197 curl_easy_setopt(hs->con, CURLOPT_USERAGENT, APP_NAME "/" APP_VERSION); 00198 00199 curl_easy_setopt(hs->con, CURLOPT_WRITEFUNCTION, vfs_http_incoming); 00200 curl_easy_setopt(hs->con, CURLOPT_WRITEDATA, hs); 00201 00202 hs->conm = curl_multi_init(); 00203 curl_multi_add_handle(hs->conm, hs->con); 00204 00205 #ifdef __GLIBC__ 00206 /* glibc systems should have fopencookie() */ 00207 ret = fopencookie(hs, "rb", iofn); 00208 #else /* !__GLIBC__ */ 00209 /* BSD's */ 00210 ret = funopen(hs, vfs_http_readfn, NULL, NULL, vfs_http_closefn); 00211 #endif /* __GLIBC__ */ 00212 if (ret == NULL) 00213 vfs_http_closefn(hs); 00214 00215 return (ret); 00216 }
Here is the call graph for this function:
![]() |
1.6.3