summaryrefslogtreecommitdiff
path: root/server/livestreamer.h
blob: 7682206c27e3761b1f627f88e8bb67069fb1ab42 (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
64
65
66
67
68
69
70
#ifndef VDR_STREAMDEV_LIVESTREAMER_H
#define VDR_STREAMDEV_LIVESTREAMER_H

#include <vdr/config.h>
#include <vdr/receiver.h>

#include "server/streamer.h"
#include "server/livefilter.h"
#include "common.h"

#if MAXRECEIVEPIDS < 16
#	error Too few receiver pids allowed! Please contact sascha@akv-soft.de!
#endif

class cTSRemux;

class cStreamdevLiveReceiver: public cReceiver {
	friend class cStreamdevLiveStreamer;

private:
	cStreamdevLiveStreamer *m_Streamer;

protected:
	virtual void Receive(uchar *Data, int Length);

public:
	cStreamdevLiveReceiver(cStreamdevLiveStreamer *Streamer, int Priority, int Ca,
			int Pid1  = 0, int Pid2  = 0, int Pid3  = 0, int Pid4  = 0,
			int Pid5  = 0, int Pid6  = 0, int Pid7  = 0, int Pid8  = 0,
			int Pid9  = 0, int Pid10 = 0, int Pid11 = 0, int Pid12 = 0,
			int Pid13 = 0, int Pid14 = 0, int Pid15 = 0, int Pid16 = 0);
	virtual ~cStreamdevLiveReceiver();
};

class cStreamdevLiveStreamer: public cStreamdevStreamer {
private:
	int                     m_Priority;
	int                     m_Pids[MAXRECEIVEPIDS];
	const cChannel         *m_Channel;
	cDevice                *m_Device;
	cStreamdevLiveReceiver *m_Receiver;
	cTSRemux               *m_Remux;
	uchar                  *m_Buffer;
	int                     m_Sequence;
#if VDRVERSNUM >= 10300
	cStreamdevLiveFilter   *m_Filter;
#endif

protected:
	virtual uchar *Process(const uchar *Data, int &Count, int &Result);

public:
	cStreamdevLiveStreamer(int Priority);
	virtual ~cStreamdevLiveStreamer();

	void SetDevice(cDevice *Device) { m_Device = Device; }
	bool SetPid(int Pid, bool On);
	bool SetChannel(const cChannel *Channel, int StreamType, bool StreamPIDS);
	bool SetFilter(u_short Pid, u_char Tid, u_char Mask, bool On);
	
	virtual void Detach(void);
	virtual void Attach(void);

	virtual void Start(cTBSocket *Socket);
	
	// Statistical purposes:
	virtual cTBString Report(void);
};

#endif // VDR_STREAMDEV_LIVESTREAMER_H