summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Plexservice.cpp3
-rw-r--r--cPlexOsdItem.cpp9
-rw-r--r--cPlexOsdItem.h9
-rw-r--r--hlsPlayerControl.cpp101
-rw-r--r--hlsPlayerControl.h15
5 files changed, 133 insertions, 4 deletions
diff --git a/Plexservice.cpp b/Plexservice.cpp
index d208882..2c0bdb7 100644
--- a/Plexservice.cpp
+++ b/Plexservice.cpp
@@ -211,8 +211,9 @@ std::string Plexservice::GetUniversalTranscodeUrl(Video* video, int offset, Plex
params << "&directPlay=0";
params << "&directStream=1";
params << "&maxVideoBitrate=20000";
+ //params << "&subtitles=burn";
//params << "&subtitleSize=90";
- params << "&skipSubtitles=1";
+ //params << "&skipSubtitles=1";
//params << "&audioBoost=100";
params << "&videoResolution=1920x1080";
params << "&videoQuality=100";
diff --git a/cPlexOsdItem.cpp b/cPlexOsdItem.cpp
index 2d006c3..b2e00a8 100644
--- a/cPlexOsdItem.cpp
+++ b/cPlexOsdItem.cpp
@@ -23,6 +23,15 @@ cPlexOsdItem::cPlexOsdItem(const char* title, plexclient::Directory* obj) :cOsdI
m_bVideo = false;
}
+cPlexOsdItem::cPlexOsdItem(const char* title, plexclient::Stream* obj) :cOsdItem(title) {
+ stream = *obj;
+ dir = NULL;
+ item = NULL;
+ pservice = NULL;
+ m_bVideo = false;
+ m_bDir = false;
+}
+
plexclient::Video* cPlexOsdItem::GetAttachedVideo() {
return item;
}
diff --git a/cPlexOsdItem.h b/cPlexOsdItem.h
index e484d9a..2e34581 100644
--- a/cPlexOsdItem.h
+++ b/cPlexOsdItem.h
@@ -8,6 +8,7 @@
#include <vdr/plugin.h>
#include "PVideo.h"
+#include "Stream.h"
#include "Directory.h"
#include "Plexservice.h"
@@ -16,6 +17,7 @@ class cPlexOsdItem : public cOsdItem
private:
plexclient::Video* item;
plexclient::Directory* dir;
+ plexclient::Stream stream;
std::shared_ptr<plexclient::Plexservice> pservice;
bool m_bVideo;
bool m_bDir;
@@ -25,8 +27,15 @@ public:
cPlexOsdItem(const char* title, std::shared_ptr<plexclient::Plexservice> service);
cPlexOsdItem(const char* title, plexclient::Video* obj);
cPlexOsdItem(const char* title, plexclient::Directory* obj);
+/**
+ * @brief
+ * @param title Title
+ * @param obj will be copied
+ */
+ cPlexOsdItem(const char* title, plexclient::Stream* obj);
plexclient::Video* GetAttachedVideo();
plexclient::Directory* GetAttachedDirectory();
+ plexclient::Stream& GetAttachedStream() { return stream; }
std::shared_ptr<plexclient::Plexservice> GetAttachedService();
bool IsVideo() const {
diff --git a/hlsPlayerControl.cpp b/hlsPlayerControl.cpp
index 73e2d6f..40b9e16 100644
--- a/hlsPlayerControl.cpp
+++ b/hlsPlayerControl.cpp
@@ -3,11 +3,14 @@
#include <vdr/status.h>
#include <vdr/remote.h>
+#include <Poco/Format.h>
+
#include "plex.h"
#include "PlexServer.h"
#include "Plexservice.h"
#include "MediaContainer.h"
#include "PVideo.h"
+#include "cPlexOsdItem.h"
// static
cControl* cHlsPlayerControl::Create(plexclient::Video Video)
@@ -41,6 +44,7 @@ cHlsPlayerControl::cHlsPlayerControl(cHlsPlayer* Player, plexclient::Video Video
lastPlay = lastForward = false;
lastSpeed = -2; // an invalid value
timeoutShow = 0;
+ menu = NULL;
cStatus::MsgReplaying(this, m_title.c_str(), m_Video.m_Media.m_sPartFile.c_str(), true);
}
@@ -51,6 +55,7 @@ cHlsPlayerControl::~cHlsPlayerControl()
cStatus::MsgReplaying(this, NULL, NULL, false);
Hide();
delete player;
+ delete menu;
player = NULL;
}
@@ -102,6 +107,23 @@ eOSState cHlsPlayerControl::ProcessKey(eKeys Key)
else
shown = ShowProgress(!shown) || shown;
}
+
+ // Handle menus
+ if (menu) {
+ eOSState state = menu->ProcessKey(Key);
+ if (state == osEnd) {
+ JumpRelative(0);
+ delete menu;
+ menu = NULL;
+ }
+ if (state == osBack) {
+ Hide();
+ delete menu;
+ menu = NULL;
+ }
+ return osContinue;
+ }
+
bool DoShowMode = true;
switch (int(Key)) {
// Positioning:
@@ -144,7 +166,7 @@ eOSState cHlsPlayerControl::ProcessKey(eKeys Key)
break;
case kBack:
Hide();
- //menu = new cTitleMenu(this);
+ menu = new cStreamSelectMenu(&m_Video);
break;
default:
return osUnknown;
@@ -228,7 +250,7 @@ bool cHlsPlayerControl::ShowProgress(bool Initial)
if (GetIndex(Current, Total)) {
if (!visible) {
displayReplay = Skins.Current()->DisplayReplay(modeOnly);
- displayReplay->SetButtons(NULL,"-10m","+10m",tr("Stop"));
+ displayReplay->SetButtons(NULL,"-5m","+4m",tr("Stop"));
SetNeedsFastResponse(true);
visible = true;
}
@@ -273,3 +295,78 @@ void cHlsPlayerControl::ShowTimed(int Seconds)
} else if (timeoutShow && Seconds > 0)
timeoutShow = time(NULL) + Seconds;
}
+
+cStreamSelectMenu::cStreamSelectMenu(plexclient::Video* Video) : cOsdMenu("StreamSelect")
+{
+ pVideo = Video;
+ CreateMenu();
+}
+
+void cStreamSelectMenu::CreateMenu()
+{
+ SetTitle(cString::sprintf(tr("%s - Select Audio / Subtitle"), pVideo->GetTitle().c_str()));
+ pVideo->UpdateFromServer();
+
+ if(pVideo->m_Media.m_vStreams.size() > 0) {
+ std::vector<plexclient::Stream> streams = pVideo->m_Media.m_vStreams;
+
+ Add(new cOsdItem(tr("Audiostreams"), osUnknown, false));
+ for(std::vector<plexclient::Stream>::iterator it = streams.begin(); it != streams.end(); ++it) {
+ plexclient::Stream *pStream = &(*it);
+ if(pStream->m_eStreamType == plexclient::sAUDIO) {
+ // Audio
+ cString item = cString::sprintf(tr("%s%s - %s %d Channels"), pStream->m_bSelected ? "[*] ":"", pStream->m_sLanguage.c_str(), pStream->m_sCodecId.c_str(), pStream->m_iChannels);
+ Add(new cPlexOsdItem(item, pStream));
+ }
+ }
+
+ Add(new cOsdItem(tr("Subtitlestreams"), osUnknown, false));
+ plexclient::Stream stre;
+ stre.m_eStreamType = plexclient::sSUBTITLE;
+ stre.m_iID = -1;
+ Add(new cPlexOsdItem(tr("None"), &stre));
+ for(std::vector<plexclient::Stream>::iterator it = streams.begin(); it != streams.end(); ++it) {
+ plexclient::Stream *pStream = &(*it);
+ if(pStream->m_eStreamType == plexclient::sSUBTITLE) {
+ // Subtitle
+ cString item = cString::sprintf("%s%s", pStream->m_bSelected ? "[*] ":"", pStream->m_sLanguage.c_str());
+ Add(new cPlexOsdItem(item, pStream));
+ }
+ }
+ }
+
+ Display();
+}
+
+bool cStreamSelectMenu::SelectStream()
+{
+ int current = Current(); // get current menu item index
+ cPlexOsdItem *item = static_cast<cPlexOsdItem*>(Get(current));
+ return pVideo->SetStream(&item->GetAttachedStream());
+}
+
+eOSState cStreamSelectMenu::ProcessKey(eKeys Keys)
+{
+ eOSState state;
+
+ // call standard function
+ state = cOsdMenu::ProcessKey(Keys);
+
+ switch (state) {
+ case osUnknown:
+ switch (Keys) {
+ case kOk:
+ return SelectStream() ? osEnd : osBack;
+ case kBack:
+ return osBack;
+ default:
+ break;
+ }
+ break;
+ case osBack:
+ return osBack;
+ default:
+ break;
+ }
+ return state;
+}
diff --git a/hlsPlayerControl.h b/hlsPlayerControl.h
index c64139a..fb2ba3f 100644
--- a/hlsPlayerControl.h
+++ b/hlsPlayerControl.h
@@ -8,13 +8,26 @@
#include "MediaContainer.h"
#include "PVideo.h"
+class cStreamSelectMenu : public cOsdMenu
+{
+private:
+ plexclient::Video* pVideo;
+ void CreateMenu();
+ bool SelectStream();
+
+public:
+ cStreamSelectMenu(plexclient::Video* Video);
+ virtual eOSState ProcessKey(eKeys Keys);
+};
+
class cHlsPlayerControl : public cControl
{
private:
static volatile int active;
cHlsPlayer* player;
std::string m_title;
-
+
+ cStreamSelectMenu* menu;
cSkinDisplayReplay *displayReplay;
bool visible, modeOnly, shown;
int lastCurrent, lastTotal;