struct attribute_t
{
const char *value;
- char name[0];
+ char name[];
};
struct sap_announce_t
char *psz_addr;
int i;
int timeout = -1;
+ int canc = vlc_savecancel ();
/* Braindead Winsock DNS resolver will get stuck over 2 seconds per failed
* DNS queries, even if the DNS server returns an error with milliseconds.
return;
}
- vlc_object_lock( p_sd );
-
/* read SAP packets */
- while( vlc_object_alive( p_sd ) )
+ for (;;)
{
+ vlc_restorecancel (canc);
unsigned n = p_sd->p_sys->i_fd;
- struct pollfd ufd[n+1];
+ struct pollfd ufd[n];
for (unsigned i = 0; i < n; i++)
{
ufd[i].revents = 0;
}
- /* Make sure we track vlc_object_signal() */
- ufd[n].fd = vlc_object_waitpipe( p_sd );
- ufd[n].events = POLLIN | POLLHUP;
- ufd[n].revents = 0;
-
- if( ufd[n].fd == -1 )
- {
- /* On windows, fd will be -1, as we can't select on a pipe()-ed
- * fildes. Because we have no other solution to track that
- * object is killed, we make sure the timeout won't be to long. */
- if( timeout > 1000 || timeout == -1 )
- timeout = 1000;
- }
-
- vlc_object_unlock( p_sd );
-
- if (poll (ufd, n+1, timeout) > 0)
+ int val = poll (ufd, n, timeout);
+ canc = vlc_savecancel ();
+ if (val > 0)
{
for (unsigned i = 0; i < n; i++)
{
timeout = -1; /* We can safely poll indefinitly. */
else if( timeout < 200 )
timeout = 200; /* Don't wakeup too fast. */
-
- vlc_object_lock( p_sd );
}
- vlc_object_unlock( p_sd );
}
/**********************************************************************
p_announce->i_period_trust++;
/* Compute the average period */
- p_announce->i_period = (p_announce->i_period + (mdate() - p_announce->i_last)) / 2;
- p_announce->i_last = mdate();
+ mtime_t now = mdate();
+ p_announce->i_period = (p_announce->i_period + (now - p_announce->i_last)) / 2;
+ p_announce->i_last = now;
}
FreeSDP( p_sdp ); p_sdp = NULL;
return VLC_SUCCESS;
p_sap->p_sdp = p_sdp;
/* Released in RemoveAnnounce */
- p_input = input_ItemNewWithType( VLC_OBJECT(p_sd),
+ p_input = input_item_NewWithType( VLC_OBJECT(p_sd),
p_sap->p_sdp->psz_uri,
p_sdp->psz_sessionname,
0, NULL, -1, ITEM_TYPE_NET );
}
if( p_sys->b_timeshift )
- input_ItemAddOption( p_input, ":access-filter=timeshift" );
+ input_item_AddOption( p_input, ":access-filter=timeshift" );
psz_value = GetAttribute( p_sap->p_sdp->pp_attributes, p_sap->p_sdp->i_attributes, "tool" );
if( psz_value != NULL )
{
- input_ItemAddInfo( p_input, _("Session"), _("Tool"), "%s", psz_value );
+ input_item_AddInfo( p_input, _("Session"), _("Tool"), "%s", psz_value );
}
if( strcmp( p_sdp->username, "-" ) )
{
- input_ItemAddInfo( p_input, _("Session"), _("User"), "%s",
+ input_item_AddInfo( p_input, _("Session"), _("User"), "%s",
p_sdp->username );
}