summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-06-10 20:01:40 +0200
committerchriszero <zerov83@gmail.com>2015-06-10 20:01:40 +0200
commit5ac0830333ea2c059741795ef993052cdcc62c0d (patch)
tree60a09563e8c139ec1858f852fc059a6ea86fe1c0
parent8c6697c872bb1dad8281f43d1777fe4ec009708c (diff)
downloadvdr-plugin-plex-5ac0830333ea2c059741795ef993052cdcc62c0d.tar.gz
vdr-plugin-plex-5ac0830333ea2c059741795ef993052cdcc62c0d.tar.bz2
Use Mpv for playing media. Configure via plugin setup.
-rw-r--r--Config.cpp5
-rw-r--r--Config.h3
-rw-r--r--plex.cpp15
-rw-r--r--services.h22
4 files changed, 45 insertions, 0 deletions
diff --git a/Config.cpp b/Config.cpp
index f4a0614..666bc4d 100644
--- a/Config.cpp
+++ b/Config.cpp
@@ -99,6 +99,7 @@ bool Config::Parse(const char *name, const char *value)
else if (strcasecmp(name, "DetailGridRows") == 0) Config::GetInstance().DetailGridRows = atoi(value);
else if (strcasecmp(name, "ListGridColumns") == 0) Config::GetInstance().ListGridColumns = atoi(value);
else if (strcasecmp(name, "ListGridRows") == 0) Config::GetInstance().ListGridRows = atoi(value);
+ else if (strcasecmp(name, "UseMpv") == 0) Config::GetInstance().UseMpv = atoi(value) ? true : false;
else parsed = false;
if(!parsed) {
@@ -144,11 +145,13 @@ cMyMenuSetupPage::cMyMenuSetupPage(void)
DetailGridRows = Config::GetInstance().DetailGridRows;
ListGridColumns = Config::GetInstance().ListGridColumns;
ListGridRows = Config::GetInstance().ListGridRows;
+ UseMpv = Config::GetInstance().UseMpv;
DefaultViewMode = Config::GetInstance().DefaultViewMode;
Add(new cMenuEditBoolItem(tr("Hide main menu entry"), (int*)&HideMainMenuEntry, trVDR("no"), trVDR("yes")));
+ Add(new cMenuEditBoolItem(tr("Use Mpv Plugin (If Availiable)"), (int*)&UseMpv, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Use custom transcoding profile"), (int*)&UseCustomTranscodeProfile, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Use Plex account"), (int*)&UsePlexAccount, trVDR("no"), trVDR("yes")));
Add(new cMenuEditStrItem(tr("Plex Username"), Username, STRING_SIZE));
@@ -194,6 +197,7 @@ void cMyMenuSetupPage::Store(void)
Config::GetInstance().ListGridColumns = ListGridColumns;
Config::GetInstance().ListGridRows = ListGridRows;
Config::GetInstance().DefaultViewMode = (ViewMode)DefaultViewMode;
+ Config::GetInstance().UseMpv = UseMpv;
SetupStore("UseCustomTranscodeProfile", Config::GetInstance().UseCustomTranscodeProfile);
SetupStore("HideMainMenuEntry", Config::GetInstance().HideMainMenuEntry);
@@ -211,4 +215,5 @@ void cMyMenuSetupPage::Store(void)
SetupStore("ListGridColumns", Config::GetInstance().ListGridColumns);
SetupStore("ListGridRows", Config::GetInstance().ListGridRows);
SetupStore("DefaultViewMode", Config::GetInstance().DefaultViewMode);
+ SetupStore("UseMpv", Config::GetInstance().UseMpv);
}
diff --git a/Config.h b/Config.h
index 936eae5..7461af7 100644
--- a/Config.h
+++ b/Config.h
@@ -61,6 +61,8 @@ public:
std::vector<ViewEntry> m_viewentries;
std::vector<ViewEntry> m_serverViewentries;
+ bool UseMpv;
+
std::string GetUUID();
void SetUUID(const char* uuid);
std::string GetHostname();
@@ -110,6 +112,7 @@ class cMyMenuSetupPage:public cMenuSetupPage
int ListGridColumns;
int ListGridRows;
int DefaultViewMode;
+ int UseMpv;
virtual void Store(void);
diff --git a/plex.cpp b/plex.cpp
index 31d3229..a242a9b 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -4,6 +4,7 @@
#include "plexOsd.h"
#include "plexSdOsd.h"
#include "pictureCache.h"
+#include "services.h"
#include <libskindesignerapi/skindesignerapi.h>
@@ -167,6 +168,20 @@ bool cMyPlugin::SetupParse(const char *name, const char *value)
*/
void cMyPlugin::PlayFile(plexclient::Video Vid)
{
+ cPlugin* mpvPlugin = cPluginManager::GetPlugin("mpv");
+
+ if(Config::GetInstance().UseMpv && mpvPlugin) {
+ Play_StartPlayService_v1_0_t req;
+ char* file = (char*)(Vid.m_pServer->GetUri() + Vid.m_Media.m_sPartKey).c_str();
+ req.Filename = file;
+ //req.Title = &Vid.GetTitle().c_str();
+ mpvPlugin->Service(PLAY_START_PLAY_SERVICE, &req);
+
+ } else if (Config::GetInstance().UseMpv) {
+ isyslog("Can't find mpv %s, playing directly.", mpvPlugin ? "service" : "plugin");
+ }
+
+
isyslog("[plex]: play file '%s'\n", Vid.m_sKey.c_str());
if(Vid.m_iMyPlayOffset == 0 && Vid.m_lViewoffset > 0 ) {
cString message = cString::sprintf(tr("To start from %ld minutes, press Ok."), Vid.m_lViewoffset / 60000);
diff --git a/services.h b/services.h
new file mode 100644
index 0000000..bf14b70
--- /dev/null
+++ b/services.h
@@ -0,0 +1,22 @@
+#pragma once
+#include <string>
+
+#define PLAY_OSD_3DMODE_SERVICE "Play-Osd3DModeService-v1.0"
+#define PLAY_START_PLAY_SERVICE "Play-StartPlayService_v1_0"
+#define PLAY_SET_TITLE_SERVICE "Play-SetTitleService_v1_0"
+
+typedef struct
+{
+ int Mode;
+} Play_Osd3DModeService_v1_0_t;
+
+typedef struct
+{
+ char* Filename;
+ char* Title;
+} Play_StartPlayService_v1_0_t;
+
+typedef struct
+{
+ char* Title;
+} Play_SetTitleService_v1_0_t; \ No newline at end of file