diff options
-rw-r--r-- | device.c | 58 | ||||
-rw-r--r-- | device.h | 14 | ||||
-rw-r--r-- | frontend.c | 12 | ||||
-rw-r--r-- | frontend.h | 5 |
4 files changed, 85 insertions, 4 deletions
@@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: device.c,v 1.102 2010-03-13 12:04:29 phintuka Exp $ + * $Id: device.c,v 1.103 2010-03-15 11:43:26 phintuka Exp $ * */ @@ -1698,3 +1698,59 @@ void cXinelibDevice::SetMetaInfo(eMetainfoType Type, const char *Value) } } +// +// Picture-In-Picture +// + +int cXinelibDevice::Pip_Open(void) +{ + for (int i = 0; i < MAX_NUM_PIP; i++) + if (!m_PipPid[i]) { + m_PipPid[i] = i; + ForEach(m_clients, &cXinelibThread::Pip_Config, i, -1, -1, -1, -1); + return i; + } + return -1; +} + +void cXinelibDevice::Pip_Config(int Index, int X, int Y, int W, int H) +{ + if (Index >= 0 && Index < MAX_NUM_PIP) { + if (m_PipPid[Index]) { + ForEach(m_clients, &cXinelibThread::Pip_Config, Index, X, Y, W, H); + } + } +} + +int cXinelibDevice::Pip_Play(int Index, uint8_t *Data, int Length) +{ + if (Index >= 0 && Index < MAX_NUM_PIP) { + if (m_PipPid[Index] && Data && Length > 0) { + + int len = Length; + + if (m_local) + len = m_local->Play(Data, len, eStreamId(sidPipFirst + Index)); + + if (m_server) { + int len2 = m_server->Play(Data, len, eStreamId(sidPipFirst + Index)); + if (!m_local) + return len2; + } + + return len; + } + } + return Length; +} + +void cXinelibDevice::Pip_Close(int Index) +{ + if (Index >= 0 && Index < MAX_NUM_PIP) { + if (m_PipPid[Index]) { + ForEach(m_clients, &cXinelibThread::Pip_Close, Index); + m_PipPid[Index] = 0; + } + } +} + @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: device.h,v 1.55 2010-02-28 07:54:29 phintuka Exp $ + * $Id: device.h,v 1.56 2010-03-15 11:43:26 phintuka Exp $ * */ @@ -37,6 +37,7 @@ typedef enum { #define ttXSubtitleAuto (-1) #define MAX_METAINFO_LEN 63 +#define MAX_NUM_PIP 16 class cXinelibDevice : public cDevice { @@ -264,6 +265,17 @@ class cXinelibDevice : public cDevice void TsBufferClear(void) {} void TsBufferFlush(void) {} #endif + + // Picture-In-Picture + + protected: + uint16_t m_PipPid[MAX_NUM_PIP]; + + public: + int Pip_Open (void); + void Pip_Config (int Index, int X, int Y, int W, int H); + int Pip_Play (int Index, uint8_t *Data, int Length); + void Pip_Close (int Index); }; #endif // __XINELIB_DEVICE_H @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend.c,v 1.84 2010-03-13 12:07:46 phintuka Exp $ + * $Id: frontend.c,v 1.85 2010-03-15 11:43:26 phintuka Exp $ * */ @@ -345,6 +345,16 @@ void cXinelibThread::SetSubtitleTrack(eTrackType Track) Xine_Control(buf); } +void cXinelibThread::Pip_Config(int Index, int X, int Y, int W, int H) +{ + Xine_Control(cString::sprintf("PIP %d %d %d %d %d", Index, X, Y, W, H)); +} + +void cXinelibThread::Pip_Close(int Index) +{ + Xine_Control(cString::sprintf("PIP %d Close", Index)); +} + void cXinelibThread::Clear(void) { TRACEF("cXinelibThread::Clear"); @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: frontend.h,v 1.38 2010-03-13 12:04:29 phintuka Exp $ + * $Id: frontend.h,v 1.39 2010-03-15 11:43:26 phintuka Exp $ * */ @@ -57,6 +57,9 @@ class cXinelibThread : public cThread, public cListObject // Sync(): wait until all pending control messages have been processed by the client virtual void Sync(void) { Xine_Control("SYNC"); }; + void Pip_Config(int Index, int X = -1, int Y = -1, int W = -1, int H = -1); + void Pip_Close(int Index); + protected: int Xine_Control(const char *cmd, const char *p1); int Xine_Control(const char *cmd, int p1); |