Ticket #3344: patchfile

File patchfile, 3.8 KB (added by robsbox@…, 17 years ago)

patch to correct fast forwarding for uPnP players

Line 
1Index: libs/libmythupnp/httprequest.cpp
2===================================================================
3--- libs/libmythupnp/httprequest.cpp    (revision 13462)
4+++ libs/libmythupnp/httprequest.cpp    (working copy)
5@@ -307,39 +307,28 @@
6 
7         m_nResponseStatus = 200;
8 
9-        // ------------------------------------------------------------------
10-        // The Content-Range header is apparently a problem for the
11-        // AVeL LinkPlayer2 and probably other hardware players with
12-        // Syabas firmware.
13-        //
14-        // -=>TODO: Need conformation
15-        // ------------------------------------------------------------------
16+        // --------------------------------------------------------------
17+        // Process any Range Header
18+        // --------------------------------------------------------------
19 
20         bool    bRange     = false;
21         QString sUserAgent = GetHeaderValue( "User-Agent", "");
22+        QString sRange = GetHeaderValue( "range", "" );
23 
24-        if ( sUserAgent.contains( "Syabas", false ) == 0 )
25+        if (sRange.length() > 0)
26         {
27-            // --------------------------------------------------------------
28-            // Process any Range Header
29-            // --------------------------------------------------------------
30-
31-            QString sRange = GetHeaderValue( "range", "" );
32-
33-            if (sRange.length() > 0)
34+            if ( bRange = ParseRange( sRange, &llStart, &llEnd ) )
35             {
36-                if ( bRange = ParseRange( sRange, llSize, &llStart, &llEnd ) )
37-                {
38-                    m_nResponseStatus = 206;
39-                    m_mapRespHeaders[ "Content-Range" ] = QString("bytes %1-%2/%3")
40-                                                                  .arg( llStart )
41-                                                                  .arg( llEnd   )
42-                                                                  .arg( llSize  );
43-                    llSize = (llEnd - llStart) + 1;
44-                }
45+                m_nResponseStatus = 206;
46+                llSize = (llEnd - llStart) + 1;
47             }
48         }
49-       
50+
51+        m_mapRespHeaders[ "Content-Range" ] = QString("bytes %1-%2/%3")
52+                                                      .arg( llStart )
53+                                                      .arg( llEnd   )
54+                                                      .arg( llSize  );
55+     
56         // DSM-?20 specific response headers
57 
58         if (bRange == false)
59@@ -897,7 +886,6 @@
60 /////////////////////////////////////////////////////////////////////////////
61 
62 bool HTTPRequest::ParseRange( QString sRange,
63-                              long long   llSize,
64                               long long *pllStart,
65                               long long *pllEnd   )
66 {
67@@ -951,10 +939,7 @@
68         // Does it match "-####"
69         // ------------------------------------------------------------------
70 
71-        long long llValue = strtoll( parts[1], NULL, 10 );
72-
73-        *pllStart = llSize - llValue;
74-        *pllEnd   = llSize - 1;
75+        *pllEnd   = strtoll( parts[1], NULL, 10 );
76     }
77     else if (parts[1].isNull())
78     {
79@@ -966,8 +951,6 @@
80 
81         if (*pllStart == 0)
82             return false;
83-
84-        *pllEnd   = llSize - 1;
85     }
86     else
87     {
88Index: libs/libmythupnp/httprequest.h
89===================================================================
90--- libs/libmythupnp/httprequest.h      (revision 13462)
91+++ libs/libmythupnp/httprequest.h      (working copy)
92@@ -147,7 +147,6 @@
93         QString         GetAdditionalHeaders( void );
94 
95         bool            ParseRange          ( QString sRange,
96-                                              long long   llSize,
97                                               long long *pllStart,
98                                               long long *pllEnd   );
99