kodi: add PR6361

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2015-02-09 07:09:03 +01:00
parent 8c55e6351f
commit 41c33fe574

View File

@ -0,0 +1,80 @@
From 06010806542ef186fe11d7e0c56cc99c6d9e4cd5 Mon Sep 17 00:00:00 2001
From: wsnipex <wsnipex@a1.net>
Date: Fri, 6 Feb 2015 11:09:58 +0100
Subject: [PATCH] [rtmp] re-add rtmp options
partially reverts 0339c8cdf564d056fc307c04d12370ccdc75499b
fixes (#15756)
---
.../DVDInputStreams/DVDInputStreamRTMP.cpp | 31 ++++++++++++++++++++++
.../dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h | 1 +
2 files changed, 32 insertions(+)
diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp
index 324eadb..5d45448 100644
--- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp
+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp
@@ -122,6 +122,19 @@ bool CDVDInputStreamRTMP::IsEOF()
#undef AVC
#define AVC(str) {(char *)str,sizeof(str)-1}
+/* librtmp option names are slightly different */
+static const struct {
+ const char *name;
+ AVal key;
+} options[] = {
+ { "SWFPlayer", AVC("swfUrl") },
+ { "PageURL", AVC("pageUrl") },
+ { "PlayPath", AVC("playpath") },
+ { "TcUrl", AVC("tcUrl") },
+ { "IsLive", AVC("live") },
+ { NULL }
+};
+
bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content)
{
if (m_sStreamPlaying)
@@ -160,6 +173,23 @@ bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content)
}
CLog::Log(LOGDEBUG, "RTMP canseek: %s", m_canSeek ? "true" : "false");
+ /* SetOpt and SetAVal copy pointers to the value. librtmp doesn't use the values until the Connect() call,
+ * so value objects must stay allocated until then. To be extra safe, keep the values around until Close(),
+ * in case librtmp needs them again.
+ */
+ m_optionvalues.clear();
+ for (int i=0; options[i].name; i++)
+ {
+ std::string tmp = m_item.GetProperty(options[i].name).asString();
+ if (!tmp.empty())
+ {
+ m_optionvalues.push_back(tmp);
+ AVal av_tmp;
+ SetAVal(av_tmp, m_optionvalues.back());
+ m_libRTMP.SetOpt(m_rtmp, &options[i].key, &av_tmp);
+ }
+ }
+
if (!m_libRTMP.Connect(m_rtmp, NULL) || !m_libRTMP.ConnectStream(m_rtmp, 0))
return false;
@@ -177,6 +207,7 @@ void CDVDInputStreamRTMP::Close()
if (m_rtmp)
m_libRTMP.Close(m_rtmp);
+ m_optionvalues.clear();
m_eof = true;
m_bPaused = false;
}
diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h
index 5568c14..dd00e5a 100644
--- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h
+++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h
@@ -51,6 +51,7 @@ class CDVDInputStreamRTMP
bool m_canSeek;
bool m_canPause;
char* m_sStreamPlaying;
+ std::vector<std::string> m_optionvalues;
RTMP *m_rtmp;
DllLibRTMP m_libRTMP;