summaryrefslogtreecommitdiff
path: root/plugins/streamdev/streamdev-cvs/server/menuHTTP.h
diff options
context:
space:
mode:
authorkwacker <vdr@w-i-r.com>2010-04-11 13:46:11 +0200
committerkwacker <vdr@w-i-r.com>2010-04-11 13:46:11 +0200
commit9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88 (patch)
tree3a52de029f950dcd9f9856a53fd67abef8519e68 /plugins/streamdev/streamdev-cvs/server/menuHTTP.h
parent9cd931834ecadbf5efefdf484abb966e9248ebbb (diff)
downloadx-vdr-9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88.tar.gz
x-vdr-9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88.tar.bz2
Burn 0.2.0-beta3 und Streamdev mit Paches aktualisiert
Diffstat (limited to 'plugins/streamdev/streamdev-cvs/server/menuHTTP.h')
-rw-r--r--plugins/streamdev/streamdev-cvs/server/menuHTTP.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/plugins/streamdev/streamdev-cvs/server/menuHTTP.h b/plugins/streamdev/streamdev-cvs/server/menuHTTP.h
new file mode 100644
index 0000000..cbd7b59
--- /dev/null
+++ b/plugins/streamdev/streamdev-cvs/server/menuHTTP.h
@@ -0,0 +1,143 @@
+#ifndef VDR_STREAMDEV_SERVERS_MENUHTTP_H
+#define VDR_STREAMDEV_SERVERS_MENUHTTP_H
+
+#include <string>
+#include "../common.h"
+
+class cChannel;
+
+// ******************** cChannelIterator ******************
+class cChannelIterator
+{
+ private:
+ const cChannel *channel;
+ protected:
+ virtual const cChannel* NextChannel(const cChannel *Channel) = 0;
+ public:
+ const cChannel* Next();
+ cChannelIterator(cChannel *First);
+ virtual ~cChannelIterator() {};
+};
+
+class cListAll: public cChannelIterator
+{
+ protected:
+ virtual const cChannel* NextChannel(const cChannel *Channel);
+ public:
+ cListAll();
+ virtual ~cListAll() {};
+};
+
+class cListChannels: public cChannelIterator
+{
+ protected:
+ virtual const cChannel* NextChannel(const cChannel *Channel);
+ public:
+ cListChannels();
+ virtual ~cListChannels() {};
+};
+
+class cListGroups: public cChannelIterator
+{
+ protected:
+ virtual const cChannel* NextChannel(const cChannel *Channel);
+ public:
+ cListGroups();
+ virtual ~cListGroups() {};
+};
+
+class cListGroup: public cChannelIterator
+{
+ protected:
+ virtual const cChannel* NextChannel(const cChannel *Channel);
+ public:
+ cListGroup(const cChannel *Group);
+ virtual ~cListGroup() {};
+};
+
+class cListTree: public cChannelIterator
+{
+ private:
+ const cChannel* selectedGroup;
+ const cChannel* currentGroup;
+ protected:
+ virtual const cChannel* NextChannel(const cChannel *Channel);
+ public:
+ cListTree(const cChannel *SelectedGroup);
+ virtual ~cListTree() {};
+};
+
+// ******************** cChannelList ******************
+class cChannelList
+{
+ private:
+ cChannelIterator *iterator;
+ protected:
+ const cChannel* NextChannel() { return iterator->Next(); }
+ public:
+ // Helper which returns the group index
+ static int GetGroupIndex(const cChannel* Group);
+ // Helper which returns the group by its index
+ static const cChannel* GetGroup(int Index);
+
+ virtual std::string HttpHeader() { return "HTTP/1.0 200 OK\r\n"; };
+ virtual bool HasNext() = 0;
+ virtual std::string Next() = 0;
+ cChannelList(cChannelIterator *Iterator);
+ virtual ~cChannelList();
+};
+
+class cHtmlChannelList: public cChannelList
+{
+ private:
+ static const char* menu;
+ static const char* css;
+ static const char* js;
+
+ enum eHtmlState {
+ hsRoot, hsHtmlHead, hsCss, hsJs, hsPageTop, hsPageBottom,
+ hsGroupTop, hsGroupBottom,
+ hsPlainTop, hsPlainItem, hsPlainBottom,
+ hsItemsTop, hsItem, hsItemsBottom
+ };
+ eHtmlState htmlState;
+ const cChannel *current;
+ eStreamType streamType;
+ const char* self;
+ const char* groupTarget;
+
+ std::string StreamTypeMenu();
+ std::string HtmlHead();
+ std::string PageTop();
+ std::string GroupTitle();
+ std::string ItemText();
+ std::string PageBottom();
+ public:
+ virtual std::string HttpHeader() {
+ return cChannelList::HttpHeader()
+ + "Content-type: text/html; charset="
+ + (cCharSetConv::SystemCharacterTable() ? cCharSetConv::SystemCharacterTable() : "UTF-8")
+ + "\r\n";
+ }
+ virtual bool HasNext();
+ virtual std::string Next();
+ cHtmlChannelList(cChannelIterator *Iterator, eStreamType StreamType, const char *Self, const char *GroupTarget);
+ virtual ~cHtmlChannelList();
+};
+
+class cM3uChannelList: public cChannelList
+{
+ private:
+ char *base;
+ enum eM3uState { msFirst, msContinue, msLast };
+ eM3uState m3uState;
+ cCharSetConv m_IConv;
+ public:
+ virtual std::string HttpHeader() { return cChannelList::HttpHeader() + "Content-type: audio/x-mpegurl; charset=UTF-8\r\n"; };
+ virtual bool HasNext();
+ virtual std::string Next();
+ cM3uChannelList(cChannelIterator *Iterator, const char* Base);
+ virtual ~cM3uChannelList();
+};
+
+#endif