[vlc-devel] RTSP trickplay - libvlc_media_player_set_rate support for fast forward/rewind
Nuno Mota
ee05154 at fe.up.pt
Sun May 29 17:04:33 CEST 2011
In 2008 I found this, @Laurent thanks for the input. Yes can_rewind does
exist and is currently working for 1.1.9. But nothing is supposedly
happening with can_rewind.
------------------------------------------------------------------------------------------------
commit 75adef44b044b9b81e593e74db857d6b2a7e4eaa
Author: Jean-Paul Saman <jean-paul.saman at m2x.nl>
Date: Thu Nov 20 14:19:37 2008 +0100
Signal can_rewind for use by user interfaces.
commit f76cff41026a8c812644a57db33c4d2d846cf55a
Author: Jean-Paul Saman <jean-paul.saman at m2x.nl>
Date: Wed Nov 19 16:07:34 2008 +0100
Allowing for rate < 0 enables rewind playback for eg: RTSP streams.
------------------------------------------------------------------------------------------------
So this means one can do something like this:
int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate )
{
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
bool b_rewindable;
if( !p_input_thread )
return 0;
b_rewindable = var_GetBool( p_input_thread, "can-rewind" );
if (rate < 0. && !b_rewindable)
{
libvlc_printerr ("Playing backward not supported for current file");
return -1;
}
var_SetFloat (p_mi, "rate", rate);
var_SetFloat( p_input_thread, "rate", rate );
vlc_object_release( p_input_thread );
return 0;
}
The test was successful once again. For a RTSP stream it was able to fast
rewind, otherwise reading from a file at least, set_rate(-2) returned -1.
2011/5/29 Laurent Aimar <fenrir at elivagar.org>
> On Sun, May 29, 2011 at 11:53:54AM +0300, Kaarlo Räihä wrote:
> > 2011/5/29 Nuno Mota <ee05154 at fe.up.pt>
> >
> > So i've been using VLC java bindings for a few days to create a RTSP
> client
> > to work with my Live555 RTSP Server implementation.
> >
> > Both commands play and pause work fine for me. Seek is working fine
> and the
> > playback works great after all these commands. However there's a few
> > remarks relating to fast forward and fast rewind. Fast forward works
> fine,
> > it moves along great but sometimes the current media position is set
> to
> > values way back the timeline. When I issue the command setRate(1),
> the
> > video is played again at the same rate but it skips some frames I
> think,
> > because the playback looks a little bit jumpy. I always get the same
> output
> > when i do this:
> >
> > libdvbpsi error (PSI decoder): TS discontinuity (received 10,
> expected 15)
> > for PID 0
> > libdvbpsi error (PSI decoder): TS discontinuity (received 10,
> expected 0)
> > for PID 4095
> > libdvbpsi error (PSI decoder): TS duplicate (received 12, expected
> 13) for
> > PID 17
> >
> > I see no other issues concerning Fast forward. Relative to fast
> rewind the
> > source code in the control section in media_player.c in line 1149
> >
> > int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float
> rate )
> > {
> >
> > if (rate < 0.)
> > {
> > libvlc_printerr ("Playing backward not supported");
> > return -1;
> > }
> >
> > Playing backwards is not supported playing from a disc file, i've
> tested it
> > myself, however, when streaming from an Internet source the case is
> quite
> > different. I commented the above lines to produce something similar
> to fast
> > forward and the result was successful.
> >
> > PLAY rtsp://172.16.2.196:8554/Redbull_720.ts/ RTSP/1.0
> > CSeq: 11
> > User-Agent: LibVLC/1.1.9 (LIVE555 Streaming Media v2010.11.17)
> > Session: 68C9705
> > Scale: -2.000000
> >
> > RTSP/1.0 200 OK
> > CSeq: 11
> > Date: Fri, May 27 2011 14:41:49 GMT
> > Scale: -2.000000
> > Session: 68C97056
> > RTP-Info: url=rtsp://
> 172.16.2.196:8554/Redbull_720.ts/track1;seq=13622;
> > rtptime=210151468
> >
> > The playback was as good as the fast forward results. So here's my
> question
> > why is it still not supported for streaming? I see no other problems
> as the
> > ones that exist to still make this not supported. I'm kindly
> accepting
> > responses and comments and other stuff to make this a more
> interesting
> > topic.
> >
> >
> > AFAIK it would be somewhat ugly hack in libvlc to add support like this
> for
> > single access method (discs aren't the only problematic thing) with
> simple code
> > change. But if there would be internal variable (e.g.
> b_can_play_backwards) and
> > code for this in rtsp access, I don't think that patch would be opposed
> that
> > much.
>
> The input code does declare weither or not rewinding is supported for the
> current input
> ("can-rewind" variable of the input_thread_t object).
>
> --
> fenrir
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110529/131b410b/attachment.html>
More information about the vlc-devel
mailing list