Changeset fcce68aff1b6360e94e87a6197b1b7f6e1813cc4
- Timestamp:
- 29/01/06 10:00:31
(3 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1138525231 +0000
- git-parent:
[2e479fbfdf9c5659b9524f4404ae572d037b798c]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1138525231 +0000
- Message:
Clean up
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3814df3 |
rfcce68a |
|
| 153 | 153 | sout_access_out_sys_t *p_sys; |
|---|
| 154 | 154 | |
|---|
| 155 | | char *psz_parser, *psz_name; |
|---|
| | 155 | char *psz_parser; |
|---|
| 156 | 156 | |
|---|
| 157 | 157 | char *psz_bind_addr; |
|---|
| … | … | |
| 165 | 165 | vlc_value_t val; |
|---|
| 166 | 166 | |
|---|
| 167 | | #ifdef HAVE_AVAHI_CLIENT |
|---|
| 168 | | playlist_t *p_playlist; |
|---|
| 169 | | char *psz_txt; |
|---|
| 170 | | #endif |
|---|
| 171 | | |
|---|
| 172 | 167 | if( !( p_sys = p_access->p_sys = |
|---|
| 173 | 168 | malloc( sizeof( sout_access_out_sys_t ) ) ) ) |
|---|
| … | … | |
| 179 | 174 | sout_CfgParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); |
|---|
| 180 | 175 | |
|---|
| 181 | | /* p_access->psz_name host.name:port/filename */ |
|---|
| 182 | | psz_name = psz_parser = strdup( p_access->psz_name ); |
|---|
| 183 | | |
|---|
| 184 | | psz_bind_addr = psz_parser; |
|---|
| | 176 | /* p_access->psz_name = "hostname:port/filename" */ |
|---|
| | 177 | psz_bind_addr = psz_parser = strdup( p_access->psz_name ); |
|---|
| | 178 | |
|---|
| 185 | 179 | i_bind_port = 0; |
|---|
| 186 | 180 | psz_file_name = ""; |
|---|
| … | … | |
| 250 | 244 | msg_Err( p_access, "cannot listen on %s:%d", |
|---|
| 251 | 245 | psz_bind_addr, i_bind_port ); |
|---|
| 252 | | free( psz_name ); |
|---|
| 253 | 246 | free( psz_file_name ); |
|---|
| | 247 | free( psz_bind_addr ); |
|---|
| 254 | 248 | free( p_sys ); |
|---|
| 255 | 249 | return VLC_EGENERIC; |
|---|
| 256 | 250 | } |
|---|
| | 251 | free( psz_bind_addr ); |
|---|
| 257 | 252 | |
|---|
| 258 | 253 | if( p_access->psz_access && !strcmp( p_access->psz_access, "mmsh" ) ) |
|---|
| … | … | |
| 293 | 288 | httpd_HostDelete( p_sys->p_httpd_host ); |
|---|
| 294 | 289 | |
|---|
| 295 | | free( psz_name ); |
|---|
| 296 | 290 | free( psz_file_name ); |
|---|
| 297 | 291 | free( p_sys ); |
|---|
| … | … | |
| 300 | 294 | |
|---|
| 301 | 295 | #ifdef HAVE_AVAHI_CLIENT |
|---|
| 302 | | asprintf( &psz_txt, "path=%s", psz_file_name ); |
|---|
| 303 | | #endif |
|---|
| 304 | | |
|---|
| 305 | | free( psz_file_name ); |
|---|
| 306 | | free( psz_name ); |
|---|
| 307 | | |
|---|
| 308 | | #ifdef HAVE_AVAHI_CLIENT |
|---|
| 309 | | p_playlist = (playlist_t *)vlc_object_find( p_access, VLC_OBJECT_PLAYLIST, |
|---|
| 310 | | FIND_ANYWHERE ); |
|---|
| 311 | | if( p_playlist == NULL ) |
|---|
| 312 | | { |
|---|
| 313 | | msg_Err( p_access, "unable to find playlist" ); |
|---|
| 314 | | httpd_HostDelete( p_sys->p_httpd_host ); |
|---|
| 315 | | free( (void *)psz_txt ); |
|---|
| 316 | | free( (void *)p_sys ); |
|---|
| 317 | | return VLC_EGENERIC; |
|---|
| 318 | | } |
|---|
| 319 | | |
|---|
| 320 | | psz_name = strrchr( p_playlist->status.p_item->input.psz_uri, |
|---|
| 321 | | DIRECTORY_SEPARATOR ); |
|---|
| 322 | | if( psz_name != NULL ) psz_name++; |
|---|
| 323 | | else psz_name = p_playlist->status.p_item->input.psz_uri; |
|---|
| 324 | | |
|---|
| 325 | 296 | if( config_GetInt(p_this, SOUT_CFG_PREFIX "bonjour") ) |
|---|
| 326 | 297 | { |
|---|
| | 298 | playlist_t *p_playlist; |
|---|
| | 299 | char *psz_txt, *psz_name; |
|---|
| | 300 | |
|---|
| | 301 | p_playlist = (playlist_t *)vlc_object_find( p_access, |
|---|
| | 302 | VLC_OBJECT_PLAYLIST, |
|---|
| | 303 | FIND_ANYWHERE ); |
|---|
| | 304 | if( p_playlist == NULL ) |
|---|
| | 305 | { |
|---|
| | 306 | msg_Err( p_access, "unable to find playlist" ); |
|---|
| | 307 | httpd_HostDelete( p_sys->p_httpd_host ); |
|---|
| | 308 | free( (void *)p_sys ); |
|---|
| | 309 | return VLC_EGENERIC; |
|---|
| | 310 | } |
|---|
| | 311 | |
|---|
| | 312 | psz_name = strrchr( p_playlist->status.p_item->input.psz_uri, |
|---|
| | 313 | DIRECTORY_SEPARATOR ); |
|---|
| | 314 | if( psz_name != NULL ) psz_name++; |
|---|
| | 315 | else psz_name = p_playlist->status.p_item->input.psz_uri; |
|---|
| | 316 | |
|---|
| | 317 | asprintf( &psz_txt, "path=%s", psz_file_name ); |
|---|
| | 318 | |
|---|
| 327 | 319 | p_sys->p_bonjour = bonjour_start_service( (vlc_object_t *)p_access, |
|---|
| 328 | 320 | "_vlc-http._tcp", |
|---|
| 329 | 321 | psz_name, i_bind_port, psz_txt ); |
|---|
| 330 | 322 | free( (void *)psz_txt ); |
|---|
| | 323 | |
|---|
| 331 | 324 | if( p_sys->p_bonjour == NULL ) |
|---|
| 332 | 325 | { |
|---|
| … | … | |
| 336 | 329 | return VLC_EGENERIC; |
|---|
| 337 | 330 | } |
|---|
| 338 | | } |
|---|
| 339 | | vlc_object_release( p_playlist ); |
|---|
| | 331 | vlc_object_release( p_playlist ); |
|---|
| | 332 | } |
|---|
| | 333 | else |
|---|
| | 334 | p_sys->p_bonjour = NULL; |
|---|
| 340 | 335 | #endif |
|---|
| | 336 | |
|---|
| | 337 | free( psz_file_name ); |
|---|
| 341 | 338 | |
|---|
| 342 | 339 | p_sys->i_header_allocated = 1024; |
|---|
| … | … | |
| 364 | 361 | |
|---|
| 365 | 362 | #ifdef HAVE_AVAHI_CLIENT |
|---|
| 366 | | if( config_GetInt(p_this, SOUT_CFG_PREFIX "bonjour") ) |
|---|
| | 363 | if( p_sys->p_bonjour != NULL ) |
|---|
| 367 | 364 | bonjour_stop_service( p_sys->p_bonjour ); |
|---|
| 368 | 365 | #endif |
|---|