]> git.sesse.net Git - vlc/commitdiff
live-starttime.patch the patch needs latest live555 source code.
authorJean-Paul Saman <jpsaman@videolan.org>
Tue, 20 Feb 2007 12:44:33 +0000 (12:44 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Tue, 20 Feb 2007 12:44:33 +0000 (12:44 +0000)
extras/contrib/src/Makefile
extras/contrib/src/Patches/live-starttime.patch [new file with mode: 0644]

index 3109125ed6345ef972d689a2a7c38586dc6e1f99..57c11e3e7b9da2c1d00e46ddccdb56af0d5168b5 100644 (file)
@@ -1080,6 +1080,7 @@ endif
 ifdef HAVE_DARWIN_OS
        patch -p0 < Patches/live-osx.patch
 endif
+       patch -p0 < Patches/live-starttime.patch
 
 .live: live
 ifdef HAVE_WIN32 
@@ -1565,6 +1566,7 @@ libraw1394: libraw1394-$(LIBRAW1394_VERSION).tar.gz
 
 .libraw1394: libraw1394
        (cd $<; ./configure --prefix=$(PREFIX) && make && make DESTDIR=$(PRFIX) install)
+#      sed 's/^typedef u_int8_t  byte_t;/\/* typedef u_int8_t  byte_t;\*\//'
        touch $@
        
 CLEAN_file += .libraw1394
diff --git a/extras/contrib/src/Patches/live-starttime.patch b/extras/contrib/src/Patches/live-starttime.patch
new file mode 100644 (file)
index 0000000..4b24f0a
--- /dev/null
@@ -0,0 +1,160 @@
+diff -ruN live.orig/liveMedia/MediaSession.cpp live/liveMedia/MediaSession.cpp
+--- live.orig/liveMedia/MediaSession.cpp       2007-01-17 21:44:26.000000000 +0100
++++ live/liveMedia/MediaSession.cpp    2007-01-22 22:17:54.000000000 +0100
+@@ -61,7 +61,7 @@
+ MediaSession::MediaSession(UsageEnvironment& env)
+   : Medium(env),
+     fSubsessionsHead(NULL), fSubsessionsTail(NULL),
+-    fConnectionEndpointName(NULL), fMaxPlayEndTime(0.0f),
++    fConnectionEndpointName(NULL), fMaxPlayStartTime(0.0f), fMaxPlayEndTime(0.0f),
+     fScale(1.0f), fMediaSessionType(NULL), fSessionName(NULL), fSessionDescription(NULL) {
+ #ifdef SUPPORT_REAL_RTSP
+   RealInitSDPAttributes(this);
+@@ -348,8 +348,8 @@
+   return parseSuccess;
+ }
+-static Boolean parseRangeAttribute(char const* sdpLine, float& endTime) {
+-  return sscanf(sdpLine, "a=range: npt = %*g - %g", &endTime) == 1;
++static Boolean parseRangeAttribute(char const* sdpLine, float& startTime, float& endTime) {
++  return sscanf(sdpLine, "a=range: npt = %g - %g", &startTime, &endTime) == 2;
+ }
+ Boolean MediaSession::parseSDPAttribute_range(char const* sdpLine) {
+@@ -357,9 +357,13 @@
+   // (Later handle other kinds of "a=range" attributes also???#####)
+   Boolean parseSuccess = False;
++  float playStartTime;
+   float playEndTime;
+-  if (parseRangeAttribute(sdpLine, playEndTime)) {
++  if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
+     parseSuccess = True;
++    if (playStartTime != fMaxPlayStartTime && playStartTime >= 0.0f) {
++      fMaxPlayStartTime = playStartTime;
++    }
+     if (playEndTime > fMaxPlayEndTime) {
+       fMaxPlayEndTime = playEndTime;
+     }
+@@ -526,7 +530,7 @@
+     fSizelength(0), fStreamstateindication(0), fStreamtype(0),
+     fCpresent(False), fRandomaccessindication(False),
+     fConfig(NULL), fMode(NULL), fSpropParameterSets(NULL),
+-    fPlayEndTime(0.0),
++    fPlayStartTime(0.0), fPlayEndTime(0.0),
+     fVideoWidth(0), fVideoHeight(0), fVideoFPS(0), fNumChannels(1), fScale(1.0f),
+     fRTPSocket(NULL), fRTCPSocket(NULL),
+     fRTPSource(NULL), fRTCPInstance(NULL), fReadSource(NULL) {
+@@ -548,6 +552,12 @@
+ #endif
+ }
++float MediaSubsession::playStartTime() const {
++  if (fPlayStartTime > 0) return fPlayStartTime;
++
++  return fParent.playStartTime();
++}
++
+ float MediaSubsession::playEndTime() const {
+   if (fPlayEndTime > 0) return fPlayEndTime;
+@@ -967,9 +977,16 @@
+   // (Later handle other kinds of "a=range" attributes also???#####)
+   Boolean parseSuccess = False;
++  float playStartTime;
+   float playEndTime;
+-  if (parseRangeAttribute(sdpLine, playEndTime)) {
++  if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) {
+     parseSuccess = True;
++    if (playStartTime != fPlayStartTime && playStartTime >= 0.0f ) {
++      fPlayStartTime = playStartTime;
++      if (playStartTime != fParent.playStartTime()) {
++      fParent.playStartTime() = playStartTime;
++      }
++    }
+     if (playEndTime > fPlayEndTime) {
+       fPlayEndTime = playEndTime;
+       if (playEndTime > fParent.playEndTime()) {
+diff -ruN live.orig/liveMedia/RTSPClient.cpp live/liveMedia/RTSPClient.cpp
+--- live.orig/liveMedia/RTSPClient.cpp 2007-01-22 22:17:46.000000000 +0100
++++ live/liveMedia/RTSPClient.cpp      2007-01-22 22:21:12.000000000 +0100
+@@ -1128,7 +1128,8 @@
+       nextLineStart = getLine(lineStart);
+-      if (parseScaleHeader(lineStart, session.scale())) break;
++      if( parseScaleHeader(lineStart, session.scale())) continue;
++      if( parseRangeHeader(lineStart, session.playStartTime(), session.playEndTime()) ) continue;
+     }
+     if (fTCPStreamIdCount == 0) { // we're not receiving RTP-over-TCP
+@@ -1229,6 +1230,7 @@
+       continue;
+       }
+       if (parseScaleHeader(lineStart, subsession.scale())) continue;
++      //if (parseRangeHeader(lineStart, subsession.playStartTime(), subsession.playEndTime())) continue;
+     }
+     delete[] cmd;
+@@ -2287,6 +2289,14 @@
+   return radix_safe_sscanf(line, "%f", &scale) == 1;
+ }
++Boolean RTSPClient::parseRangeHeader(char const* line, float& start, float& end) {
++  if (_strncasecmp(line, "Range: ", 7) != 0) return False;
++  line += 7;
++
++  /* "npt=start-" is also valid */
++  return radix_safe_sscanf(line, "npt = %f - %f", &start, &end) >= 1;
++}
++
+ Boolean RTSPClient::parseGetParameterHeader(char const* line, 
+                                             const char* param,
+                                             char*& value) {
+diff -ruN live.orig/liveMedia/include/MediaSession.hh live/liveMedia/include/MediaSession.hh
+--- live.orig/liveMedia/include/MediaSession.hh        2007-01-17 21:44:26.000000000 +0100
++++ live/liveMedia/include/MediaSession.hh     2007-01-22 22:20:30.000000000 +0100
+@@ -39,6 +39,7 @@
+                             MediaSession*& resultSession);
+   Boolean hasSubsessions() const { return fSubsessionsHead != NULL; }
++  float& playStartTime() { return fMaxPlayStartTime; }
+   float& playEndTime() { return fMaxPlayEndTime; }
+   char* connectionEndpointName() const { return fConnectionEndpointName; }
+   char const* CNAME() const { return fCNAME; }
+@@ -97,6 +98,7 @@
+   // Fields set from a SDP description:
+   char* fConnectionEndpointName;
++  float fMaxPlayStartTime;
+   float fMaxPlayEndTime;
+   struct in_addr fSourceFilterAddr; // used for SSM
+   float fScale; // set from a RTSP "Scale:" header
+@@ -147,6 +149,7 @@
+     // This is the source that client sinks read from.  It is usually
+     // (but not necessarily) the same as "rtpSource()"
++  float playStartTime() const;
+   float playEndTime() const;
+   Boolean initiate(int useSpecialRTPoffset = -1);
+@@ -268,6 +271,7 @@
+   Boolean fCpresent, fRandomaccessindication;
+   char *fConfig, *fMode, *fSpropParameterSets;
++  float fPlayStartTime;
+   float fPlayEndTime;
+   unsigned short fVideoWidth, fVideoHeight;
+      // screen dimensions (set by an optional a=x-dimensions: <w>,<h> line)
+diff -ruN live.orig/liveMedia/include/RTSPClient.hh live/liveMedia/include/RTSPClient.hh
+--- live.orig/liveMedia/include/RTSPClient.hh  2007-01-17 21:44:26.000000000 +0100
++++ live/liveMedia/include/RTSPClient.hh       2007-01-22 22:17:54.000000000 +0100
+@@ -185,6 +185,7 @@
+   Boolean parseRTPInfoHeader(char const* line, unsigned& trackId,
+                            u_int16_t& seqNum, u_int32_t& timestamp);
+   Boolean parseScaleHeader(char const* line, float& scale);
++  Boolean parseRangeHeader(char const* line, float& start, float& end);
+   Boolean parseGetParameterHeader(char const* line, 
+                                   const char* param,
+                                   char*& value);