blob: 14a5c665171f8213cad9b198eff285fb3140da9a (
plain)
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
|
/*
* 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
|