#ifndef VDR_MPLAYERCLUSTER_TRANSCEIVER_H
#define VDR_MPLAYERCLUSTER_TRANSCEIVER_H

#include <vdr/thread.h>
#include <vdr/player.h>
#include <vdr/tools.h>

#include "cstring.h"
#include "csocket.h"

class cClusterTransceiver: public cThread {
private:
	bool      m_Active;
	cString   m_Filename;

	cTBSocket m_DataSocket;
	cTBSocket m_CommandSocket;

	char      m_CmdBuffer[KILOBYTE(4)];
	size_t    m_CmdBufferFill;

	cMutex    m_BufferAccess;

protected:
	virtual void Activate(bool On);
	virtual void Action(void);

public:
	cClusterTransceiver(const cString &Filename);
	virtual ~cClusterTransceiver();

	void Stop(void);

	ssize_t Get(char *Buffer, size_t Length);

	eOSState PutRemote(eKeys Key);
};

#endif // VDR_MPLAYERCLUSTER_TRANSCEIVER_H
