oes the RTSP implementation (client and/or server) support 'trick mode' operations (i.e., seek, fast-forward, reverse play)?
When talking about "trick mode support", it's important to distinguish between RTSP client support, and RTSP server support.Our RTSP client implementation fully supports 'trick play' operations. Note the "start", "end" and "scale" parameters to "RTSPClient::sendPlayCommand()". (Note also that our "openRTSP" demo RTSP client application has command-line options that can be used to demonstrate client 'trick play' operations.)
Our RTSP server implementation also supports 'trick play' operations, but note that parts of this are (necessarily) media type specific. I.e., there has to be some new code added for each different type of media file that we wish to stream. This functionality has already been provided for some types of media file.
To add 'trick play' support for a media type (that does not already support it), changes need to be made to the corresponding subclass of "ServerMediaSubsession":
- To add support for seeking within a stream, you will need to implement the following virtual functions:
-
virtual float duration() const;
Returns the file's duration, in seconds -
virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes);
(Attempts to) seek within the input source.
-
- To add support for 'fast forward' and/or 'reverse play', you will also need to implement the following virtual functions:
-
virtual void testScaleFactor(float& scale);
Inspects the input value of "scale", and, if necessary, changes it to a nearby value that we support. (E.g., if the input value of "scale" is 3.3, you might change it to 3 (an integer).) If there's no 'nearby' value that you support, just set "scale" to 1 (the default value). -
virtual void setStreamSourceScale(FramedSource* inputSource, float scale);
Actually sets the scale factor for a specific input source. (The value of "scale" will previously have been passed in and out of "testScaleFactor()", so we know that it is a value that we support.)
-
PLAY rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp?playtype=1&boid=001&backupagent=118.122.89.27:554&clienttype=1&time=20100929182111+08&life=172800&ifpricereqsnd=1&vcdnid=001&userid=123&mediaid=ch10083121594790060557&ctype=2&TSTVTimeLife=1800&contname=&authid=0&UserLiveType=1&nodelevel=3 RTSP/1.0
//play的另外一种用法。用于快进和快退。
CSeq: 43
Session: 65565885
User-Agent:ZTE Ltd.co RTSP protocal verion 1.0 guid-2.1.1.100/B519D290-C0EC-EE35-7368-893BE4C0B347
Scale: -32.0
//Scale: -32.0,表示以32倍速快退。Scale: 32.0,表示以32倍速快进。
Range: npt=now-
回复
RTSP/1.0 200 OK
Server: ZXUSS100 1.0
CSeq: 43
Range: clock=20100929T102609.02Z-20100929T095637.75Z
Scale: -32.0
Session: 65565885
RTP-Info: url=rtsp://118.122.89.36:10084/live/ch10083121594790060557.sdp/trackID=2;seq=22277;rtptime=1792329138
比较好的文章
PLAY rtsp://118.122.89.27:554/live/ch10083121594790060557.sdp?playtype=1&boid=001&backupagent=118.122.89.27:554&clienttype=1&time=20100929182111+08&life=172800&ifpricereqsnd=1&vcdnid=001&userid=123&mediaid=ch10083121594790060557&ctype=2&TSTVTimeLife=1800&contname=&authid=0&UserLiveType=1&nodelevel=3 RTSP/1.0
//play的另外一种用法。用于快进和快退。
CSeq: 43
Session: 65565885
User-Agent:ZTE Ltd.co RTSP protocal verion 1.0 guid-2.1.1.100/B519D290-C0EC-EE35-7368-893BE4C0B347
Scale: -32.0
//Scale: -32.0,表示以32倍速快退。Scale: 32.0,表示以32倍速快进。
Range: npt=now-
RTSP/1.0 200 OK
Server: ZXUSS100 1.0
CSeq: 43
Range: clock=20100929T102609.02Z-20100929T095637.75Z
Scale: -32.0
Session: 65565885
RTP-Info: url=rtsp://118.122.89.36:10084/live/ch10083121594790060557.sdp/trackID=2;seq=22277;rtptime=1792329138
比较好的文章:TS流文件的快进快退研究 http://www.docin.com/p-630114734.html