[vlc-devel] commit: (live555) correct handling of playStartTime() and playEndTime() ( Jean-Paul Saman )
git version control
git at videolan.org
Tue Dec 9 20:48:39 CET 2008
vlc | branch: 0.8.6-bugfix | Jean-Paul Saman <jpsaman at videolan.org> | Thu Nov 27 11:54:14 2008 +0100| [0e5ddf669e5c44865fff1dbbb939445e2e4d644b] | committer: Jean-Paul Saman
(live555) correct handling of playStartTime() and playEndTime()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0e5ddf669e5c44865fff1dbbb939445e2e4d644b
---
modules/demux/live555.cpp | 79 +++++++++++++++++++++++++++++----------------
1 files changed, 51 insertions(+), 28 deletions(-)
diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index 6247e3e..e9449c9 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -383,11 +383,6 @@ static int Open ( vlc_object_t *p_this )
if( i_return != VLC_SUCCESS )
goto error;
- /* Retrieve the duration if possible */
- p_sys->i_length = (int64_t)( p_sys->ms->playEndTime() * 1000000.0 );
- if( p_sys->i_length < 0 )
- p_sys->i_length = -1;
-
/* Create all es struct */
iter = new MediaSubsessionIterator( *p_sys->ms );
while( ( sub = iter->next() ) != NULL )
@@ -1012,6 +1007,16 @@ static int SessionsSetup( demux_t *p_demux )
}
delete iter;
if( i_active_sessions <= 0 ) i_return = VLC_EGENERIC;
+
+ /* Retrieve the duration and starttime if possible */
+ p_sys->i_pcr_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
+ if( p_sys->i_pcr_start < 0 )
+ p_sys->i_pcr_start = -1;
+
+ p_sys->i_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
+ if( p_sys->i_length < 0 )
+ p_sys->i_length = -1;
+
return i_return;
}
@@ -1056,10 +1061,20 @@ static int Play( demux_t *p_demux )
vlc_object_attach( p_sys->p_timeout, p_demux );
}
}
+ p_sys->i_pcr = 0;
+
+ /* Retrieve the duration and starttime if possible */
+ p_sys->i_pcr_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
+ if( p_sys->i_pcr_start < 0 )
+ p_sys->i_pcr_start = -1;
+
+ p_sys->i_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
+ if( p_sys->i_length < 0 )
+ p_sys->i_length = -1;
+
return VLC_SUCCESS;
}
-
/*****************************************************************************
* Demux:
*****************************************************************************/
@@ -1244,8 +1259,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * );
- *pi64 = p_sys->i_length;
- return VLC_SUCCESS;
+ if( p_sys->i_length < 0 )
+ {
+ *pi64 = (int64_t)((double)p_sys->i_length * (double)1000000.0);
+ return VLC_SUCCESS;
+ }
+ return VLC_EGENERIC;
case DEMUX_GET_POSITION:
pf = (double*)va_arg( args, double* );
@@ -1253,38 +1272,47 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
*pf = (double)( p_sys->i_pcr - p_sys->i_pcr_start +
p_sys->i_start ) / (double)(p_sys->i_length);
+ return VLC_SUCCESS;
}
- else
- {
- *pf = 0.0;
- }
- return VLC_SUCCESS;
+ *pf = 0.0;
+ return VLC_EGENERIC;
case DEMUX_SET_POSITION:
- f = (double)va_arg( args, double );
+ case DEMUX_SET_TIME:
if( p_sys->rtsp && p_sys->i_length > 0 )
{
float time;
+ int64_t i64;
int i;
- time = f * (double)p_sys->i_length / 1000000.0; /* in second */
+ if( i_query == DEMUX_SET_TIME )
+ {
+ i64 = (int64_t)va_arg( args, int64_t );
+ time = (float)((double)i64 / (double)1000000.0); /* in second */
+ }
+ else
+ {
+ f = (double)va_arg( args, double );
+ time = f * (double)p_sys->i_length / (double)1000000.0; /* in second */
+ }
+
if( !p_sys->rtsp->playMediaSession( *p_sys->ms, time, -1, 1 ) )
{
msg_Err( p_demux, "PLAY failed %s",
p_sys->env->getResultMsg() );
return VLC_EGENERIC;
}
+ es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
p_sys->i_pcr = 0;
for( i = 0; i < p_sys->i_track; i++ )
{
p_sys->track[i]->b_rtcp_sync = VLC_FALSE;
p_sys->track[i]->i_pts = 0;
- es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
}
- p_sys->i_pcr = p_sys->i_pcr_start = p_sys->ms->playStartTime();
- p_sys->i_length = (int64_t)((double) p_sys->ms->playEndTime() * 1000000.0);
+ p_sys->i_pcr_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
+ p_sys->i_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
msg_Dbg( p_demux, "seek start: %lld stop: %lld",
p_sys->i_pcr_start, p_sys->i_length );
@@ -1342,17 +1370,18 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
else if( !b_bool && p_sys->p_timeout != NULL )
p_sys->p_timeout->b_handle_keep_alive = VLC_FALSE;
+ es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
+ p_sys->i_pcr = 0;
+
/* reset PCR and PCR start, mmh won't work well for multi-stream I fear */
for( i = 0; !b_bool && i < p_sys->i_track; i++ )
{
p_sys->track[i]->b_rtcp_sync = VLC_FALSE;
p_sys->track[i]->i_pts = 0;
- p_sys->i_pcr = 0;
- es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
}
- p_sys->i_pcr = p_sys->i_pcr_start = p_sys->ms->playStartTime();
- p_sys->i_length = (int64_t)((double) p_sys->ms->playEndTime() * 1000000.0);
+ p_sys->i_pcr_start = (int64_t)( p_sys->ms->playStartTime() * (double)1000000.0 );
+ p_sys->i_length = (int64_t)( p_sys->ms->playEndTime() * (double)1000000.0 );
msg_Dbg( p_demux, "pause start: %lld stop: %lld",
p_sys->i_pcr_start, p_sys->i_length );
@@ -1433,11 +1462,6 @@ static int RollOverTcp( demux_t *p_demux )
if( i_return != VLC_SUCCESS )
goto error;
- /* Retrieve the duration if possible */
- p_sys->i_length = (int64_t)( p_sys->ms->playEndTime() * 1000000.0 );
- if( p_sys->i_length < 0 )
- p_sys->i_length = -1;
-
/* Update all tracks */
iter = new MediaSubsessionIterator( *p_sys->ms );
i_tk = 0;
@@ -1675,7 +1699,6 @@ static void StreamClose( void *p_private )
p_demux->b_error = VLC_TRUE;
}
-
/*****************************************************************************
*
*****************************************************************************/
More information about the vlc-devel
mailing list