summaryrefslogtreecommitdiff
path: root/plex.h
blob: c2570c8266c5fac66c79b01820ddd01c5151105e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef PLEX_H
#define PLEX_H

#include <vdr/interface.h>
#include <vdr/plugin.h>
#include <vdr/player.h>
#include <vdr/osd.h>
#include <vdr/shutdown.h>
#include <vdr/status.h>
#include <vdr/videodir.h>
#include <vdr/menuitems.h>

#include "Config.h"
#include "Plexservice.h"

#include "plexgdm.h"
#include "cPlexOsdItem.h"
#include "hlsPlayerControl.h"

#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <algorithm>
#include <memory>


/// vdr-plugin version number.
/// Makefile extracts the version number for generating the file name
/// for the distribution archive.
static const char *const VERSION = "0.1.0"
#ifdef GIT_REV
    "-GIT" GIT_REV
#endif
;
static const char *const DESCRIPTION = "Plex for VDR Plugin";
static const char *const MAINMENUENTRY = "Plex for VDR";

/*
 *	Plex Browser
 */

class cPlexBrowser :public cOsdMenu
{
private:
	std::shared_ptr<plexclient::Plexservice> pService;
	std::shared_ptr<plexclient::MediaContainer> pCont;
	std::vector<plexclient::Video> *v_Vid;
	std::vector<plexclient::Directory> *v_Dir;
	std::vector<std::string> m_vStack;
	std::string m_sSection;
	std::string m_sActualPos;
	/// Create a browser menu for current directory
	void CreateMenu();
	/// Handle menu level up
	eOSState LevelUp(void);
	/// Handle menu item selection
	eOSState ProcessSelected();
	
	static std::shared_ptr<plexclient::Plexservice> pLastService;
	static int lastCurrentItem;

public:
	cPlexBrowser(const char *title, std::shared_ptr<plexclient::Plexservice> Service);
	virtual eOSState ProcessKey(eKeys);
	
	static cPlexBrowser* RecoverLastState();

};

class cPlexInfo : public cOsdMenu
{

public:
	cPlexInfo(plexclient::Video* video);
	virtual eOSState ProcessKey(eKeys Keys);
};

/**
**	Play plugin menu class.
*/
class cPlayMenu:public cOsdMenu
{
private:
public:
	cPlayMenu(const char *, int = 0, int = 0, int = 0, int = 0, int = 0);
	virtual ~ cPlayMenu();
	virtual eOSState ProcessKey(eKeys);
};

class cMyPlugin:public cPlugin
{
public:
	cMyPlugin(void);
	virtual ~ cMyPlugin(void);
	virtual const char *Version(void);
	virtual const char *Description(void);
	virtual bool Initialize(void);
	virtual void MainThreadHook(void);
	virtual const char *MainMenuEntry(void);
	virtual cOsdObject *MainMenuAction(void);
	virtual cMenuSetupPage *SetupMenu(void);
	virtual bool SetupParse(const char *, const char *);
	
	static void PlayFile(plexclient::Video Vid);
	
public:
	static volatile bool CalledFromCode; 

};

#endif