-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmediaplayer.cpp
More file actions
170 lines (142 loc) · 4.29 KB
/
Copy pathmediaplayer.cpp
File metadata and controls
170 lines (142 loc) · 4.29 KB
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
/*
* Mediaplayer plugin for VDR
*
* (C) 2018 by zille. All Rights Reserved.
*
* This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This code 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#include <getopt.h>
#include <string>
using std::string;
#include <vdr/player.h>
#include <vdr/plugin.h>
#include "mediaplayer.h"
#include "player.h"
#include "control.h"
#include "menu.h"
#include "setupmenu.h"
//////////////////////////////////////////////////////////////////////////////
// cPluginMediaplayer
//////////////////////////////////////////////////////////////////////////////
// Default Settings
string cPluginMediaplayer::StartPath = "/";
volatile int cPluginMediaplayer::BufferOffset = 10;
cPluginMediaplayer::cPluginMediaplayer(void)
{
// Initialize any member variables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
}
cPluginMediaplayer::~cPluginMediaplayer()
{
// Clean up after yourself!
}
const char *cPluginMediaplayer::CommandLineHelp(void)
{
// Return a string that describes all known command line options.
return
" --startpath=/path/to/files\tpath to start search mediafiles (default /)\n"
;
}
bool cPluginMediaplayer::ProcessArgs(int argc, char *argv[])
{
static struct option long_options[] =
{
{ "startpath", required_argument, NULL, 'p' },
{ NULL, no_argument, NULL, '\0' }
};
int c, option_index = 0;
while ((c = getopt_long(argc, argv, "p", long_options, &option_index)) != -1) {
switch (c) {
case 'p':
StartPath.assign(optarg);
break;
default:
esyslog("MediaPlayer unknown option %c", c);
return false;
}
}
return true;
}
bool cPluginMediaplayer::Initialize(void)
{
// Initialize any background activities the plugin shall perform.
return true;
}
bool cPluginMediaplayer::Start(void)
{
// Start any background activities the plugin shall perform.
return true;
}
void cPluginMediaplayer::Stop(void)
{
// Stop any background activities the plugin is performing.
}
void cPluginMediaplayer::Housekeeping(void)
{
// Perform any cleanup or other regular tasks.
}
void cPluginMediaplayer::MainThreadHook(void)
{
// Perform actions in the context of the main program thread.
// WARNING: Use with great care - see PLUGINS.html!
}
cString cPluginMediaplayer::Active(void)
{
// Return a message string if shutdown should be postponed
return NULL;
}
time_t cPluginMediaplayer::WakeupTime(void)
{
// Return custom wakeup time for shutdown script
return 0;
}
cOsdObject *cPluginMediaplayer::MainMenuAction(void)
{
// Perform the action when selected from the main VDR menu.
return new cMediaPlayerMenu("Mediaplayer");
}
cMenuSetupPage *cPluginMediaplayer::SetupMenu(void)
{
// Return a setup menu in case the plugin supports one.
return new cMenuSetupMediaplayer();
}
bool cPluginMediaplayer::SetupParse(const char *Name, const char *Value)
{
if (!strcasecmp(Name, "BufferOffset")) {
BufferOffset = atoi(Value);
return true;
}
return false;
}
bool cPluginMediaplayer::Service(__attribute__ ((unused))const char *Id,
__attribute__ ((unused))void *Data)
{
// Handle custom service requests from other plugins
return false;
}
const char **cPluginMediaplayer::SVDRPHelpPages(void)
{
// Return help text for SVDRP commands this plugin implements
return NULL;
}
cString cPluginMediaplayer::SVDRPCommand(__attribute__ ((unused))const char *Command,
__attribute__ ((unused))const char *Option, __attribute__ ((unused))int &ReplyCode)
{
// Process SVDRP commands this plugin implements
return NULL;
}
VDRPLUGINCREATOR(cPluginMediaplayer); // Don't touch this!