diff options
author | chriszero <zerov83@gmail.com> | 2015-10-11 19:07:10 +0200 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-10-11 19:07:10 +0200 |
commit | 75e178bcc0105e5f618e913d53cca91450a6e8bd (patch) | |
tree | b0eef5ad0534c58e2e42d11a256b3d5e5542f1c6 /plex.cpp | |
parent | 0be6c14499cbc7351578198e8f15b3e1bf1b1335 (diff) | |
download | vdr-plugin-plex-75e178bcc0105e5f618e913d53cca91450a6e8bd.tar.gz vdr-plugin-plex-75e178bcc0105e5f618e913d53cca91450a6e8bd.tar.bz2 |
Better support for vdr-plugin-mpv.
Diffstat (limited to 'plex.cpp')
-rw-r--r-- | plex.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -15,6 +15,9 @@ volatile bool cMyPlugin::CalledFromCode = false; bool cMyPlugin::bSkindesigner = false; +plexclient::Video cMyPlugin::CurrentVideo; +bool cMyPlugin::PlayingFile = false; + /** ** Initialize any member variables here. ** @@ -79,7 +82,7 @@ bool cMyPlugin::Start(void) reg.SetViewElement(viDetailView, vedHeader, "header"); reg.SetViewElement(viDetailView, vedFooter, "footer"); */ - + //reg.SetMenu(meRoot, "streamselect.xml"); if (skindesignerapi::SkindesignerAPI::RegisterPlugin(®)) { m_pSdCheck = new cPlexSdOsd(); @@ -169,18 +172,36 @@ bool cMyPlugin::SetupParse(const char *name, const char *value) */ void cMyPlugin::PlayFile(plexclient::Video Vid) { + 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); + eKeys response = Skins.Message(eMessageType::mtInfo, message, 5); + if(response == kOk) { + Vid.m_iMyPlayOffset = Vid.m_lViewoffset/1000; + } + } + cPlugin* mpvPlugin = cPluginManager::GetPlugin("mpv"); if(Config::GetInstance().UseMpv && mpvPlugin) { + CurrentVideo = Vid; + cMyPlugin::PlayingFile = true; + Mpv_PlayFile req; Mpv_SetTitle reqTitle; char* file = (char*)(Vid.m_pServer->GetUri() + Vid.m_Media.m_sPartKey).c_str(); - + req.Filename = file; mpvPlugin->Service(MPV_PLAY_FILE, &req); - + reqTitle.Title = (char*)Vid.GetTitle().c_str(); mpvPlugin->Service(MPV_SET_TITLE, &reqTitle); + + // Set "StartAt" for mpv player + Mpv_Seek seekData; + seekData.SeekAbsolute = Vid.m_iMyPlayOffset; + seekData.SeekRelative = 0; + mpvPlugin->Service(MPV_SEEK, &seekData); + return; } else if (Config::GetInstance().UseMpv) { @@ -189,13 +210,6 @@ void cMyPlugin::PlayFile(plexclient::Video Vid) 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); - eKeys response = Skins.Message(eMessageType::mtInfo, message, 5); - if(response == kOk) { - Vid.m_iMyPlayOffset = Vid.m_lViewoffset/1000; - } - } cControl* control = cHlsPlayerControl::Create(Vid); if(control) { cControl::Launch(control); |