summaryrefslogtreecommitdiff
path: root/receiver/livereceiver.h
blob: 6b0461998e7666b8ffa0c36bc508f05a082a0b44 (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
/* 
 * File:   livereceiver.h
 * Author: savop
 *
 * Created on 4. Juni 2009, 13:28
 */

#ifndef _LIVERECEIVER_H
#define	_LIVERECEIVER_H

#include "../common.h"
#include "filehandle.h"
#include <vdr/thread.h>
#include <vdr/receiver.h>
#include <vdr/ringbuffer.h>

#define RECEIVER_WAIT_ON_NODATA         50 // 50 ms
#define RECEIVER_WAIT_ON_NODATA_TIMEOUT 1000 * 2 // 2s

class cLiveReceiver : public cReceiver, public cThread, public cFileHandle {
public:
    static cLiveReceiver* newInstance(cChannel *Channel, int Priority);
    virtual ~cLiveReceiver(void);
    virtual void open(UpnpOpenFileMode mode);
    virtual int read(char* buf, size_t buflen);
    virtual int write(char* buf, size_t buflen);
    virtual int seek(off_t offset, int whence);
    virtual void close();
protected:
    virtual void Receive(uchar *Data, int Length);
    virtual void Activate(bool On);
    virtual void Action(void);
private:
    cLiveReceiver(cChannel *Channel, cDevice *Device);
    cDevice  *mDevice;
    cChannel *mChannel;
    cRingBufferLinear *mLiveBuffer;
    cRingBufferLinear *mOutputBuffer;
    cFrameDetector *mFrameDetector;
    cPatPmtGenerator mPatPmtGenerator;
};

#endif	/* _LIVERECEIVER_H */