summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device.c58
-rw-r--r--device.h14
-rw-r--r--frontend.c12
-rw-r--r--frontend.h5
4 files changed, 85 insertions, 4 deletions
diff --git a/device.c b/device.c
index f947d26d..e58315af 100644
--- a/device.c
+++ b/device.c
@@ -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;
+ }
+ }
+}
+
diff --git a/device.h b/device.h
index 94b3bf6c..34a16d85 100644
--- a/device.h
+++ b/device.h
@@ -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
diff --git a/frontend.c b/frontend.c
index bd0c6414..72f25ad6 100644
--- a/frontend.c
+++ b/frontend.c
@@ -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");
diff --git a/frontend.h b/frontend.h
index 38094dfa..cba8b840 100644
--- a/frontend.h
+++ b/frontend.h
@@ -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);