* Module descriptor
*****************************************************************************/
-#define DST_TEXT N_("Destination")
-#define DST_LONGTEXT N_( \
+#define DEST_TEXT N_("Destination")
+#define DEST_LONGTEXT N_( \
"This is the output URL that will be used." )
#define SDP_TEXT N_("SDP")
#define SDP_LONGTEXT N_( \
"This sends and receives RTCP packet multiplexed over the same port " \
"as RTP packets." )
-#define DCCP_TEXT N_("DCCP transport")
-#define DCCP_LONGTEXT N_( \
- "This enables DCCP instead of UDP as a transport for RTP." )
-#define TCP_TEXT N_("TCP transport")
-#define TCP_LONGTEXT N_( \
- "This enables TCP instead of UDP as a transport for RTP." )
-#define UDP_LITE_TEXT N_("UDP-Lite transport")
-#define UDP_LITE_LONGTEXT N_( \
- "This enables UDP-Lite instead of UDP as a transport for RTP." )
+#define PROTO_TEXT N_("Transport protocol")
+#define PROTO_LONGTEXT N_( \
+ "This selects which transport protocol to use for RTP." )
+
+static const char *const ppsz_protos[] = {
+ "dccp", "sctp", "tcp", "udp", "udplite",
+};
+
+static const char *const ppsz_protocols[] = {
+ "DCCP", "SCTP", "TCP", "UDP", "UDP-Lite",
+};
#define RFC3016_TEXT N_("MP4A LATM")
#define RFC3016_LONGTEXT N_( \
set_category( CAT_SOUT );
set_subcategory( SUBCAT_SOUT_STREAM );
- add_string( SOUT_CFG_PREFIX "dst", "", NULL, DST_TEXT,
- DST_LONGTEXT, VLC_TRUE );
+ add_string( SOUT_CFG_PREFIX "dst", "", NULL, DEST_TEXT,
+ DEST_LONGTEXT, true );
change_unsafe();
add_string( SOUT_CFG_PREFIX "sdp", "", NULL, SDP_TEXT,
- SDP_LONGTEXT, VLC_TRUE );
+ SDP_LONGTEXT, true );
add_string( SOUT_CFG_PREFIX "mux", "", NULL, MUX_TEXT,
- MUX_LONGTEXT, VLC_TRUE );
+ MUX_LONGTEXT, true );
add_string( SOUT_CFG_PREFIX "name", "", NULL, NAME_TEXT,
- NAME_LONGTEXT, VLC_TRUE );
+ NAME_LONGTEXT, true );
add_string( SOUT_CFG_PREFIX "description", "", NULL, DESC_TEXT,
- DESC_LONGTEXT, VLC_TRUE );
+ DESC_LONGTEXT, true );
add_string( SOUT_CFG_PREFIX "url", "", NULL, URL_TEXT,
- URL_LONGTEXT, VLC_TRUE );
+ URL_LONGTEXT, true );
add_string( SOUT_CFG_PREFIX "email", "", NULL, EMAIL_TEXT,
- EMAIL_LONGTEXT, VLC_TRUE );
+ EMAIL_LONGTEXT, true );
add_string( SOUT_CFG_PREFIX "phone", "", NULL, PHONE_TEXT,
- PHONE_LONGTEXT, VLC_TRUE );
-
- add_integer( SOUT_CFG_PREFIX "port", 1234, NULL, PORT_TEXT,
- PORT_LONGTEXT, VLC_TRUE );
- add_integer( SOUT_CFG_PREFIX "port-audio", 1230, NULL, PORT_AUDIO_TEXT,
- PORT_AUDIO_LONGTEXT, VLC_TRUE );
- add_integer( SOUT_CFG_PREFIX "port-video", 1232, NULL, PORT_VIDEO_TEXT,
- PORT_VIDEO_LONGTEXT, VLC_TRUE );
+ PHONE_LONGTEXT, true );
+
+ add_string( SOUT_CFG_PREFIX "proto", "udp", NULL, PROTO_TEXT,
+ PROTO_LONGTEXT, false );
+ change_string_list( ppsz_protos, ppsz_protocols, NULL );
+ add_integer( SOUT_CFG_PREFIX "port", 50004, NULL, PORT_TEXT,
+ PORT_LONGTEXT, true );
+ add_integer( SOUT_CFG_PREFIX "port-audio", 50000, NULL, PORT_AUDIO_TEXT,
+ PORT_AUDIO_LONGTEXT, true );
+ add_integer( SOUT_CFG_PREFIX "port-video", 50002, NULL, PORT_VIDEO_TEXT,
+ PORT_VIDEO_LONGTEXT, true );
add_integer( SOUT_CFG_PREFIX "ttl", 0, NULL, TTL_TEXT,
- TTL_LONGTEXT, VLC_TRUE );
-
- add_bool( SOUT_CFG_PREFIX "rtcp-mux", VLC_FALSE, NULL,
- RTCP_MUX_TEXT, RTCP_MUX_LONGTEXT, VLC_FALSE );
-
- add_bool( SOUT_CFG_PREFIX "dccp", VLC_FALSE, NULL,
- DCCP_TEXT, DCCP_LONGTEXT, VLC_FALSE );
- add_bool( SOUT_CFG_PREFIX "tcp", VLC_FALSE, NULL,
- TCP_TEXT, TCP_LONGTEXT, VLC_FALSE );
- add_bool( SOUT_CFG_PREFIX "udplite", VLC_FALSE, NULL,
- UDP_LITE_TEXT, UDP_LITE_LONGTEXT, VLC_FALSE );
+ TTL_LONGTEXT, true );
+ add_bool( SOUT_CFG_PREFIX "rtcp-mux", false, NULL,
+ RTCP_MUX_TEXT, RTCP_MUX_LONGTEXT, false );
add_bool( SOUT_CFG_PREFIX "mp4a-latm", 0, NULL, RFC3016_TEXT,
- RFC3016_LONGTEXT, VLC_FALSE );
+ RFC3016_LONGTEXT, false );
set_callbacks( Open, Close );
vlc_module_end();
static const char *ppsz_sout_options[] = {
"dst", "name", "port", "port-audio", "port-video", "*sdp", "ttl", "mux",
"description", "url", "email", "phone",
- "rtcp-mux", "dccp", "tcp", "udplite",
+ "proto", "rtcp-mux",
"mp4a-latm", NULL
};
static int SapSetup( sout_stream_t *p_stream );
static int FileSetup( sout_stream_t *p_stream );
-static int HttpSetup( sout_stream_t *p_stream, vlc_url_t * );
+static int HttpSetup( sout_stream_t *p_stream, const vlc_url_t * );
struct sout_stream_sys_t
{
vlc_mutex_t lock_sdp;
/* SDP to disk */
- vlc_bool_t b_export_sdp_file;
+ bool b_export_sdp_file;
char *psz_sdp_file;
/* SDP via SAP */
- vlc_bool_t b_export_sap;
+ bool b_export_sap;
session_descriptor_t *p_session;
/* SDP via HTTP */
uint16_t i_port;
uint16_t i_port_audio;
uint16_t i_port_video;
- vlc_bool_t b_latm;
- vlc_bool_t rtcp_mux;
+ bool b_latm;
+ bool rtcp_mux;
/* when need to use a private one or when using muxer */
int i_payload_type;
int64_t i_caching;
};
-
/*****************************************************************************
* Open:
*****************************************************************************/
sout_stream_sys_t *p_sys = NULL;
config_chain_t *p_cfg = NULL;
char *psz;
- vlc_bool_t b_rtsp = VLC_FALSE;
+ bool b_rtsp = false;
config_ChainParse( p_stream, SOUT_CFG_PREFIX,
ppsz_sout_options, p_stream->p_cfg );
&& ( p_cfg->psz_value != NULL )
&& !strncasecmp( p_cfg->psz_value, "rtsp:", 5 ) )
{
- b_rtsp = VLC_TRUE;
+ b_rtsp = true;
break;
}
}
if( psz != NULL )
{
if( !strncasecmp( psz, "rtsp:", 5 ) )
- b_rtsp = VLC_TRUE;
+ b_rtsp = true;
free( psz );
}
}
/* Transport protocol */
p_sys->proto = IPPROTO_UDP;
+ psz = var_GetNonEmptyString (p_stream, SOUT_CFG_PREFIX"proto");
- if( var_GetBool( p_stream, SOUT_CFG_PREFIX "dccp" ) )
+ if ((psz == NULL) || !strcasecmp (psz, "udp"))
+ (void)0; /* default */
+ else
+ if (!strcasecmp (psz, "dccp"))
{
p_sys->proto = IPPROTO_DCCP;
- p_sys->rtcp_mux = VLC_TRUE; /* Force RTP/RTCP mux */
+ p_sys->rtcp_mux = true; /* Force RTP/RTCP mux */
}
#if 0
else
- if( var_GetBool( p_stream, SOUT_CFG_PREFIX "tcp" ) )
+ if (!strcasecmp (psz, "sctp"))
{
p_sys->proto = IPPROTO_TCP;
- p_sys->rtcp_mux = VLC_TRUE; /* Force RTP/RTCP mux */
+ p_sys->rtcp_mux = true; /* Force RTP/RTCP mux */
}
+#endif
+#if 0
else
+ if (!strcasecmp (psz, "tcp"))
+ {
+ p_sys->proto = IPPROTO_TCP;
+ p_sys->rtcp_mux = true; /* Force RTP/RTCP mux */
+ }
#endif
- if( var_GetBool( p_stream, SOUT_CFG_PREFIX "udplite" ) )
+ else
+ if (!strcasecmp (psz, "udplite") || !strcasecmp (psz, "udp-lite"))
p_sys->proto = IPPROTO_UDPLITE;
+ else
+ msg_Warn (p_this, "unknown or unsupported transport protocol \"%s\"",
+ psz);
+ free (psz);
+ var_Create (p_this, "dccp-service", VLC_VAR_STRING);
if( ( p_sys->psz_destination == NULL ) && !b_rtsp )
{
p_sys->rtsp = NULL;
p_sys->psz_sdp = NULL;
- p_sys->b_export_sap = VLC_FALSE;
- p_sys->b_export_sdp_file = VLC_FALSE;
+ p_sys->b_export_sap = false;
+ p_sys->b_export_sdp_file = false;
p_sys->p_session = NULL;
p_sys->p_httpd_host = NULL;
else if( ( url.psz_protocol && !strcasecmp( url.psz_protocol, "sap" ) ) ||
( url.psz_host && !strcasecmp( url.psz_host, "sap" ) ) )
{
- p_sys->b_export_sap = VLC_TRUE;
+ p_sys->b_export_sap = true;
SapSetup( p_stream );
}
else if( url.psz_protocol && !strcasecmp( url.psz_protocol, "file" ) )
msg_Err( p_stream, "you can use sdp=file:// only once" );
goto out;
}
- p_sys->b_export_sdp_file = VLC_TRUE;
+ p_sys->b_export_sdp_file = true;
psz_url = &psz_url[5];
if( psz_url[0] == '/' && psz_url[1] == '/' )
psz_url += 2;
}
sdp_AddMedia( &psz_sdp, mime_major, proto, inclport * id->i_port,
- id->i_payload_type, VLC_FALSE, id->i_bitrate,
+ id->i_payload_type, false, id->i_bitrate,
id->psz_enc, id->i_clock_rate, id->i_channels,
id->psz_fmtp);
if( rtsp_url != NULL )
{
assert( strlen( rtsp_url ) > 0 );
- vlc_bool_t addslash = ( rtsp_url[strlen( rtsp_url ) - 1] != '/' );
+ bool addslash = ( rtsp_url[strlen( rtsp_url ) - 1] != '/' );
sdp_AddAttribute ( &psz_sdp, "control",
addslash ? "%s/trackID=%u" : "%strackID=%u",
rtsp_url, i );
{
if( id->listen_fd != NULL )
sdp_AddAttribute( &psz_sdp, "setup", "passive" );
-#if 0
if( p_sys->proto == IPPROTO_DCCP )
sdp_AddAttribute( &psz_sdp, "dccp-service-code",
"SC:RTP%c", toupper( mime_major[0] ) );
-#endif
}
}
if( p_sys->psz_destination != NULL )
switch( p_sys->proto )
{
- case IPPROTO_TCP:
case IPPROTO_DCCP:
+ {
+ const char *code;
+ switch (id->i_cat)
+ {
+ case VIDEO_ES: code = "RTPV"; break;
+ case AUDIO_ES: code = "RTPARTPV"; break;
+ case SPU_ES: code = "RTPTRPTV"; break;
+ default: code = "RTPORTPV"; break;
+ }
+ var_SetString (p_stream, "dccp-service", code);
+ } /* fall through */
+ case IPPROTO_TCP:
id->listen_fd = net_Listen( VLC_OBJECT(p_stream),
p_sys->psz_destination, i_port,
p_sys->proto );
p_sys->psz_destination,
p_sys->i_ttl, id->i_port, id->i_port + 1 );
- id->p_fifo = block_FifoNew( p_stream );
+ id->p_fifo = block_FifoNew();
if( vlc_thread_create( id, "RTP send thread", ThreadSend,
- VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) )
+ VLC_THREAD_PRIORITY_HIGHEST, false ) )
goto error;
/* Update p_sys context */
vlc_mutex_unlock( &p_sys->lock_es );
/* Release port */
- if( id->i_port > 0 )
- {
- if( id->i_cat == AUDIO_ES && p_sys->i_port_audio == 0 )
- p_sys->i_port_audio = id->i_port;
- else if( id->i_cat == VIDEO_ES && p_sys->i_port_video == 0 )
- p_sys->i_port_video = id->i_port;
- }
+ if( id->i_port == var_GetInteger( p_stream, "port-audio" ) )
+ p_sys->i_port_audio = id->i_port;
+ if( id->i_port == var_GetInteger( p_stream, "port-video" ) )
+ p_sys->i_port_video = id->i_port;
free( id->psz_fmtp );
httpd_file_t *, uint8_t *p_request,
uint8_t **pp_data, int *pi_data );
-static int HttpSetup( sout_stream_t *p_stream, vlc_url_t *url)
+static int HttpSetup( sout_stream_t *p_stream, const vlc_url_t *url)
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
if( fd == -1 )
break;
msg_Dbg( id, "adding socket %d", fd );
- rtp_add_sink( id, fd, VLC_TRUE );
+ rtp_add_sink( id, fd, true );
}
}
#endif
}
-int rtp_add_sink( sout_stream_id_t *id, int fd, vlc_bool_t rtcp_mux )
+int rtp_add_sink( sout_stream_id_t *id, int fd, bool rtcp_mux )
{
rtp_sink_t sink = { fd, NULL };
sink.rtcp = OpenRTCP( VLC_OBJECT( id->p_stream ), fd, IPPROTO_UDP,
void rtp_packetize_common( sout_stream_id_t *id, block_t *out,
int b_marker, int64_t i_pts )
{
- uint32_t i_timestamp = i_pts * (int64_t)id->i_clock_rate / I64C(1000000);
+ uint32_t i_timestamp = i_pts * (int64_t)id->i_clock_rate / INT64_C(1000000);
out->p_buffer[0] = 0x80;
out->p_buffer[1] = (b_marker?0x80:0x00)|id->i_payload_type;
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;
}