*****************************************************************************/
#include <vlc/vlc.h>
-#include <stdlib.h> /* malloc(), free() */
-#include <string.h>
#include <vlc_demux.h>
#include <vlc_interface.h>
{
/* See if it looks like a SDP
v, o, s fields are mandatory and in this order */
- uint8_t *p_peek;
+ const uint8_t *p_peek;
if( stream_Peek( p_demux->s, &p_peek, 7 ) < 7 ) return VLC_EGENERIC;
- if( memcmp( (char*)p_peek, "v=0\r\n", 5 ) &&
- memcmp( (char*)p_peek, "v=0\n", 4 ) &&
+ if( memcmp( p_peek, "v=0\r\n", 5 ) &&
+ memcmp( p_peek, "v=0\n", 4 ) &&
( p_peek[0] < 'a' || p_peek[0] > 'z' || p_peek[1] != '=' ) )
{
return VLC_EGENERIC;
if( p_sys->env ) p_sys->env->reclaim();
if( p_sys->p_timeout )
{
- p_sys->p_timeout->b_die = VLC_TRUE;
+ vlc_object_kill( p_sys->p_timeout );
vlc_thread_join( p_sys->p_timeout );
vlc_object_detach( p_sys->p_timeout );
vlc_object_destroy( p_sys->p_timeout );
if( p_sys->env ) p_sys->env->reclaim();
if( p_sys->p_timeout )
{
- p_sys->p_timeout->b_die = VLC_TRUE;
+ vlc_object_kill( p_sys->p_timeout );
vlc_thread_join( p_sys->p_timeout );
vlc_object_detach( p_sys->p_timeout );
vlc_object_destroy( p_sys->p_timeout );
if( var_CreateGetBool( p_demux, "rtsp-http" ) )
i_http_port = var_CreateGetInteger( p_demux, "rtsp-http-port" );
- if( ( p_sys->rtsp = RTSPClient::createNew(*p_sys->env, 1 /*verbose*/,
+ if( ( p_sys->rtsp = RTSPClient::createNew(*p_sys->env,
+ p_demux->p_libvlc->i_verbose > 1,
"VLC media player", i_http_port ) ) == NULL )
{
msg_Err( p_demux, "RTSPClient::createNew failed (%s)",
if( !( p_sys->rtsp->setupMediaSubsession( *sub, False,
b_rtsp_tcp ? True : False ) ) )
{
- msg_Err( p_demux, "SETUP of'%s/%s' failed %s", sub->mediumName(),
- sub->codecName(), p_sys->env->getResultMsg() );
- continue;
+ /* 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 ) ) )
+ {
+ msg_Err( p_demux, "SETUP of'%s/%s' failed %s", sub->mediumName(),
+ sub->codecName(), p_sys->env->getResultMsg() );
+ continue;
+ }
}
}
}
else if( !strncmp( sub->codecName(), "G726", 4 ) )
{
- tk->fmt.i_codec = VLC_FOURCC( 'g', '7', '2', '6' );
+ tk->fmt.i_codec = VLC_FOURCC( 'g', '7', '2', '6' );
tk->fmt.audio.i_rate = 8000;
tk->fmt.audio.i_channels = 1;
if( !strcmp( sub->codecName()+5, "40" ) )
{
tk->b_quicktime = VLC_TRUE;
}
+ else if( !strcmp( sub->codecName(), "SPEEX" ) )
+ {
+ tk->fmt.i_codec = VLC_FOURCC( 's', 'p', 'x', ' ' );
+ }
}
else if( !strcmp( sub->mediumName(), "video" ) )
{
delete iter;
if( p_sys->i_track <= 0 ) i_return = VLC_EGENERIC;
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the starttime if possible */
p_sys->i_npt_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
#else
- p_sys->i_npt_start = (int64_t) = -1;
+ p_sys->i_npt_start = (int64_t) -1;
#endif
if( p_sys->i_npt_start < 0 )
p_sys->i_npt_start = -1;
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the duration if possible */
p_sys->i_npt_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
#else
/* Retrieve the timeout value and set up a timeout prevention thread */
p_sys->i_timeout = p_sys->rtsp->sessionTimeoutParameter();
- if( p_sys->i_timeout > 0 && !p_sys->p_timeout )
+ if( p_sys->i_timeout <= 0 )
+ p_sys->i_timeout = 60; /* default value from RFC2326 */
+ if( !p_sys->p_timeout )
{
msg_Dbg( p_demux, "We have a timeout of %d seconds", p_sys->i_timeout );
p_sys->p_timeout = (timeout_thread_t *)vlc_object_create( p_demux, sizeof(timeout_thread_t) );
}
#endif
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the starttime if possible */
p_sys->i_npt_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
#else
- p_sys->i_npt_start = (int64_t) -1;
+ p_sys->i_npt_start = -1;
#endif
if( p_sys->i_npt_start < 0 )
{
else
p_sys->i_npt = p_sys->i_npt_start;
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the duration if possible */
p_sys->i_npt_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
#else
msg_Dbg( p_demux, "set pos startseq: %u", p_sys->track[i]->i_start_seq );
}
#endif
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the starttime if possible */
p_sys->i_npt_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
#else
- p_sys->i_npt_start = (int64_t) -1;
+ p_sys->i_npt_start = -1;
#endif
if( p_sys->i_npt_start < 0 )
{
else
p_sys->i_npt = p_sys->i_npt_start;
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the duration if possible */
p_sys->i_npt_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
#else
- p_sys->i_npt_length = (int64_t) -1;
+ p_sys->i_npt_length = -1;
#endif
if( p_sys->i_npt_length < 0 )
p_sys->i_npt_length = -1;
msg_Dbg( p_demux, "set pause startseq: %u", p_sys->track[i]->i_start_seq );
}
#endif
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the starttime if possible */
p_sys->i_npt_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
#else
- p_sys->i_npt_start = (int64_t) -1;
+ p_sys->i_npt_start = -1;
#endif
if( p_sys->i_npt_start < 0 )
{
else
p_sys->i_npt = p_sys->i_npt_start;
-#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 1171929600)
+#if (LIVEMEDIA_LIBRARY_VERSION_INT >= 9999999999)
/* Retrieve the duration if possible */
p_sys->i_npt_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
#else
- p_sys->i_npt_length = (int64_t) -1;
+ p_sys->i_npt_length = -1;
#endif
if( p_sys->i_npt_length < 0 )
p_sys->i_npt_length = -1;
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_block;
- msg_Dbg( p_demux, "pts: %d", pts.tv_sec );
+ //msg_Dbg( p_demux, "pts: %d", pts.tv_sec );
int64_t i_pts = (uint64_t)pts.tv_sec * UI64C(1000000) +
(uint64_t)pts.tv_usec;
{
p_sys->i_npt += __MAX( 0, i_pts - p_sys->i_pcr );
p_sys->i_pcr = i_pts;
- msg_Dbg( p_demux, "npt update" );
+ //msg_Dbg( p_demux, "npt update" );
}
- else if( (tk->fmt.i_cat == VIDEO_ES) && (p_sys->i_pcr < i_pts) )
+ else if( /*tk->fmt.i_cat == VIDEO_ES &&*/ p_sys->i_pcr < i_pts )
{
p_sys->i_pcr = i_pts;
}
- msg_Dbg( p_demux, "npt %lld", p_sys->i_npt );
+ //msg_Dbg( p_demux, "npt %lld", p_sys->i_npt );
if( (i_pts != tk->i_pts) && (!tk->b_muxed) )
{
}
/*****************************************************************************
- *
+ *
*****************************************************************************/
static void TimeoutPrevention( timeout_thread_t *p_timeout )
{