1 diff -ruN live.orig/liveMedia/MediaSession.cpp live/liveMedia/MediaSession.cpp
2 --- live.orig/liveMedia/MediaSession.cpp 2007-01-17 21:44:26.000000000 +0100
3 +++ live/liveMedia/MediaSession.cpp 2007-01-22 22:17:54.000000000 +0100
5 MediaSession::MediaSession(UsageEnvironment& env)
7 fSubsessionsHead(NULL), fSubsessionsTail(NULL),
8 - fConnectionEndpointName(NULL), fMaxPlayEndTime(0.0f),
9 + fConnectionEndpointName(NULL), fMaxPlayStartTime(0.0f), fMaxPlayEndTime(0.0f),
10 fScale(1.0f), fMediaSessionType(NULL), fSessionName(NULL), fSessionDescription(NULL) {
11 #ifdef SUPPORT_REAL_RTSP
12 RealInitSDPAttributes(this);
17 -static Boolean parseRangeAttribute(char const* sdpLine, float& endTime) {
18 - return sscanf(sdpLine, "a=range: npt = %*g - %g", &endTime) == 1;
19 +static Boolean parseRangeAttribute(char const* sdpLine, float& startTime, float& endTime) {
20 + return sscanf(sdpLine, "a=range: npt = %g - %g", &startTime, &endTime) == 2;
23 Boolean MediaSession::parseSDPAttribute_range(char const* sdpLine) {
25 // (Later handle other kinds of "a=range" attributes also???#####)
26 Boolean parseSuccess = False;
28 + float playStartTime;
30 - if (parseRangeAttribute(sdpLine, playEndTime)) {
31 + if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
33 + if (playStartTime != fMaxPlayStartTime && playStartTime >= 0.0f) {
34 + fMaxPlayStartTime = playStartTime;
36 if (playEndTime > fMaxPlayEndTime) {
37 fMaxPlayEndTime = playEndTime;
40 fSizelength(0), fStreamstateindication(0), fStreamtype(0),
41 fCpresent(False), fRandomaccessindication(False),
42 fConfig(NULL), fMode(NULL), fSpropParameterSets(NULL),
44 + fPlayStartTime(0.0), fPlayEndTime(0.0),
45 fVideoWidth(0), fVideoHeight(0), fVideoFPS(0), fNumChannels(1), fScale(1.0f),
46 fRTPSocket(NULL), fRTCPSocket(NULL),
47 fRTPSource(NULL), fRTCPInstance(NULL), fReadSource(NULL) {
52 +float MediaSubsession::playStartTime() const {
53 + if (fPlayStartTime > 0) return fPlayStartTime;
55 + return fParent.playStartTime();
58 float MediaSubsession::playEndTime() const {
59 if (fPlayEndTime > 0) return fPlayEndTime;
62 // (Later handle other kinds of "a=range" attributes also???#####)
63 Boolean parseSuccess = False;
65 + float playStartTime;
67 - if (parseRangeAttribute(sdpLine, playEndTime)) {
68 + if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
70 + if (playStartTime != fPlayStartTime && playStartTime >= 0.0f ) {
71 + fPlayStartTime = playStartTime;
72 + if (playStartTime != fParent.playStartTime()) {
73 + fParent.playStartTime() = playStartTime;
76 if (playEndTime > fPlayEndTime) {
77 fPlayEndTime = playEndTime;
78 if (playEndTime > fParent.playEndTime()) {
79 diff -ruN live.orig/liveMedia/RTSPClient.cpp live/liveMedia/RTSPClient.cpp
80 --- live.orig/liveMedia/RTSPClient.cpp 2007-01-22 22:17:46.000000000 +0100
81 +++ live/liveMedia/RTSPClient.cpp 2007-01-22 22:21:12.000000000 +0100
84 nextLineStart = getLine(lineStart);
86 - if (parseScaleHeader(lineStart, session.scale())) break;
87 + if( parseScaleHeader(lineStart, session.scale())) continue;
88 + if( parseRangeHeader(lineStart, session.playStartTime(), session.playEndTime()) ) continue;
91 if (fTCPStreamIdCount == 0) { // we're not receiving RTP-over-TCP
95 if (parseScaleHeader(lineStart, subsession.scale())) continue;
96 + //if (parseRangeHeader(lineStart, subsession.playStartTime(), subsession.playEndTime())) continue;
100 @@ -2287,6 +2289,14 @@
101 return radix_safe_sscanf(line, "%f", &scale) == 1;
104 +Boolean RTSPClient::parseRangeHeader(char const* line, float& start, float& end) {
105 + if (_strncasecmp(line, "Range: ", 7) != 0) return False;
108 + /* "npt=start-" is also valid */
109 + return radix_safe_sscanf(line, "npt = %f - %f", &start, &end) >= 1;
112 Boolean RTSPClient::parseGetParameterHeader(char const* line,
115 diff -ruN live.orig/liveMedia/include/MediaSession.hh live/liveMedia/include/MediaSession.hh
116 --- live.orig/liveMedia/include/MediaSession.hh 2007-01-17 21:44:26.000000000 +0100
117 +++ live/liveMedia/include/MediaSession.hh 2007-01-22 22:20:30.000000000 +0100
119 MediaSession*& resultSession);
121 Boolean hasSubsessions() const { return fSubsessionsHead != NULL; }
122 + float& playStartTime() { return fMaxPlayStartTime; }
123 float& playEndTime() { return fMaxPlayEndTime; }
124 char* connectionEndpointName() const { return fConnectionEndpointName; }
125 char const* CNAME() const { return fCNAME; }
128 // Fields set from a SDP description:
129 char* fConnectionEndpointName;
130 + float fMaxPlayStartTime;
131 float fMaxPlayEndTime;
132 struct in_addr fSourceFilterAddr; // used for SSM
133 float fScale; // set from a RTSP "Scale:" header
135 // This is the source that client sinks read from. It is usually
136 // (but not necessarily) the same as "rtpSource()"
138 + float playStartTime() const;
139 float playEndTime() const;
141 Boolean initiate(int useSpecialRTPoffset = -1);
143 Boolean fCpresent, fRandomaccessindication;
144 char *fConfig, *fMode, *fSpropParameterSets;
146 + float fPlayStartTime;
148 unsigned short fVideoWidth, fVideoHeight;
149 // screen dimensions (set by an optional a=x-dimensions: <w>,<h> line)
150 diff -ruN live.orig/liveMedia/include/RTSPClient.hh live/liveMedia/include/RTSPClient.hh
151 --- live.orig/liveMedia/include/RTSPClient.hh 2007-01-17 21:44:26.000000000 +0100
152 +++ live/liveMedia/include/RTSPClient.hh 2007-01-22 22:17:54.000000000 +0100
154 Boolean parseRTPInfoHeader(char const* line, unsigned& trackId,
155 u_int16_t& seqNum, u_int32_t& timestamp);
156 Boolean parseScaleHeader(char const* line, float& scale);
157 + Boolean parseRangeHeader(char const* line, float& start, float& end);
158 Boolean parseGetParameterHeader(char const* line,
161 --- live/liveMedia/include/liveMedia_version.hh 2007-02-20 12:33:45.000000000 +0100
162 +++ live.new/liveMedia/include/liveMedia_version.hh 2007-03-19 22:06:23.000000000 +0100
164 #ifndef _LIVEMEDIA_VERSION_HH
165 #define _LIVEMEDIA_VERSION_HH
167 -#define LIVEMEDIA_LIBRARY_VERSION_STRING "2007.02.20"
168 -#define LIVEMEDIA_LIBRARY_VERSION_INT 1171929600
169 +#define LIVEMEDIA_LIBRARY_VERSION_STRING "2007.03.19"
170 +#define LIVEMEDIA_LIBRARY_VERSION_INT 9999999999