[PATCH] Setting tcUrl field for RTMP stream
#1
ABC's iView in Australia does streaming of TV programs via RTMP. It's probably very similar to BBC's iPlayer.

To make it work with XBMC, the request to the server requires that the tcUrl value is set correctly. XBMC currently sets the tcUrl based on the path of the stream.. but in this case, the tcUrl needs to be totally different.

Code:
--- XBMC.orig/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp       2009-08-22 17:36:21.371603434 +1000
+++ XBMC/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp    2009-08-22 17:39:00.755103914 +1000
@@ -94,6 +94,7 @@
   m_rtmp->SetPlayer(m_item.GetProperty("SWFPlayer"));
   m_rtmp->SetPageUrl(m_item.GetProperty("PageURL"));
   m_rtmp->SetPlayPath(m_item.GetProperty("PlayPath"));
+  m_rtmp->SetTcUrl(m_item.GetProperty("TcUrl"));
   if (!m_item.GetProperty("IsLive").compare("true"))
     m_rtmp->SetLive();
   m_rtmp->SetBufferMS(20000);
--- XBMC.orig/xbmc/lib/libRTMP/rtmp.cpp 2009-08-22 20:42:59.683101392 +1000
+++ XBMC/xbmc/lib/libRTMP/rtmp.cpp      2009-08-22 20:42:47.363102077 +1000
@@ -80,6 +80,11 @@
   m_strPlayPath = strPlayPath;
}

+void CRTMP::SetTcUrl(const std::string &strTcUrl)
+{
+  m_strTcUrl = strTcUrl;
+}
+
void CRTMP::SetLive()
{
     m_bIsLive = true;
@@ -328,9 +333,18 @@
     if( pos_slash != CStdString::npos )
       app = app.Left(pos_slash);
   }
+  
   CStdString tcURL;
-  url.GetURLWithoutFilename(tcURL);
-  tcURL += app;
+  if (m_strTcUrl.empty())
+  {
+    url.GetURLWithoutFilename(tcURL);
+    tcURL += app;
+  }
+  else
+  {
+    tcURL = m_strTcUrl;
+  }
+  
        
   RTMPPacket packet;
   packet.m_nChannel = 0x03;   // control channel (invoke)
--- XBMC.orig/xbmc/lib/libRTMP/rtmp.h   2009-08-22 17:35:26.455102603 +1000
+++ XBMC/xbmc/lib/libRTMP/rtmp.h        2009-08-22 17:42:32.347101700 +1000
@@ -37,6 +37,7 @@
       void SetPlayer(const std::string &strPlayer);
       void SetPageUrl(const std::string &strPageUrl);
       void SetPlayPath(const std::string &strPlayPath);
+      void SetTcUrl(const std::string &strTcUrl);
       void SetLive();
       void SetBufferMS(int size);
       bool Seek(double dTime);
@@ -113,6 +114,7 @@
       std::string m_strPageUrl;
       std::string m_strLink;
       std::string m_strPlayPath;
+      std::string m_strTcUrl;
       bool m_bIsLive;

       std::vector<std::string> m_methodCalls; //remote method calls queue

The attached patch allows you to use SetProperty('tcUrl', myTcUrl) to set the tcUrl. If it's not set, then it will set the tcUrl as XBMC normally would.

I've done some basic testing for me, but it really could do with some testing with some other RTMP streams.

I'll post a ticket on trac for this now. I'd really like to see this get into the next version.

UPDATE: Link to the ticket in Trac: http://trac.xbmc.org/ticket/7083
Reply

Logout Mark Read Team Forum Stats Members Help
[PATCH] Setting tcUrl field for RTMP stream0