]> git.sesse.net Git - vlc/blob - extras/contrib/src/Patches/live-starttime.patch
Update live555 version number in live-starttime.patch
[vlc] / extras / contrib / src / Patches / live-starttime.patch
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
4 @@ -61,7 +61,7 @@
5  MediaSession::MediaSession(UsageEnvironment& env)
6    : Medium(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);
13 @@ -348,8 +348,8 @@
14    return parseSuccess;
15  }
16  
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;
21  }
22  
23  Boolean MediaSession::parseSDPAttribute_range(char const* sdpLine) {
24 @@ -357,9 +357,13 @@
25    // (Later handle other kinds of "a=range" attributes also???#####)
26    Boolean parseSuccess = False;
27  
28 +  float playStartTime;
29    float playEndTime;
30 -  if (parseRangeAttribute(sdpLine, playEndTime)) {
31 +  if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
32      parseSuccess = True;
33 +    if (playStartTime != fMaxPlayStartTime && playStartTime >= 0.0f) {
34 +      fMaxPlayStartTime = playStartTime;
35 +    }
36      if (playEndTime > fMaxPlayEndTime) {
37        fMaxPlayEndTime = playEndTime;
38      }
39 @@ -526,7 +530,7 @@
40      fSizelength(0), fStreamstateindication(0), fStreamtype(0),
41      fCpresent(False), fRandomaccessindication(False),
42      fConfig(NULL), fMode(NULL), fSpropParameterSets(NULL),
43 -    fPlayEndTime(0.0),
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) {
48 @@ -548,6 +552,12 @@
49  #endif
50  }
51  
52 +float MediaSubsession::playStartTime() const {
53 +  if (fPlayStartTime > 0) return fPlayStartTime;
54 +
55 +  return fParent.playStartTime();
56 +}
57 +
58  float MediaSubsession::playEndTime() const {
59    if (fPlayEndTime > 0) return fPlayEndTime;
60  
61 @@ -967,9 +977,16 @@
62    // (Later handle other kinds of "a=range" attributes also???#####)
63    Boolean parseSuccess = False;
64  
65 +  float playStartTime;
66    float playEndTime;
67 -  if (parseRangeAttribute(sdpLine, playEndTime)) {
68 +  if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
69      parseSuccess = True;
70 +    if (playStartTime != fPlayStartTime && playStartTime >= 0.0f ) {
71 +      fPlayStartTime = playStartTime;
72 +      if (playStartTime != fParent.playStartTime()) {
73 +       fParent.playStartTime() = playStartTime;
74 +      }
75 +    }
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
82 @@ -1128,7 +1128,8 @@
83  
84        nextLineStart = getLine(lineStart);
85  
86 -      if (parseScaleHeader(lineStart, session.scale())) break;
87 +      if( parseScaleHeader(lineStart, session.scale())) continue;
88 +      if( parseRangeHeader(lineStart, session.playStartTime(), session.playEndTime()) ) continue;
89      }
90  
91      if (fTCPStreamIdCount == 0) { // we're not receiving RTP-over-TCP
92 @@ -1229,6 +1230,7 @@
93         continue;
94        }
95        if (parseScaleHeader(lineStart, subsession.scale())) continue;
96 +      //if (parseRangeHeader(lineStart, subsession.playStartTime(), subsession.playEndTime())) continue;
97      }
98  
99      delete[] cmd;
100 @@ -2287,6 +2289,14 @@
101    return radix_safe_sscanf(line, "%f", &scale) == 1;
102  }
103  
104 +Boolean RTSPClient::parseRangeHeader(char const* line, float& start, float& end) {
105 +  if (_strncasecmp(line, "Range: ", 7) != 0) return False;
106 +  line += 7;
107 +
108 +  /* "npt=start-" is also valid */
109 +  return radix_safe_sscanf(line, "npt = %f - %f", &start, &end) >= 1;
110 +}
111 +
112  Boolean RTSPClient::parseGetParameterHeader(char const* line, 
113                                              const char* param,
114                                              char*& value) {
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
118 @@ -39,6 +39,7 @@
119                               MediaSession*& resultSession);
120  
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; }
126 @@ -97,6 +98,7 @@
127  
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
134 @@ -147,6 +149,7 @@
135      // This is the source that client sinks read from.  It is usually
136      // (but not necessarily) the same as "rtpSource()"
137  
138 +  float playStartTime() const;
139    float playEndTime() const;
140  
141    Boolean initiate(int useSpecialRTPoffset = -1);
142 @@ -268,6 +271,7 @@
143    Boolean fCpresent, fRandomaccessindication;
144    char *fConfig, *fMode, *fSpropParameterSets;
145  
146 +  float fPlayStartTime;
147    float fPlayEndTime;
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
153 @@ -185,6 +185,7 @@
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, 
159                                    const char* param,
160                                    char*& value);
161 --- live/liveMedia/include/liveMedia_version.hh.orig    2007-05-24 22:44:37.000000000 +0200
162 +++ live/liveMedia/include/liveMedia_version.hh 2007-05-27 14:16:11.000000000 +0200
163 @@ -5,6 +5,6 @@
164  #define _LIVEMEDIA_VERSION_HH
165  
166  #define LIVEMEDIA_LIBRARY_VERSION_STRING       "2007.07.01"
167 -#define LIVEMEDIA_LIBRARY_VERSION_INT          1183248000
168 +#define LIVEMEDIA_LIBRARY_VERSION_INT          9999999999
169  
170  #endif
171