summaryrefslogtreecommitdiff
path: root/plex.h
blob: 30911b0490685dfa5643fdca350e752dad13ae3c (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#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 "play_service.h"
#include "cPlexOsdItem.h"
#include "hlsPlayerControl.h"

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

static const char *DESCRIPTION = "Plex for VDR Plugin";
static const char *MAINMENUENTRY = "Plex for VDR";

/**
**	Device plugin remote class.
*/
class cMyRemote:public cRemote
{
  public:

    /**
    **	Soft device remote class constructor.
    **
    **	@param name	remote name
    */
    cMyRemote(const char *name):cRemote(name)
    {
    }

    /**
    **	Put keycode into vdr event queue.
    **
    **	@param code	key code
    **	@param repeat	flag key repeated
    **	@param release	flag key released
    */
    bool Put(const char *code, bool repeat = false, bool release = false) {
	return cRemote::Put(code, repeat, release);
    }
};

/**
**	Player class.
*/
class cMyPlayer:public cPlayer
{
  private:
    char *FileName;			///< file to play

  public:
     cMyPlayer(const char *);		///< player constructor
     virtual ~ cMyPlayer();		///< player destructor
    void Activate(bool);		///< player attached/detached
    /// get current replay mode
    virtual bool GetReplayMode(bool &, bool &, int &);
};

/**
**	Status class.
**
**	To get volume changes.
*/
class cMyStatus:public cStatus
{
  private:
    int Volume;				///< current volume

  public:
    cMyStatus(void);			///< my status constructor

  protected:
    virtual void SetVolume(int, bool);	///< volume changed
};

/**
**	Our player control class.
*/
class cMyControl:public cControl
{
  private:
    cMyPlayer * Player;			///< our player
    cSkinDisplayReplay *Display;	///< our osd display
    void ShowReplayMode(void);		///< display replay mode
    void ShowProgress(void);		///< display progress bar
    virtual void Show(void);		///< show replay control
    virtual void Hide(void);		///< hide replay control
    bool infoVisible;			///< RecordingInfo visible
    time_t timeoutShow;			///< timeout shown control

  public:
    cMyControl(const char *);		///< player control constructor
    virtual ~ cMyControl();		///< player control destructor

    virtual eOSState ProcessKey(eKeys);	///< handle keyboard input

};

/*
 *	Plex Browser 
 */

class cPlexBrowser :public cOsdMenu
{
private:
	plexclient::Plexservice* pService;
	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();
	
public:
	cPlexBrowser(const char *title, plexclient::PlexServer* pServ);
	~cPlexBrowser();
	/// File browser destructor
    //virtual ~ cPlexBrowser();
    /// Process keyboard input
    virtual eOSState ProcessKey(eKeys);
	
};

/**
**	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);
};

/**
**	My device plugin OSD class.
*/
class cMyOsd:public cOsd
{
  public:
    static volatile char Dirty;		///< flag force redraw everything
    int OsdLevel;			///< current osd level

    cMyOsd(int, int, uint);		///< osd constructor
    virtual ~ cMyOsd(void);		///< osd destructor
    virtual void Flush(void);		///< commits all data to the hardware
    virtual void SetActive(bool);	///< sets OSD to be the active one
};

/**
**	My device plugin OSD provider class.
*/
class cMyOsdProvider:public cOsdProvider
{
  private:
    static cOsd *Osd;

  public:
    virtual cOsd * CreateOsd(int, int, uint);
    virtual bool ProvidesTrueColor(void);
    cMyOsdProvider(void);
};

/**
**	Dummy device class.
*/
class cMyDevice:public cDevice
{
  public:
    cMyDevice(void);
    virtual ~ cMyDevice(void);

    virtual void GetOsdSize(int &, int &, double &);

  protected:
    virtual void MakePrimaryDevice(bool);
};

class cMyPlugin:public cPlugin
{
  public:
    cMyPlugin(void);
    virtual ~ cMyPlugin(void);
    virtual const char *Version(void);
    virtual const char *Description(void);
    virtual bool ProcessArgs(int, char *[]);
    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 *);

};

#endif