forked from MarkusEh/vdr-plugin-live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlivefeatures.h
85 lines (66 loc) · 1.8 KB
/
livefeatures.h
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
#ifndef VDR_LIVE_FEATURES_H
#define VDR_LIVE_FEATURES_H
// STL headers need to be before VDR tools.h (included by <vdr/channels.h>)
#include <string>
#if TNTVERSION >= 30000
#include <cxxtools/log.h> // must be loaded before any vdr include because of duplicate macros (LOG_ERROR, LOG_DEBUG, LOG_INFO)
#endif
#include <vdr/plugin.h>
namespace vdrlive {
class SplitVersion
{
public:
explicit SplitVersion( std::string version );
bool operator<( const SplitVersion& right ) const;
private:
int m_version;
std::string m_suffix;
};
template<typename Feat>
class Features;
template<typename Feat>
Features<Feat>& LiveFeatures();
template<typename Feat>
class Features
{
friend Features<Feat>& LiveFeatures<>();
public:
bool Loaded() const { return m_plugin != 0; }
bool Recent() const { return !(m_version < m_minVersion); }
char const* Version() const { return m_plugin ? m_plugin->Version() : ""; }
char const* MinVersion() const { return Feat::MinVersion(); }
private:
cPlugin* m_plugin;
SplitVersion m_version;
SplitVersion m_minVersion;
Features()
: m_plugin( cPluginManager::GetPlugin( Feat::Plugin() ) )
, m_version( Version() )
, m_minVersion( Feat::MinVersion() ) {}
};
template<typename Feat>
Features<Feat>& LiveFeatures()
{
static Features<Feat> instance;
return instance;
}
namespace features
{
struct epgsearch
{
static const char* Plugin() { return "epgsearch"; }
static const char* MinVersion() { return "0.9.25.beta6"; }
};
struct streamdev_server
{
static const char* Plugin() { return "streamdev-server"; }
static const char* MinVersion() { return "?"; }
};
struct tvscraper
{
static const char* Plugin() { return "tvscraper"; }
static const char* MinVersion() { return "1.1.9"; }
};
} // namespace features
} // namespace vdrlive
#endif // VDR_LIVE_FEATURES_H