diff options
Diffstat (limited to 'frontend_svr.h')
-rw-r--r-- | frontend_svr.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/frontend_svr.h b/frontend_svr.h new file mode 100644 index 00000000..f4caa061 --- /dev/null +++ b/frontend_svr.h @@ -0,0 +1,111 @@ +/* + * frontend_svr.h: server for remote frontends + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: frontend_svr.h,v 1.1 2006-06-03 09:50:54 phintuka Exp $ + * + */ + +#ifndef __XINELIB_FRONTEND_SVR_H +#define __XINELIB_FRONTEND_SVR_H + + +#include "frontend.h" + +//----------------------------- cXinelibServer -------------------------------- + +#define MAXCLIENTS 10 + +class cBackgroundWriter; +class cUdpScheduler; +class cStcFuture; +class cCmdFutures; + +class cXinelibServer : public cXinelibThread +{ + + public: + cXinelibServer(int listen_port); + virtual ~cXinelibServer(); + + // Thread control + virtual void Stop(void); + + protected: + virtual void Action(void); + + public: + // Data transfer + virtual bool Poll(cPoller &Poller, int TimeoutMs); + virtual bool Flush(int TimeoutMs); + virtual void Clear(void); + virtual int Play_PES(const uchar *buf, int len); + virtual void OsdCmd(void *cmd); + virtual int64_t GetSTC(); + + // Image grabbing + virtual uchar *GrabImage(int &Size, bool Jpeg, int Quality, + int SizeX, int SizeY); + // Playback files + virtual int PlayFileCtrl(const char *Cmd); + virtual bool EndOfStreamReached(void); + + // Configuration + virtual bool Listen(int port); + +protected: + // Playback control + virtual void Xine_Sync(void); + virtual int Xine_Control(const char *cmd); + +protected: + + // Handling of messages from client(s) + + void Handle_Discovery_Broadcast(void); + void Handle_ClientConnected(int fd); + + void Read_Control(int cli); + void Handle_Control(int cli, char *cmd); + + void Handle_Control_PIPE(int cli, char *arg); + void Handle_Control_RTP(int cli, char *arg); + void Handle_Control_UDP(int cli, char *arg); + void Handle_Control_DATA(int cli, char *arg); + void Handle_Control_KEY(int cli, char *arg); + void Handle_Control_UDP_RESEND(int cli, char *arg); + void Handle_Control_CONFIG(int cli); + + void CloseConnection(int cli); + +protected: + + // Data + + int m_Port; + + int fd_listen; + int fd_multicast; + int fd_discovery; + int fd_control[MAXCLIENTS]; + int fd_data[MAXCLIENTS]; + + char m_CtrlBuf[MAXCLIENTS][90+1]; + int m_CtrlBufPos[MAXCLIENTS]; + + bool m_bUdp[MAXCLIENTS]; + bool m_bMulticast[MAXCLIENTS]; + bool m_bConfigOk[MAXCLIENTS]; + int m_iMulticastMask; // bit [cli] is 1 or 0. 1 == multicast in use. + int m_iUdpFlowMask; // bit [cli] is 1 or 0. 1 == buffer full. + + cBackgroundWriter *m_Writer[MAXCLIENTS]; + cUdpScheduler *m_Scheduler; + bool m_Master; + cStcFuture *m_StcFuture; + cCmdFutures *m_Futures; +}; + +#endif // __XINELIB_FRONTEND_SVR_H |