summaryrefslogtreecommitdiff
path: root/src/vdr-plugin/download.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vdr-plugin/download.h')
-rw-r--r--src/vdr-plugin/download.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/vdr-plugin/download.h b/src/vdr-plugin/download.h
new file mode 100644
index 0000000..14a5c66
--- /dev/null
+++ b/src/vdr-plugin/download.h
@@ -0,0 +1,63 @@
+/*
+ * download.h: Web video plugin for the Video Disk Recorder
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ * $Id$
+ */
+
+#ifndef __WEBVIDEO_DOWNLOAD_H
+#define __WEBVIDEO_DOWNLOAD_H
+
+#include <sys/time.h>
+#include <vdr/thread.h>
+#include <libwebvi.h>
+#include "request.h"
+
+// --- cWebviThread --------------------------------------------------------
+
+class cWebviThread : public cThread {
+private:
+ WebviCtx webvi;
+ cMutex requestMutex;
+ cRequestVector activeRequestList;
+ cRequestVector newRequestList;
+ cRequestVector finishedRequestList;
+ int newreqread, newreqwrite;
+ bool timerActive;
+ struct timeval timer;
+
+ void MoveToFinishedList(cMenuRequest *req);
+ void ActivateNewRequest();
+ void StopFinishedRequests();
+
+protected:
+ void Action(void);
+ static void UpdateTimeout(long timeout, void *data);
+
+public:
+ cWebviThread();
+ ~cWebviThread();
+
+ static cWebviThread &Instance();
+
+ // Stop the thread
+ void Stop();
+ // Set path to the site templates. Should be set before
+ // Start()ing the thread.
+ void SetTemplatePath(const char *path);
+ // Start executing req. The control of req is handed over to the
+ // downloader thread. The main thread should not access req until
+ // the request is handed back to the main thread by
+ // GetFinishedRequest().
+ void AddRequest(cMenuRequest *req);
+ // Return a request that has finished or NULL if no requests are
+ // finished. The ownership of the returned cMenuRequest object
+ // is again assigned to the main thread. The main thread should poll
+ // this function periodically.
+ cMenuRequest *GetFinishedRequest();
+ // Returns the number download requests currectly active
+ int GetUnfinishedCount();
+};
+
+#endif