* Preamble
*****************************************************************************/
+/* For inttypes.h
+ * Note: config.h may include inttypes.h, so make sure we define this option
+ * early enough. */
+#define __STDC_CONSTANT_MACROS 1
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#define __STDC_CONSTANT_MACROS 1
#include <inttypes.h>
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_demux.h>
#include <vlc_interface.h>
#include <iostream>
#include <limits.h>
+
#if defined( WIN32 )
# include <winsock2.h>
#endif
"used for the connection.")
vlc_module_begin();
- set_description( _("RTP/RTSP/SDP demuxer (using Live555)" ) );
+ set_description( N_("RTP/RTSP/SDP demuxer (using Live555)" ) );
set_capability( "demux", 50 );
set_shortname( "RTP/RTSP");
set_callbacks( Open, Close );
set_subcategory( SUBCAT_INPUT_DEMUX );
add_submodule();
- set_description( _("RTSP/RTP access and demux") );
+ set_description( N_("RTSP/RTP access and demux") );
add_shortcut( "rtsp" );
add_shortcut( "sdp" );
set_capability( "access_demux", 0 );
add_integer( "rtp-client-port", -1, NULL,
N_("Client port"),
N_("Port to use for the RTP source of the session"), true );
+ add_bool( "rtsp-mcast", false, NULL,
+ N_("Force multicast RTP via RTSP"),
+ N_("Force multicast RTP via RTSP"), true );
add_bool( "rtsp-http", 0, NULL,
N_("Tunnel RTSP and RTP over HTTP"),
N_("Tunnel RTSP and RTP over HTTP"), true );
es_format_t fmt;
es_out_id_t *p_es;
- bool b_muxed;
- bool b_quicktime;
- bool b_asf;
+ bool b_muxed;
+ bool b_quicktime;
+ bool b_asf;
stream_t *p_out_muxed; /* for muxed stream */
uint8_t *p_buffer;
unsigned int i_buffer;
- bool b_rtcp_sync;
+ bool b_rtcp_sync;
char waiting;
int64_t i_pts;
u_int32_t i_start_seq;
timeout_thread_t *p_timeout; /* the actual thread that makes sure we don't timeout */
/* */
- bool b_multicast; /* true if one of the tracks is multicasted */
- bool b_no_data; /* true if we never receive any data */
+ bool b_force_mcast;
+ bool b_multicast; /* if one of the tracks is multicasted */
+ bool b_no_data; /* if we never received any data */
int i_no_data_ti; /* consecutive number of TaskInterrupt */
char event;
p_sys->b_multicast = false;
p_sys->b_real = false;
p_sys->psz_path = strdup( p_demux->psz_path );
+ p_sys->b_force_mcast = var_CreateGetBool( p_demux, "rtsp-mcast" );
/* parse URL for rtsp://[user:[passwd]@]serverip:port/options */
vlc_UrlParse( &p_sys->url, p_sys->psz_path, 0 );
live_track_t *tk = p_sys->track[i];
if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+ es_format_Clean( &tk->fmt );
free( tk->p_buffer );
free( tk );
}
live_track_t *tk = p_sys->track[i];
if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+ es_format_Clean( &tk->fmt );
free( tk->p_buffer );
free( tk );
}
i_http_port = var_CreateGetInteger( p_demux, "rtsp-http-port" );
if( ( p_sys->rtsp = RTSPClient::createNew( *p_sys->env,
- p_demux->p_libvlc->i_verbose > 1,
+ var_CreateGetInteger( p_demux, "verbose" ) > 1,
"VLC media player", i_http_port ) ) == NULL )
{
msg_Err( p_demux, "RTSPClient::createNew failed (%s)",
/* Issue the SETUP */
if( p_sys->rtsp )
{
- if( !( p_sys->rtsp->setupMediaSubsession( *sub, False,
- b_rtsp_tcp ? True : False ) ) )
+ bool tcp = b_rtsp_tcp;
+ bool mcast = p_sys->b_force_mcast;
+ if( !p_sys->rtsp->setupMediaSubsession( *sub, False,
+ tcp ? True : False,
+ ( mcast && !tcp ) ? True : False ) )
{
+ tcp = !tcp;
/* if we get an unsupported transport error, toggle TCP use and try again */
if( !strstr(p_sys->env->getResultMsg(), "461 Unsupported Transport")
- || !( p_sys->rtsp->setupMediaSubsession( *sub, False,
- b_rtsp_tcp ? False : True ) ) )
+ || !p_sys->rtsp->setupMediaSubsession( *sub, False,
+ tcp ? False : True,
+ ( mcast && !tcp ) ? True : False ) )
{
msg_Err( p_demux, "SETUP of'%s/%s' failed %s", sub->mediumName(),
sub->codecName(), p_sys->env->getResultMsg() );
{
/* BUG ??? */
msg_Err( p_demux, "unusable RTSP track. this should not happen" );
+ es_format_Clean( &tk->fmt );
free( tk );
}
}
return 0;
}
}
- else if( p_sys->i_no_data_ti > 34 )
- {
- msg_Err( p_demux, "no data received in 10s, aborting" );
- return 0;
- }
+ msg_Err( p_demux, "no data received in 10s, aborting" );
+ return 0;
}
else if( !p_sys->b_multicast && p_sys->b_no_data && p_sys->i_no_data_ti > 34 )
{
live_track_t *tk = p_sys->track[i];
if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+ es_format_Clean( &tk->fmt );
free( tk->p_buffer );
free( tk );
}
}
/* Parse it to get packet size */
- E_(asf_HeaderParse)( &p_sys->asfh, p_header->p_buffer, p_header->i_buffer );
+ asf_HeaderParse( &p_sys->asfh, p_header->p_buffer, p_header->i_buffer );
/* Send it to demuxer */
stream_DemuxSend( p_sys->p_out_asf, p_header );