-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathciplus.c
More file actions
93 lines (77 loc) · 2.32 KB
/
ciplus.c
File metadata and controls
93 lines (77 loc) · 2.32 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
/*
* ciplus.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#if defined(APIVERSNUM) && APIVERSNUM < 20305
#error "VDR-2.3.5 API version or greater is required!"
#endif
#include <vdr/plugin.h>
#include <vdr/ci.h>
#include <getopt.h>
#include "cCiPlusResourceHandler.h"
#include "cCiPlusPrivate.h"
#include "ciplus.h"
#define LIBCIPLUSPRIVATE PLUGINDIR "/libciplusprivate.so"
static const char *VERSION = "1.0.2";
static const char *DESCRIPTION = "Use CI+ Modules with VDR";
const char *confDir = NULL;
const char *cacheDir = NULL;
bool DebugProtocol = false;
class cPluginCiplus : public cPlugin {
private:
cString privateDataLibName;
cCiPlusPrivate *privateData;
public:
cPluginCiplus(void);
virtual ~cPluginCiplus();
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return DESCRIPTION; }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Initialize(void);
};
cPluginCiplus::cPluginCiplus(void)
{
privateDataLibName = NULL;
privateData = new cCiPlusPrivate;
}
cPluginCiplus::~cPluginCiplus()
{
delete privateData;
}
const char *cPluginCiplus::CommandLineHelp(void)
{
const char *help = " -d Enable Debug-Output on stderr\n"
" -l <privateDataLibName> File name (with path) of CI+ private data library\n";
return help;
}
bool cPluginCiplus::ProcessArgs(int argc, char *argv[])
{
int c;
opterr = 0;
while ((c = getopt (argc, argv, "dl:")) != -1) {
switch(c) {
case 'd': DebugProtocol = true; break;
case 'l': privateDataLibName = optarg; break;
}
}
return true;
}
bool cPluginCiplus::Initialize(void)
{
confDir = ConfigDirectory(Name());
cacheDir = CacheDirectory(Name());
if(!(const char *)privateDataLibName) {
privateDataLibName = LIBCIPLUSPRIVATE;
}
if(privateData->LoadPrivateData((const char *)privateDataLibName)) {
CiResourceHandlers.Register(new cCiPlusResourceHandler(privateData));
} else {
esyslog("ciplus: Can't load CI+ private data. CI+ disabled!");
}
return true;
}
VDRPLUGINCREATOR(cPluginCiplus); // Don't touch this!