#include <vlc_rand.h>
#ifdef HAVE_SRTP
# include <srtp.h>
+# include <gcrypt.h>
+# include <vlc_gcrypt.h>
#endif
#include "rtp.h"
"negative value or zero disables timeouts. The default is 60 (one " \
"minute)." )
+#define RTSP_USER_TEXT N_("Username")
+#define RTSP_USER_LONGTEXT N_("User name that will be " \
+ "requested to access the stream." )
+#define RTSP_PASS_TEXT N_("Password")
+#define RTSP_PASS_LONGTEXT N_("Password that will be " \
+ "requested to access the stream." )
+
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
RTSP_HOST_LONGTEXT, true )
add_integer( "rtsp-timeout", 60, RTSP_TIMEOUT_TEXT,
RTSP_TIMEOUT_LONGTEXT, true )
+ add_string( "sout-rtsp-user", "",
+ RTSP_USER_TEXT, RTSP_USER_LONGTEXT, true )
+ add_password( "sout-rtsp-pwd", "",
+ RTSP_PASS_TEXT, RTSP_PASS_LONGTEXT, true )
vlc_module_end ()
goto out;
}
- p_sys->rtsp = RtspSetup( VLC_OBJECT(p_stream), NULL, &url );
+ if( url.psz_host != NULL && *url.psz_host )
+ {
+ /* msg_Err( p_stream, "\"%s\" RTSP host ignored", url.psz_host );
+ msg_Info( p_stream, "Pass --rtsp-host=%s on the command line "
+ "instead.", url.psz_host ); */
+
+ var_Create( p_stream, "rtsp-host", VLC_VAR_STRING );
+ var_SetString( p_stream, "rtsp-host", url.psz_host );
+ }
+ /* if( url.i_port != 0 )
+ {
+ msg_Err( p_stream, "\"%u\" RTSP port ignored", url.i_port );
+ msg_Info( p_stream, "Pass --rtsp-port=%u on the command line "
+ "instead.", url.i_port );
+ } */
+
+ if( url.i_port <= 0 ) url.i_port = 554;
+ var_Create( p_stream, "rtsp-port", VLC_VAR_INTEGER );
+ var_SetInteger( p_stream, "rtsp-port", url.i_port );
+
+ p_sys->rtsp = RtspSetup( VLC_OBJECT(p_stream), NULL, url.psz_path );
if( p_sys->rtsp == NULL )
msg_Err( p_stream, "cannot export SDP as RTSP" );
}
sdp_AddAttribute( &psz_sdp, "setup", "passive" );
if( p_sys->proto == IPPROTO_DCCP )
sdp_AddAttribute( &psz_sdp, "dccp-service-code",
- "SC:RTP%c", toupper( mime_major[0] ) );
+ "SC:RTP%c",
+ toupper( (unsigned char)mime_major[0] ) );
}
}
out:
char *key = var_GetNonEmptyString (p_stream, SOUT_CFG_PREFIX"key");
if (key)
{
+ vlc_gcrypt_init ();
id->srtp = srtp_create (SRTP_ENCR_AES_CM, SRTP_AUTH_HMAC_SHA1, 10,
SRTP_PRF_AES_CM, SRTP_RCC_MODE1);
if (id->srtp == NULL)
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- p_sys->p_httpd_host = httpd_HostNew( VLC_OBJECT(p_stream), url->psz_host,
- url->i_port > 0 ? url->i_port : 80 );
+ p_sys->p_httpd_host = vlc_http_HostNew( VLC_OBJECT(p_stream) );
if( p_sys->p_httpd_host )
{
p_sys->p_httpd_file = httpd_FileNew( p_sys->p_httpd_host,
#endif
SendRTCP( id->sinkv[i].rtcp, out );
- if( send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 ) >= 0 )
- continue;
- switch( net_errno )
+ if( send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 ) == -1
+ && net_errno != EAGAIN && net_errno != EWOULDBLOCK
+ && net_errno != ENOBUFS && net_errno != ENOMEM )
{
- /* Soft errors (e.g. ICMP): */
- case ECONNREFUSED: /* Port unreachable */
- case ENOPROTOOPT:
-#ifdef EPROTO
- case EPROTO: /* Protocol unreachable */
-#endif
- case EHOSTUNREACH: /* Host unreachable */
- case ENETUNREACH: /* Network unreachable */
- case ENETDOWN: /* Entire network down */
+ int type;
+ getsockopt( id->sinkv[i].rtp_fd, SOL_SOCKET, SO_TYPE,
+ &type, &(socklen_t){ sizeof(type) });
+ if( type == SOCK_DGRAM )
+ /* ICMP soft error: ignore and retry */
send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 );
- /* Transient congestion: */
- case ENOMEM: /* out of socket buffers */
- case ENOBUFS:
- case EAGAIN:
-#if (EAGAIN != EWOULDBLOCK)
- case EWOULDBLOCK:
-#endif
- continue;
+ else
+ /* Broken connection */
+ deadv[deadc++] = id->sinkv[i].rtp_fd;
}
-
- deadv[deadc++] = id->sinkv[i].rtp_fd;
}
id->i_seq_sent_next = ntohs(((uint16_t *) out->p_buffer)[1]) + 1;
vlc_mutex_unlock( &id->lock_sink );
uint64_t i_ts_init;
/* As per RFC 2326, session identifiers are at least 8 bytes long */
strncpy((char *)&i_ts_init, psz_vod_session, sizeof(uint64_t));
- i_ts_init ^= (uint64_t) p_media;
+ i_ts_init ^= (uintptr_t)p_media;
/* Limit the timestamp to 48 bytes, this is enough and allows us
* to stay away from overflows */
i_ts_init &= 0xFFFFFFFFFFFF;
{
sout_access_out_t *p_grab;
- p_grab = vlc_object_create( p_stream->p_sout, sizeof( *p_grab ) );
+ p_grab = vlc_object_create( p_stream, sizeof( *p_grab ) );
if( p_grab == NULL )
return NULL;
p_grab->p_sys = (sout_access_out_sys_t *)p_stream;
p_grab->pf_seek = NULL;
p_grab->pf_write = AccessOutGrabberWrite;
- vlc_object_attach( p_grab, p_stream );
return p_grab;
}