2004-12-30 23:43:55 +01:00
|
|
|
/*
|
2005-03-12 13:54:19 +01:00
|
|
|
* $Id: streamer.h,v 1.7 2005/03/12 12:54:19 lordjaxom Exp $
|
2004-12-30 23:43:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VDR_STREAMDEV_STREAMER_H
|
|
|
|
#define VDR_STREAMDEV_STREAMER_H
|
|
|
|
|
|
|
|
#include <vdr/thread.h>
|
|
|
|
#include <vdr/ringbuffer.h>
|
|
|
|
#include <vdr/tools.h>
|
|
|
|
|
|
|
|
class cTBSocket;
|
2005-02-08 20:54:52 +01:00
|
|
|
class cStreamdevStreamer;
|
|
|
|
|
|
|
|
#define STREAMERBUFSIZE MEGABYTE(4)
|
2005-02-11 17:44:14 +01:00
|
|
|
#define WRITERBUFSIZE KILOBYTE(256)
|
2005-02-08 20:54:52 +01:00
|
|
|
|
2005-02-10 23:24:26 +01:00
|
|
|
// --- cStreamdevWriter -------------------------------------------------------
|
|
|
|
|
2005-02-08 20:54:52 +01:00
|
|
|
class cStreamdevWriter: public cThread {
|
|
|
|
private:
|
|
|
|
cStreamdevStreamer *m_Streamer;
|
|
|
|
cTBSocket *m_Socket;
|
|
|
|
bool m_Active;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void Action(void);
|
|
|
|
|
|
|
|
public:
|
|
|
|
cStreamdevWriter(cTBSocket *Socket, cStreamdevStreamer *Streamer);
|
|
|
|
virtual ~cStreamdevWriter();
|
|
|
|
};
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2005-02-10 23:24:26 +01:00
|
|
|
// --- cStreamdevStreamer -----------------------------------------------------
|
|
|
|
|
2004-12-30 23:43:55 +01:00
|
|
|
class cStreamdevStreamer: public cThread {
|
|
|
|
private:
|
|
|
|
bool m_Active;
|
2005-02-11 18:02:22 +01:00
|
|
|
bool m_Running;
|
2005-02-08 20:54:52 +01:00
|
|
|
cStreamdevWriter *m_Writer;
|
2004-12-30 23:43:55 +01:00
|
|
|
cRingBufferLinear *m_RingBuffer;
|
2005-02-08 20:54:52 +01:00
|
|
|
cRingBufferLinear *m_SendBuffer;
|
2004-12-30 23:43:55 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void Action(void);
|
|
|
|
|
2005-02-11 18:02:22 +01:00
|
|
|
bool IsRunning(void) const { return m_Running; }
|
|
|
|
|
2004-12-30 23:43:55 +01:00
|
|
|
public:
|
|
|
|
cStreamdevStreamer(const char *Name);
|
|
|
|
virtual ~cStreamdevStreamer();
|
|
|
|
|
|
|
|
virtual void Start(cTBSocket *Socket);
|
|
|
|
virtual void Stop(void);
|
|
|
|
|
2005-02-08 20:54:52 +01:00
|
|
|
void Activate(bool On);
|
|
|
|
int Receive(uchar *Data, int Length) { return m_RingBuffer->Put(Data, Length); }
|
2005-02-08 14:59:16 +01:00
|
|
|
void ReportOverflow(int Bytes) { m_RingBuffer->ReportOverflow(Bytes); }
|
2005-02-08 20:54:52 +01:00
|
|
|
|
2005-02-10 23:24:26 +01:00
|
|
|
virtual int Put(const uchar *Data, int Count) { return m_SendBuffer->Put(Data, Count); }
|
|
|
|
virtual uchar *Get(int &Count) { return m_SendBuffer->Get(Count); }
|
|
|
|
virtual void Del(int Count) { m_SendBuffer->Del(Count); }
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2005-03-12 13:54:19 +01:00
|
|
|
virtual void Detach(void) {}
|
|
|
|
virtual void Attach(void) {}
|
2004-12-30 23:43:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VDR_STREAMDEV_STREAMER_H
|
|
|
|
|