summaryrefslogtreecommitdiff
path: root/plugins/provider/vdrProvider/vdrProvider.cpp
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-10-02 02:53:05 +0200
committermethodus <methodus@web.de>2012-10-02 02:53:05 +0200
commit56296525a687aec715bb52def9a68d3812771082 (patch)
tree45643dfa735eaff96ac8d46a5dbfd90448a479ec /plugins/provider/vdrProvider/vdrProvider.cpp
parentcbef7cfb972c27251ea8d58dde054b7c57e1715f (diff)
downloadvdr-plugin-upnp-56296525a687aec715bb52def9a68d3812771082.tar.gz
vdr-plugin-upnp-56296525a687aec715bb52def9a68d3812771082.tar.bz2
VDRProvider plugin for serving live tv started.
Diffstat (limited to 'plugins/provider/vdrProvider/vdrProvider.cpp')
-rw-r--r--plugins/provider/vdrProvider/vdrProvider.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/plugins/provider/vdrProvider/vdrProvider.cpp b/plugins/provider/vdrProvider/vdrProvider.cpp
new file mode 100644
index 0000000..f593cba
--- /dev/null
+++ b/plugins/provider/vdrProvider/vdrProvider.cpp
@@ -0,0 +1,72 @@
+/*
+ * vdrProvider.cpp
+ *
+ * Created on: 01.10.2012
+ * Author: savop
+ */
+
+#include <plugin.h>
+#include <vdr/channels.h>
+#include <vdr/tools.h>
+#include <string>
+
+namespace upnp {
+
+#define GROUP_CHANNELS
+
+class VdrProvider : cUPnPResourceProvider {
+
+ virtual string ProvidesSchema(){ return "vdr"; }
+
+ virtual string GetRootContainer(){
+ return ProvidesSchema() + "://";
+ }
+
+ virtual EntryList GetContainerEntries(string uri){
+ if(uri.find(GetRootContainer(), 0) != 0){
+ isyslog("VdrProvider\tUri does not contain the root.");
+ return EntryList;
+ }
+
+ EntryList list;
+
+ // Check if this is the root:
+ if(uri.compare(GetRootContainer()) == 0){
+ cChannel* channel = NULL;
+ for(int index = 0; (channel = Channels.Get(index)); index = Channels.GetNextNormal(index)){
+ if(!channel->GroupSep()){
+ list.push_back(*channel->GetChannelID().ToString());
+ }
+ }
+ }
+
+ return list;
+ }
+
+ virtual bool IsContainer(string uri){
+ return uri.compare(GetRootContainer()) == 0;
+ }
+
+ virtual bool IsLink(string uri, string& target){
+ // TODO: what are Channel::RefChannel or LinkChannels ?
+ return false;
+ }
+
+ virtual long GetContainerUpdateId(string uri){
+ // TODO: provide a container update id
+ return 0;
+ }
+
+ virtual cMetadata GetMetadata(string uri);
+
+ virtual string GetHTTPUri(string uri){
+ // TODO: get streamdev settings from configuration
+ return string();
+ }
+
+};
+
+UPNP_REGISTER_RESOURCE_PROVIDER(VdrProvider);
+
+} // namespace upnp
+