summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Media.cpp2
-rw-r--r--Media.h2
-rw-r--r--MediaContainer.cpp4
-rw-r--r--MediaContainer.h5
-rw-r--r--PVideo.cpp4
-rw-r--r--PVideo.h7
-rw-r--r--PlexServer.cpp9
-rw-r--r--PlexServer.h1
-rw-r--r--Plexservice.cpp8
-rw-r--r--XmlObject.cpp21
-rw-r--r--XmlObject.h18
-rw-r--r--hlsPlayer.cpp35
-rw-r--r--hlsPlayer.h7
-rw-r--r--hlsPlayerControl.cpp164
-rw-r--r--hlsPlayerControl.h19
-rw-r--r--play_service.h31
-rw-r--r--plex.cpp11
-rw-r--r--plex.h1
-rw-r--r--plexgdm.cpp5
19 files changed, 261 insertions, 93 deletions
diff --git a/Media.cpp b/Media.cpp
index d3c53a2..4837bc7 100644
--- a/Media.cpp
+++ b/Media.cpp
@@ -23,7 +23,7 @@ Media::Media(Poco::XML::Node* pNode)
m_sAudioCodec = GetNodeValue(pAttribs->getNamedItem("audioCodec"));
m_sVideoCodec = GetNodeValue(pAttribs->getNamedItem("videoCodec"));
m_sContainer = GetNodeValue(pAttribs->getNamedItem("container"));
- m_sVideoFrameRate = GetNodeValue(pAttribs->getNamedItem("videoFrameRate"));
+ m_VideoFrameRate = GetNodeValueAsDouble(pAttribs->getNamedItem("videoFrameRate"));
pAttribs->release();
diff --git a/Media.h b/Media.h
index f2394cd..5441bde 100644
--- a/Media.h
+++ b/Media.h
@@ -46,7 +46,7 @@ public:
std::string m_sAudioCodec;
std::string m_sVideoCodec;
std::string m_sContainer;
- std::string m_sVideoFrameRate;
+ double m_VideoFrameRate;
std::string m_sPartKey;
int m_iPartId;
diff --git a/MediaContainer.cpp b/MediaContainer.cpp
index 08b386f..b49dfd7 100644
--- a/MediaContainer.cpp
+++ b/MediaContainer.cpp
@@ -2,7 +2,7 @@
namespace plexclient
{
-MediaContainer::MediaContainer(std::istream* response)
+MediaContainer::MediaContainer(std::istream* response, PlexServer* Server)
{
try {
InputSource src(*response);
@@ -32,7 +32,7 @@ MediaContainer::MediaContainer(std::istream* response)
} else if(Poco::icompare(pNode->nodeName(), "Directory") == 0) {
m_vDirectories.push_back(Directory(pNode));
} else if(Poco::icompare(pNode->nodeName(), "Video") == 0) {
- m_vVideos.push_back(Video(pNode));
+ m_vVideos.push_back(Video(pNode, Server));
}
pNode = it.nextNode();
diff --git a/MediaContainer.h b/MediaContainer.h
index 2633086..5d5c722 100644
--- a/MediaContainer.h
+++ b/MediaContainer.h
@@ -17,6 +17,7 @@
#include "XmlObject.h"
#include "Directory.h"
#include "PVideo.h"
+#include "PlexServer.h"
using Poco::XML::DOMParser;
using Poco::XML::InputSource;
@@ -29,11 +30,11 @@ using Poco::Exception;
namespace plexclient
{
-
+
class MediaContainer: XmlObject
{
public:
- MediaContainer(std::istream *response);
+ MediaContainer(std::istream *response, PlexServer* Server);
~MediaContainer();
diff --git a/PVideo.cpp b/PVideo.cpp
index 21a7de6..770c15b 100644
--- a/PVideo.cpp
+++ b/PVideo.cpp
@@ -3,9 +3,9 @@
namespace plexclient
{
-Video::Video(Poco::XML::Node* pNode)
+Video::Video(Poco::XML::Node* pNode, PlexServer* Server)
{
-
+ m_pServer = Server;
NodeIterator it(pNode, Poco::XML::NodeFilter::SHOW_ALL);
Poco::XML::Node* pChildNode = it.nextNode();
diff --git a/PVideo.h b/PVideo.h
index 3d69bc4..0d5829a 100644
--- a/PVideo.h
+++ b/PVideo.h
@@ -17,6 +17,7 @@
#include "XmlObject.h"
#include "Media.h"
+#include "PlexServer.h"
using Poco::XML::DOMParser;
using Poco::XML::Document;
@@ -28,11 +29,11 @@ using Poco::Exception;
namespace plexclient
{
-
+
class Video: XmlObject
{
public:
- Video(Poco::XML::Node* pNode);
+ Video(Poco::XML::Node* pNode, PlexServer* Server);
~Video();
public:
@@ -60,7 +61,7 @@ public:
std::vector<std::string> m_vRole;
std::string m_sCollection;
Media *m_pMedia;
-
+ PlexServer* m_pServer;
};
}
diff --git a/PlexServer.cpp b/PlexServer.cpp
index 4eb1245..5675009 100644
--- a/PlexServer.cpp
+++ b/PlexServer.cpp
@@ -31,7 +31,14 @@ PlexServer::PlexServer(std::string data, std::string ip)
}
}
-std::string PlexServer::GetUri() {
+PlexServer::PlexServer(std::string ip, int port)
+{
+ m_sIpAddress = ip;
+ m_nPort = port;
+}
+
+std::string PlexServer::GetUri()
+{
return std::string("http://") + m_sIpAddress + ":" + std::string(itoa(m_nPort));
}
diff --git a/PlexServer.h b/PlexServer.h
index 3de2ae2..19130d7 100644
--- a/PlexServer.h
+++ b/PlexServer.h
@@ -20,6 +20,7 @@ class PlexServer
{
public:
PlexServer(std::string data, std::string ip);
+ PlexServer(std::string ip, int port);
~PlexServer();
int GetMaster() const {
diff --git a/Plexservice.cpp b/Plexservice.cpp
index cf926c3..710cef0 100644
--- a/Plexservice.cpp
+++ b/Plexservice.cpp
@@ -146,7 +146,7 @@ MediaContainer* Plexservice::GetSection(std::string section)
dsyslog("[plex] URI: %s[s%]", m_pPlexSession->getHost().c_str(), pRequest->getURI().c_str());
- MediaContainer* pAllsections = new MediaContainer(&rs);
+ MediaContainer* pAllsections = new MediaContainer(&rs, this->pServer);
//Poco::StreamCopier::copyStream(rs, std::cout);
delete pRequest;
return pAllsections;
@@ -205,12 +205,12 @@ MediaContainer* Plexservice::GetMediaContainer(std::string fullUrl)
Poco::Net::HTTPResponse response;
std::istream &rs = session->receiveResponse(response);
- std::cout << "URI: " << session->getHost() << "[" << pRequest->getURI() << "]" << std::endl;
+ //std::cout << "URI: " << session->getHost() << "[" << pRequest->getURI() << "]" << std::endl;
delete pRequest;
delete session;
-
- MediaContainer* pAllsections = new MediaContainer(&rs);
+
+ MediaContainer* pAllsections = new MediaContainer(&rs, new PlexServer(fileuri.getHost(), fileuri.getPort()));
//Poco::StreamCopier::copyStream(rs, std::cout);
return pAllsections;
}
diff --git a/XmlObject.cpp b/XmlObject.cpp
index 923d2d1..a9c0bb4 100644
--- a/XmlObject.cpp
+++ b/XmlObject.cpp
@@ -1,16 +1,8 @@
#include "XmlObject.h"
+#include <vdr/tools.h>
namespace plexclient
{
-
-XmlObject::XmlObject()
-{
-}
-
-XmlObject::~XmlObject()
-{
-}
-
std::string XmlObject::GetNodeValue(Poco::XML::Node* pNode)
{
std::string value;
@@ -42,6 +34,17 @@ long XmlObject::GetNodeValueAsLong(Poco::XML::Node* pNode)
return value;
}
+double XmlObject::GetNodeValueAsDouble(Poco::XML::Node* pNode)
+{
+ double value = 0;
+ if(pNode != 0) {
+ try {
+ value = atod(pNode->getNodeValue().c_str());
+ } catch(Poco::Exception) {}
+ }
+ return value;
+}
+
bool XmlObject::GetNodeValueAsBool(Poco::XML::Node* pNode)
{
bool value = false;
diff --git a/XmlObject.h b/XmlObject.h
index d8af778..db9969a 100644
--- a/XmlObject.h
+++ b/XmlObject.h
@@ -16,19 +16,17 @@ enum MediaType {UNDEF = 0, PHOTO, MOVIE, MUSIC, SHOW, SEASON};
class XmlObject
{
public:
- XmlObject();
- ~XmlObject();
-
+
protected:
- std::string GetNodeValue(Poco::XML::Node* pNode);
- int GetNodeValueAsInt(Poco::XML::Node* pNode);
- long GetNodeValueAsLong(Poco::XML::Node* pNode);
- bool GetNodeValueAsBool(Poco::XML::Node* pNode);
- Poco::Timestamp GetNodeValueAsTimeStamp(Poco::XML::Node* pNode);
- MediaType GetNodeValueAsMediaType(Poco::XML::Node* pNode);
+ static std::string GetNodeValue(Poco::XML::Node* pNode);
+ static int GetNodeValueAsInt(Poco::XML::Node* pNode);
+ static long GetNodeValueAsLong(Poco::XML::Node* pNode);
+ static double GetNodeValueAsDouble(Poco::XML::Node* pNode);
+ static bool GetNodeValueAsBool(Poco::XML::Node* pNode);
+ static Poco::Timestamp GetNodeValueAsTimeStamp(Poco::XML::Node* pNode);
+ static MediaType GetNodeValueAsMediaType(Poco::XML::Node* pNode);
private:
-
};
}
diff --git a/hlsPlayer.cpp b/hlsPlayer.cpp
index 326f071..812d93c 100644
--- a/hlsPlayer.cpp
+++ b/hlsPlayer.cpp
@@ -12,6 +12,7 @@ cHlsSegmentLoader::cHlsSegmentLoader(std::string startm3u8)
{
m_bufferFilled = false;
m_lastLoadedSegment = 0;
+ m_loadedSegments = 0;
m_segmentsToBuffer = 3;
m_pBuffer = new uchar[8192];
@@ -55,7 +56,7 @@ void cHlsSegmentLoader::Action(void)
isyslog("[plex]%s Create Ringbuffer %d MB", __FUNCTION__, estSize*3);
m_pRingbuffer = new cRingBufferLinear(m_ringBufferSize, 2*TS_SIZE);
-
+
while(Running()) {
DoLoad();
cCondWait::SleepMs(3);
@@ -95,6 +96,12 @@ bool cHlsSegmentLoader::LoadIndexList(void)
std::string path = indexUri.getPath();
m_segmentUriPart = path.substr(0, path.find_last_of("/")+1);
}
+ if(m_indexParser.TargetDuration > 3) {
+ m_segmentsToBuffer = 1;
+ }
+ else {
+ m_segmentsToBuffer = 2;
+ }
}
return res;
}
@@ -136,7 +143,7 @@ int cHlsSegmentLoader::EstimateSegmentSize()
int len = m_indexParser.TargetDuration;
double estSize = (bandw) * len;
- estSize = max(estSize, 16.0); // default
+ estSize = max(estSize, 1.0); // default
return ceil(estSize);
}
@@ -177,7 +184,7 @@ bool cHlsSegmentLoader::LoadSegment(std::string segmentUri)
int cHlsSegmentLoader::GetSegmentSize(int segmentIndex)
{
- dsyslog("[plex]%s Segment %d", __FUNCTION__, segmentIndex);
+ //dsyslog("[plex]%s Segment %d", __FUNCTION__, segmentIndex);
if(m_indexParser.vPlaylistItems[segmentIndex].size > 0) {
return m_indexParser.vPlaylistItems[segmentIndex].size;
}
@@ -221,12 +228,15 @@ bool cHlsSegmentLoader::DoLoad(void)
while(m_pRingbuffer->Free() > nextSegmentSize) {
if(m_lastLoadedSegment + 1 < m_indexParser.vPlaylistItems.size()) {
- std::string segmentUri = GetSegmentUri(m_lastLoadedSegment + 1);
+ std::string segmentUri = GetSegmentUri(++m_lastLoadedSegment);
result = LoadSegment(segmentUri);
- m_lastLoadedSegment++;
+ m_loadedSegments++;
} else {
// out of segments
+ StopLoader();
+ result = false;
}
+ m_bufferFilled = m_lastLoadedSegment >= m_segmentsToBuffer;
nextSegmentSize = GetSegmentSize(m_lastLoadedSegment + 1);
}
return m_bufferFilled = result;
@@ -266,9 +276,10 @@ bool cHlsSegmentLoader::Active(void)
//--- cHlsPlayer
-cHlsPlayer::cHlsPlayer(std::string startm3u8)
+cHlsPlayer::cHlsPlayer(std::string startm3u8, plexclient::Video* Video)
{
m_pSegmentLoader = new cHlsSegmentLoader(startm3u8);
+ m_pVideo = Video;
}
cHlsPlayer::~cHlsPlayer()
@@ -327,15 +338,14 @@ void cHlsPlayer::Activate(bool On)
bool cHlsPlayer::GetIndex(int& Current, int& Total, bool SnapToIFrame)
{
- Total = 9999;
- Current = -1;
+ long stc = DeviceGetSTC();
+ Total = m_pVideo->m_pMedia->m_lDuration / 1000 * FramesPerSecond(); // milliseconds
+ Current = stc / (100 * 1000) * FramesPerSecond(); // 100ns per Tick
return true;
-
}
bool cHlsPlayer::GetReplayMode(bool& Play, bool& Forward, int& Speed)
{
- dsyslog("[plex]%s", __FUNCTION__);
Play = (playMode == pmPlay);
Forward = true;
Speed = -1;
@@ -377,3 +387,8 @@ void cHlsPlayer::Stop(void)
m_pSegmentLoader->StopLoader();
Cancel(1);
}
+
+double cHlsPlayer::FramesPerSecond(void)
+{
+ return m_pVideo->m_pMedia->m_VideoFrameRate ? m_pVideo->m_pMedia->m_VideoFrameRate : DEFAULTFRAMESPERSECOND;
+}
diff --git a/hlsPlayer.h b/hlsPlayer.h
index 4ba017e..20b58e5 100644
--- a/hlsPlayer.h
+++ b/hlsPlayer.h
@@ -16,6 +16,8 @@
#include "m3u8Parser.h"
#include "Config.h"
+#include "PVideo.h"
+#include "Media.h"
class cHlsSegmentLoader : public cThread
{
@@ -23,6 +25,7 @@ private:
int m_ringBufferSize;
int m_segmentsToBuffer;
unsigned int m_lastLoadedSegment;
+ unsigned int m_loadedSegments;
bool m_bufferFilled;
uchar* m_pBuffer;
@@ -64,6 +67,7 @@ class cHlsPlayer : public cPlayer, cThread
{
private:
cHlsSegmentLoader* m_pSegmentLoader;
+ plexclient::Video* m_pVideo;
int m_videoLenght;
int m_actualSegment;
@@ -81,11 +85,12 @@ protected:
public:
- cHlsPlayer(std::string startm3u8);
+ cHlsPlayer(std::string startm3u8, plexclient::Video* Video);
~cHlsPlayer();
virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false);
virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
+ virtual double FramesPerSecond(void);
void Pause(void);
void Play(void);
void Stop(void);
diff --git a/hlsPlayerControl.cpp b/hlsPlayerControl.cpp
index 97be2d7..6e4a250 100644
--- a/hlsPlayerControl.cpp
+++ b/hlsPlayerControl.cpp
@@ -1,9 +1,39 @@
#include "hlsPlayerControl.h"
-cHlsPlayerControl::cHlsPlayerControl(cHlsPlayer* Player, std::string title) :cControl(Player)
+#include <vdr/status.h>
+
+#include "PlexServer.h"
+#include "Plexservice.h"
+
+// static
+cControl* cHlsPlayerControl::Create(plexclient::Video* Video)
+{
+ if(!Video->m_pServer)
+ return NULL;
+
+ plexclient::Plexservice service(Video->m_pServer);
+ service.Authenticate();
+ std::string transcodeUri = service.GetUniversalTranscodeUrl(Video);
+
+ cHlsPlayerControl* playerControl = new cHlsPlayerControl(new cHlsPlayer(transcodeUri, Video), Video);
+ playerControl->m_title = Video->m_sTitle;
+ return playerControl;
+}
+
+cHlsPlayerControl::cHlsPlayerControl(cHlsPlayer* Player, plexclient::Video* Video) :cControl(Player)
{
player = Player;
- m_title = title;
+ m_pVideo = Video;
+ //m_title = title;
+
+ displayReplay = NULL;
+ visible = modeOnly = shown = false;
+ lastCurrent = lastTotal = -1;
+ lastPlay = lastForward = false;
+ lastSpeed = -2; // an invalid value
+ timeoutShow = 0;
+
+ cStatus::MsgReplaying(this, m_title.c_str(), NULL, true);
}
cHlsPlayerControl::~cHlsPlayerControl()
@@ -17,10 +47,22 @@ cString cHlsPlayerControl::GetHeader(void)
void cHlsPlayerControl::Hide(void)
{
+ if (visible) {
+ delete displayReplay;
+ displayReplay = NULL;
+ SetNeedsFastResponse(false);
+ visible = false;
+ modeOnly = false;
+ lastPlay = lastForward = false;
+ lastSpeed = -2; // an invalid value
+ //timeSearchActive = false;
+ timeoutShow = 0;
+ }
}
void cHlsPlayerControl::Show(void)
{
+ ShowTimed();
}
eOSState cHlsPlayerControl::ProcessKey(eKeys Key)
@@ -36,6 +78,17 @@ eOSState cHlsPlayerControl::ProcessKey(eKeys Key)
else
Key = Play ? kPause : kPlay;
}
+ if (visible) {
+ if (timeoutShow && time(NULL) > timeoutShow) {
+ Hide();
+ ShowMode();
+ timeoutShow = 0;
+ } else if (modeOnly)
+ ShowMode();
+ else
+ shown = ShowProgress(!shown) || shown;
+ }
+ bool DoShowMode = true;
switch (int(Key)) {
// Positioning:
case kPlay:
@@ -76,7 +129,32 @@ eOSState cHlsPlayerControl::ProcessKey(eKeys Key)
Hide();
Stop();
return osEnd;
+ default: {
+ DoShowMode = false;
+ switch (int(Key)) {
+ default: {
+ switch (Key) {
+ case kOk:
+ if (visible && !modeOnly) {
+ Hide();
+ DoShowMode = true;
+ } else
+ Show();
+ break;
+ case kBack:
+ Hide();
+ //menu = new cTitleMenu(this);
+ break;
+ default:
+ return osUnknown;
+ }
+ }
+ }
+ }
+ if (DoShowMode)
+ ShowMode();
}
+
return osContinue;
}
@@ -102,3 +180,85 @@ void cHlsPlayerControl::Stop(void)
if(player)
player->Stop();
}
+
+void cHlsPlayerControl::ShowMode(void)
+{
+ //dsyslog("[plex]: '%s'\n", __FUNCTION__);
+ if (visible || Setup.ShowReplayMode && !cOsd::IsOpen()) {
+ bool Play, Forward;
+ int Speed;
+ if (GetReplayMode(Play, Forward, Speed) && (!visible || Play != lastPlay || Forward != lastForward || Speed != lastSpeed)) {
+ bool NormalPlay = (Play && Speed == -1);
+
+ if (!visible) {
+ if (NormalPlay)
+ return; // no need to do indicate ">" unless there was a different mode displayed before
+ visible = modeOnly = true;
+ displayReplay = Skins.Current()->DisplayReplay(modeOnly);
+ }
+
+ if (modeOnly && !timeoutShow && NormalPlay)
+ timeoutShow = time(NULL) + 3;
+ displayReplay->SetMode(Play, Forward, Speed);
+ lastPlay = Play;
+ lastForward = Forward;
+ lastSpeed = Speed;
+ }
+ }
+}
+
+bool cHlsPlayerControl::ShowProgress(bool Initial)
+{
+ int Current, Total;
+
+ if (GetIndex(Current, Total) && Total > 0) {
+ if (!visible) {
+ displayReplay = Skins.Current()->DisplayReplay(modeOnly);
+ //displayReplay->SetMarks(player->Marks());
+ SetNeedsFastResponse(true);
+ visible = true;
+ }
+ if (Initial) {
+ lastCurrent = lastTotal = -1;
+ }
+ if (Current != lastCurrent || Total != lastTotal) {
+ if (Total != lastTotal) {
+ int Index = Total;
+ displayReplay->SetTotal(IndexToHMSF(Index, false, FramesPerSecond()));
+ if (!Initial)
+ displayReplay->Flush();
+ }
+ displayReplay->SetProgress(Current, Total);
+ if (!Initial)
+ displayReplay->Flush();
+ displayReplay->SetCurrent(IndexToHMSF(Current, false, FramesPerSecond()));
+
+ cString Title;
+ //cString Pos = player ? player->PosStr() : cString(NULL);
+ //if (*Pos && strlen(Pos) > 1) {
+ // Title = cString::sprintf("%s (%s)", m_title.c_str(), *Pos);
+ //} else {
+ Title = m_title.c_str();
+ //}
+ displayReplay->SetTitle(Title);
+
+ displayReplay->Flush();
+ lastCurrent = Current;
+ }
+ lastTotal = Total;
+ ShowMode();
+ return true;
+ }
+ return false;
+}
+
+void cHlsPlayerControl::ShowTimed(int Seconds)
+{
+ if (modeOnly)
+ Hide();
+ if (!visible) {
+ shown = ShowProgress(true);
+ timeoutShow = (shown && Seconds > 0) ? time(NULL) + Seconds : 0;
+ } else if (timeoutShow && Seconds > 0)
+ timeoutShow = time(NULL) + Seconds;
+}
diff --git a/hlsPlayerControl.h b/hlsPlayerControl.h
index 36c23ee..8eb8bc6 100644
--- a/hlsPlayerControl.h
+++ b/hlsPlayerControl.h
@@ -5,20 +5,33 @@
#include <vdr/tools.h>
#include "hlsPlayer.h"
+#include "PVideo.h"
class cHlsPlayerControl : public cControl
{
private:
+ static volatile int active;
+ plexclient::Video* m_pVideo;
cHlsPlayer* player;
std::string m_title;
-
- bool visible;
+
+ cSkinDisplayReplay *displayReplay;
+ bool visible, modeOnly, shown;
+ int lastCurrent, lastTotal;
+ bool lastPlay, lastForward;
+ int lastSpeed;
+ time_t timeoutShow;
+
+ void ShowMode(void);
+ bool ShowProgress(bool Initial);
+ void ShowTimed(int Seconds = 0);
protected:
//void ShowMode();
public:
- cHlsPlayerControl(cHlsPlayer* Player, std::string title);
+ static cControl* Create(plexclient::Video* Video);
+ cHlsPlayerControl(cHlsPlayer* Player, plexclient::Video* Video);
virtual ~cHlsPlayerControl();
virtual void Show(void);
diff --git a/play_service.h b/play_service.h
deleted file mode 100644
index 0084603..0000000
--- a/play_service.h
+++ /dev/null
@@ -1,31 +0,0 @@
-///
-/// @file play_service.h @brief Play service header file.
-///
-/// Copyright (c) 2012 by durchflieger. All Rights Reserved.
-///
-/// Contributor(s):
-///
-/// License: AGPLv3
-///
-/// This program is free software: you can redistribute it and/or modify
-/// it under the terms of the GNU Affero General Public License as
-/// published by the Free Software Foundation, either version 3 of the
-/// License.
-///
-/// This program is distributed in the hope that it will be useful,
-/// but WITHOUT ANY WARRANTY; without even the implied warranty of
-/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-/// GNU Affero General Public License for more details.
-///
-/// $Id: d903996c670a05e72a189a0a5de30724eb2ea903 $
-//////////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#define PLEX_OSD_3DMODE_SERVICE "Plex-Osd3DModeService-v1.0"
-#define PLEX_PLAY_FILE_SERVICE "Plex-PlayFileService-v1.0"
-
-typedef struct
-{
- int Mode;
-} Play_Osd3DModeService_v1_0_t;
diff --git a/plex.cpp b/plex.cpp
index a761303..2626d75 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -12,11 +12,10 @@ char ConfigDisableRemote; ///< disable remote during external play
**
** @param filename path and file name
*/
-static void PlayFile(std::string filename, plexclient::Video* pVid)
+static void PlayFile(plexclient::Video* pVid)
{
- isyslog("[plex]: play file '%s'\n", filename.c_str());
- //cControl::Launch(new cMyControl(filename));
- cControl::Launch(new cHlsPlayerControl(new cHlsPlayer(filename), pVid->m_sTitle.c_str()));
+ isyslog("[plex]: play file '%s'\n", pVid->m_sKey.c_str());
+ cControl::Launch(cHlsPlayerControl::Create(pVid));
}
//////////////////////////////////////////////////////////////////////////////
@@ -132,7 +131,7 @@ eOSState cPlexBrowser::ProcessSelected() {
if(item->IsVideo()) {
plexclient::Video* pVid = item->GetAttachedVideo();
- PlayFile(pService->GetUniversalTranscodeUrl(pVid).c_str(), pVid);
+ PlayFile(pVid);
return osEnd;
}
@@ -335,7 +334,7 @@ void cMyPlugin::MainThreadHook(void)
// Start Tasks, e.g. Play Video
if(plexclient::ActionManager::GetInstance().IsAction()) {
std::string file = plexclient::ActionManager::GetInstance().GetAction();
- PlayFile(file, NULL);
+ //PlayFile(file, NULL);
}
}
diff --git a/plex.h b/plex.h
index 30911b0..4090888 100644
--- a/plex.h
+++ b/plex.h
@@ -14,7 +14,6 @@
#include "Plexservice.h"
#include "plexgdm.h"
-#include "play_service.h"
#include "cPlexOsdItem.h"
#include "hlsPlayerControl.h"
diff --git a/plexgdm.cpp b/plexgdm.cpp
index a2aeb6d..fca991e 100644
--- a/plexgdm.cpp
+++ b/plexgdm.cpp
@@ -66,12 +66,10 @@ try {
// Send initial Client Registration
std::string s = Poco::format("HELLO %s\n%s", _clientHeader, _clientData);
- //std::cout << "SendTo:\n" << s << std::endl;
update_sock.sendTo(s.c_str(), s.length(), m_clientRegisterGroup,0);
while(m_registrationIsRunning) {
- //std::cout << "cUpd running " << m_registrationIsRunning << std::endl;
Poco::Net::SocketAddress sender;
int n = 0;
try {
@@ -82,7 +80,7 @@ try {
if(n > 0) {
std::string buf(buffer, n);
if (buf.find("M-SEARCH * HTTP/1.") != std::string::npos) {
- std::cout << "Detected client discovery request from " << sender.host().toString() << " Replying..." << std::endl;
+ dsyslog("[plex]: Detected client discovery request from %s",sender.host().toString().c_str());
s = Poco::format("HTTP/1.0 200 OK\n%s", _clientData);
update_sock.sendTo(s.c_str(), s.length(), sender);
m_clientRegistered = true;
@@ -94,7 +92,6 @@ try {
// unregister from Server
s = Poco::format("BYE %s\n%s", _clientHeader, _clientData);
- //std::cout << "Unregister: \n" << s << std::endl;
update_sock.sendTo(s.c_str(), s.length(), m_clientRegisterGroup,0);
m_clientRegistered = false;