]> granicus.if.org Git - rtmpdump/commitdiff
Add option --realtime (-R) to rtmpdump to disable the BUFX hack
authorUlrik Dickow <u.dickow@gmail.com>
Tue, 24 Jul 2012 15:17:26 +0000 (17:17 +0200)
committerHoward Chu <hyc@highlandsun.com>
Thu, 26 Jul 2012 11:59:16 +0000 (04:59 -0700)
rtmpdump.1
rtmpdump.1.html
rtmpdump.c

index 0d9de8d1d56df45e1350e3f3f23f0488ab108bb3..7bb532824fb4cc0433fdd69c2eddae78854f37a6 100644 (file)
@@ -1,4 +1,4 @@
-.TH RTMPDUMP 1 "2011-07-20" "RTMPDump v2.4"
+.TH RTMPDUMP 1 "2012-07-24" "RTMPDump v2.4"
 .\" Copyright 2011 Howard Chu.
 .\" Copying permitted according to the GNU General Public License V2.
 .SH NAME
@@ -177,6 +177,12 @@ live streams is possible.
 Name of live stream to subscribe to. Defaults to
 .IR playpath .
 .TP
+.B \-\-realtime        \-R
+Download approximately in realtime, without attempting to speed up via
+Pause/Unpause commands ("the BUFX hack").
+Useful for servers that jump backwards in time at the Unpause command.
+Resuming and seeking in realtime streams is still possible.
+.TP
 .B \-\-resume          \-e
 Resume an incomplete RTMP download.
 .TP
index 826f722d9f149c6176f6fc4f56fa4b80b7a48b42..4c39b359e05048287fc3354cb25ce7520b86d180 100644 (file)
@@ -6,7 +6,7 @@
 <tr><td>RTMPDUMP(1)<td align="center"><td align="right">RTMPDUMP(1)
 </thead>
 <tfoot>
-<tr><td>RTMPDump v2.4<td align="center">2011-07-20<td align="right">RTMPDUMP(1)
+<tr><td>RTMPDump v2.4<td align="center">2012-07-24<td align="right">RTMPDUMP(1)
 </tfoot>
 <tbody><tr><td colspan="3"><br><br><ul>
 <!-- Copyright 2011 Howard Chu.
@@ -34,6 +34,7 @@ rtmpdump &minus; RTMP streaming media client
 [<b>&minus;y</b><i>&nbsp;playpath</i>]
 [<b>&minus;Y</b>]
 [<b>&minus;v</b>]
+[<b>&minus;R</b>]
 [<b>&minus;d</b><i>&nbsp;subscription</i>]
 [<b>&minus;e</b>]
 [<b>&minus;k</b><i>&nbsp;skip</i>]
@@ -218,6 +219,15 @@ Name of live stream to subscribe to. Defaults to
 </dl>
 <p>
 <dl compact><dt>
+<b>&minus;&minus;realtime &minus;R</b>
+<dd>
+Download approximately in realtime, without attempting to speed up via
+Pause/Unpause commands (&quot;the BUFX hack&quot;).
+Useful for servers that jump backwards in time at the Unpause command.
+Resuming and seeking in realtime streams is still possible.
+</dl>
+<p>
+<dl compact><dt>
 <b>&minus;&minus;resume &minus;e</b>
 <dd>
 Resume an incomplete RTMP download.
index 34bfdba6416e0a1f8ff135b498f43e5d233fd04d..e52f7d409a7848809746ccc84f92ae53859c73bd 100644 (file)
@@ -441,7 +441,7 @@ GetLastKeyframe(FILE * file,        // output file [in]
 
 int
 Download(RTMP * rtmp,          // connected RTMP object
-        FILE * file, uint32_t dSeek, uint32_t dStopOffset, double duration, int bResume, char *metaHeader, uint32_t nMetaHeaderSize, char *initialFrame, int initialFrameType, uint32_t nInitialFrameSize, int nSkipKeyFrames, int bStdoutMode, int bLiveStream, int bHashes, int bOverrideBufferTime, uint32_t bufferTime, double *percent)   // percentage downloaded [out]
+        FILE * file, uint32_t dSeek, uint32_t dStopOffset, double duration, int bResume, char *metaHeader, uint32_t nMetaHeaderSize, char *initialFrame, int initialFrameType, uint32_t nInitialFrameSize, int nSkipKeyFrames, int bStdoutMode, int bLiveStream, int bRealtimeStream, int bHashes, int bOverrideBufferTime, uint32_t bufferTime, double *percent)      // percentage downloaded [out]
 {
   int32_t now, lastUpdate;
   int bufferSize = 64 * 1024;
@@ -492,6 +492,8 @@ Download(RTMP * rtmp,               // connected RTMP object
                    bResume ? "Resuming" : "Starting",
                    (double) size / 1024.0);
        }
+      if (bRealtimeStream)
+       RTMP_LogPrintf("  in approximately realtime (disabled BUFX speedup hack)\n");
     }
 
   if (dStopOffset > 0)
@@ -681,6 +683,8 @@ void usage(char *prog)
            ("--live|-v               Save a live stream, no --resume (seeking) of live streams possible\n");
          RTMP_LogPrintf
            ("--subscribe|-d string   Stream name to subscribe to (otherwise defaults to playpath if live is specifed)\n");
+         RTMP_LogPrintf
+           ("--realtime|-R           Don't attempt to speed up download via the Pause/Unpause BUFX hack\n");
          RTMP_LogPrintf
            ("--flv|-o string         FLV output file name, if the file name is - print stream to stdout\n");
          RTMP_LogPrintf
@@ -748,6 +752,7 @@ main(int argc, char **argv)
   int protocol = RTMP_PROTOCOL_UNDEFINED;
   int retries = 0;
   int bLiveStream = FALSE;     // is it a live stream? then we can't seek/resume
+  int bRealtimeStream = FALSE;  // If true, disable the BUFX hack (be patient)
   int bHashes = FALSE;         // display byte counters not hashes by default
 
   long int timeout = DEF_TIMEOUT;      // timeout connection after 120 seconds
@@ -832,6 +837,7 @@ main(int argc, char **argv)
 #endif
     {"flashVer", 1, NULL, 'f'},
     {"live", 0, NULL, 'v'},
+    {"realtime", 0, NULL, 'R'},
     {"flv", 1, NULL, 'o'},
     {"resume", 0, NULL, 'e'},
     {"timeout", 1, NULL, 'm'},
@@ -851,7 +857,7 @@ main(int argc, char **argv)
 
   while ((opt =
          getopt_long(argc, argv,
-                     "hVveqzr:s:t:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:",
+                     "hVveqzRr:s:t:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:",
                      longopts, NULL)) != -1)
     {
       switch (opt)
@@ -936,6 +942,9 @@ main(int argc, char **argv)
        case 'v':
          bLiveStream = TRUE;   // no seeking or resuming possible!
          break;
+       case 'R':
+         bRealtimeStream = TRUE; // seeking and resuming is still possible
+         break;
        case 'd':
          STR2AVAL(subscribepath, optarg);
          break;
@@ -1181,7 +1190,7 @@ main(int argc, char **argv)
                   &flashVer, &subscribepath, &usherToken, dSeek, dStopOffset, bLiveStream, timeout);
 
   /* Try to keep the stream moving if it pauses on us */
-  if (!bLiveStream && !(protocol & RTMP_FEATURE_HTTP))
+  if (!bLiveStream && !bRealtimeStream && !(protocol & RTMP_FEATURE_HTTP))
     rtmp.Link.lFlags |= RTMP_LF_BUFX;
 
   off_t size = 0;
@@ -1348,8 +1357,8 @@ main(int argc, char **argv)
 
       nStatus = Download(&rtmp, file, dSeek, dStopOffset, duration, bResume,
                         metaHeader, nMetaHeaderSize, initialFrame,
-                        initialFrameType, nInitialFrameSize,
-                        nSkipKeyFrames, bStdoutMode, bLiveStream, bHashes,
+                        initialFrameType, nInitialFrameSize, nSkipKeyFrames,
+                        bStdoutMode, bLiveStream, bRealtimeStream, bHashes,
                         bOverrideBufferTime, bufferTime, &percent);
       free(initialFrame);
       initialFrame = NULL;