summaryrefslogtreecommitdiff
path: root/tsworker.h
blob: 45e13abab2f8151e0d04c25a7057ee29bc21fc04 (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
/*
 * tsworker.h: TS worker thread 
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef _TSWORKER__H
#define _TSWORKER__H

#include <vdr/thread.h>

#include "tools/socket.h"
#include "streamdevice.h"
#include "remote.h"
#include "netosd.h"
#include "ffnetdev.h"


// --- cTSWorker -------------------------------------------------------------

class cTSWorker : public cThread {
private:
	bool m_Active;
	bool have_Streamclient;
	bool close_Streamclient_request;
	static cTSWorker *m_Instance;
	cStreamDevice *m_StreamDevice;
	cTBSocket *m_StreamClient;
	int TSPort;
	int origPrimaryDevice;
	cPluginFFNetDev *m_pPlugin;	

protected:
	virtual void Action(void);
	void Stop(void);
public:
	cTSWorker(void);
	virtual ~cTSWorker();

	static void Init(cStreamDevice*, int, cPluginFFNetDev*);
	static void Exit(void);
	static bool Active(void);
	
	static bool HaveStreamClient(void);
	static void CloseStreamClient(void);
};

inline bool cTSWorker::Active(void) {
    return m_Instance && (m_Instance->have_Streamclient==true);
}

inline bool cTSWorker::HaveStreamClient(void) {
	return m_Instance->have_Streamclient;
}
#endif