[Live-devel] [vlc-devel] Re: VLC RTSP client support for Transport Stream 'trick play' operations
Glen Gray
glen at lincor.com
Tue Jan 16 07:57:45 PST 2007
Derk-Jan Hartman wrote:
>
> VLC currently does FFW/RW by simply doing a seek. I need to put the
> scale func. as a preferred method over the current functionality in the
> core, which would be some simple additions. Glen Gray should already
> have some code to start this of as a matter of fact.
My patches are rather out of date with the current branch and where very
much specific to our own implementation requirements with regard to
Kasenna servers.
We control vlc via the rc interface, and as such most of our interface
changes have been done from that perspective. My patches over-rode the
rc versions of the fastforward and rewind command to allow you to pass
over a speed, 6, 12, 30 for example. If no values where entered, the
INPUT_RATE_MAX|MIN values where set based on if fastforward|rewind
command was issues.
I added a DEMUX_SET_RATE to the livedotcom.cpp Control function. The
DEMUX_SET_RATE part of control would look for a passed in i_rate
variable. If the i_rate variable was set to INPUT_RATE_MAX it would set
a default of 30 (this is Kasenna specific). If it was INPUT_RATE_MIN, it
would set a default of -30 (again, Kasenna specific).
I also had to add some code to vlc/src/input.c where it deals with the
INPUT_CONTROL_SET_RATE_SLOWER|FASTER. It could call demux2_Control with
a DEMUX_SET_RATE and check for a return value. If we didn't get a
VLC_SUCCESS, it would carry on with the normal RATE control code.
In the liveMedia RTSP demuxer, using the media session, it would Pause
the stream, set the scale value and offsets and resume playback to enter
into Fastforward|Rewind mode.
Here's a sample of my code....
case DEMUX_SET_RATE:
i_rate = (int)va_arg( args, int );
if( i_rate == INPUT_RATE_MAX )
i_rate = 30;
else if( i_rate == INPUT_RATE_MIN )
i_rate = -30;
else if( i_rate == INPUT_RATE_DEFAULT || i_rate == 0 )
i_rate = 1;
//First of all we need to Pause the stream
if( !p_sys->rtsp->pauseMediaSession( *p_sys->ms ) )
{
msg_Err( p_demux, "PAUSE failed %s",
p_sys->env->getResultMsg() );
return VLC_EGENERIC;
}
//Passing -1 for the start and end time will mean liveMedia won't
//create a Range: section for the RTSP message. Server should pick
//up from current position.
if( ( !p_sys->rtsp->playMediaSession( *p_sys->ms,
-1, -1, i_rate ) ) )
{
msg_Err( p_demux, "PLAY with Scale %d failed %s",
i_rate, p_sys->env->getResultMsg() );
return VLC_EGENERIC;
}
/* Resync the stream */
p_sys->i_start = (mtime_t)(f * (double)p_sys->i_length);
p_sys->i_pcr_start = 0;
p_sys->i_pcr = 0;
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
return VLC_SUCCESS;
There was of course plenty of other pieces to the puzzle to get this to
work, starting Dermot McGahon initially working with Derk-jan and Ross
to get Kasenna playback and the foundations for the Scale support into
liveMedia. All of which Ross has included in the liveMedia codebase as
we've made submissions.
As stated, my patches are against a rather old version of VLC trunk.
Dermot had made a push before Xmas to get as many of our patches
accepted upstream and it's been left to me to get our trickplay support
upstream too. Although, recently I've had far too much on project wise
to even attempt this, I'm in a position now where at least I can spend
some personal time on it in the evenings if work is too loaded (which it
usually is)
We've been very keen to contribute this support back to VLC and liveMedia.
--
Glen Gray <glen at lincor.com> Digital Depot, Thomas Street
Senior Software Engineer Dublin 8, Ireland
Lincor Solutions Ltd. Ph: +353 (0) 1 4893682
More information about the live-devel
mailing list