summaryrefslogtreecommitdiff
path: root/responsememblk.h
diff options
context:
space:
mode:
authorthlo <smarttv640@gmail.com>2013-04-21 16:20:52 +0200
committerthlo <t.lohmar@gmx.de>2013-04-21 16:20:52 +0200
commit037e0f4ecf781aa8a5819ec036d3cfbb852768a7 (patch)
tree97d66165ef8bde60e9008026222742f2447d465a /responsememblk.h
parent02b651b454c16fc6af688c90839543db2e5e518d (diff)
downloadvdr-plugin-smarttvweb-037e0f4ecf781aa8a5819ec036d3cfbb852768a7.tar.gz
vdr-plugin-smarttvweb-037e0f4ecf781aa8a5819ec036d3cfbb852768a7.tar.bz2
Plugin code refactoring.
Diffstat (limited to 'responsememblk.h')
-rw-r--r--responsememblk.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/responsememblk.h b/responsememblk.h
new file mode 100644
index 0000000..84491e2
--- /dev/null
+++ b/responsememblk.h
@@ -0,0 +1,92 @@
+/*
+ * responsememblk.h: VDR on Smart TV plugin
+ *
+ * Copyright (C) 2012, 2013 T. Lohmar
+ *
+ * This program 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 program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ */
+
+#ifndef __RESPONSE_MEMBLK_H__
+#define __RESPONSE_MEMBLK_H__
+
+#include <cstdio>
+#include <sys/stat.h>
+#include <string>
+#include <vector>
+#include <sys/time.h>
+#include "responsebase.h"
+
+using namespace std;
+
+struct sFileEntry {
+ string sName;
+ string sPath;
+ int sStart;
+
+sFileEntry(string n, string l, int s) : sName(n), sPath(l), sStart(s) {
+ };
+};
+
+
+class cResumeEntry;
+class cHttpResource;
+
+// create the complete response for the file request
+// info on range request should be provided.
+class cResponseMemBlk : public cResponseBase {
+ public:
+ cResponseMemBlk(cHttpResource* );
+ virtual ~cResponseMemBlk(); // same as sendFile
+
+ int fillDataBlk();
+
+ int sendRecordingsXml (struct stat *statbuf);
+ int sendChannelsXml (struct stat *statbuf);
+ int sendResumeXml ();
+ int sendVdrStatusXml (struct stat *statbuf);
+ int sendYtBookmarkletJs();
+ int sendBmlInstHtml();
+
+ int sendEpgXml (struct stat *statbuf);
+ int sendUrlsXml ();
+ int sendMediaXml (struct stat *statbuf);
+ int sendManifest (struct stat *statbuf, bool is_hls = true);
+
+ void receiveClientInfo();
+
+ int receiveResume();
+ int receiveDelRecReq();
+
+ int receiveYtUrl();
+
+ void writeM3U8(double duration, int bitrate, float seg_dur, int end_seg);
+ void writeMPD(double duration, int bitrate, float seg_dur, int end_seg);
+
+ int parseResume(cResumeEntry &entry, string &id);
+ int parseFiles(vector<sFileEntry> *entries, string prefix, string dir_base, string dir_name, struct stat *statbuf);
+ int sendDir(struct stat *statbuf);
+ int writeXmlItem(string title, string link, string programme, string desc, string guid, int no, time_t start, int dur, double fps, int is_pes, int is_new);
+ uint64_t getVdrFileSize();
+
+ private:
+ string *mResponseMessage;
+ int mResponseMessagePos;
+
+ timeval mResponseStart;
+};
+
+#endif