summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY5
-rw-r--r--Makefile2
-rw-r--r--osdpip.c2
-rw-r--r--receiver.c53
4 files changed, 60 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 7599aeb..6a897c5 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,11 @@
VDR Plugin 'osdpip' Revision History
------------------------------------
+2004-10-26: Version 0.0.7
+
+- adapted to VDR 1.3.13+ (should work with older versions, too)
+
+
2004-08-01: Version 0.0.6
- added channel swapping. It is now possible to swap the currently viewed
channel with the pip channel by pressing the red key.
diff --git a/Makefile b/Makefile
index 1fbbde1..cf23716 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual
### The directory environment:
DVBDIR = ../../../../DVB
-FFMDIR = ../../../../ffmpeg
+FFMDIR = ../../../../ffmpeg-0.4.8
VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
diff --git a/osdpip.c b/osdpip.c
index 076fb26..83bf4b6 100644
--- a/osdpip.c
+++ b/osdpip.c
@@ -19,7 +19,7 @@ extern "C"
#include <vdr/plugin.h>
-static const char *VERSION = "0.0.6";
+static const char *VERSION = "0.0.7";
static const char *DESCRIPTION = "OSD Picture-in-Picture";
static const char *MAINMENUENTRY = "Picture-in-Picture";
diff --git a/receiver.c b/receiver.c
index c813a43..9fe9e8d 100644
--- a/receiver.c
+++ b/receiver.c
@@ -17,6 +17,9 @@ cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel,
cReceiver(Channel->Ca(), 0, 2, Channel->Vpid(), Channel->Apid1())
{
m_TSBuffer = new cRingBufferLinear(MEGABYTE(3), TS_SIZE * 2, true);
+#if VDRVERSNUM >= 10313
+ m_TSBuffer->SetTimeouts(0, 100);
+#endif
m_ESBuffer = ESBuffer;
m_Remux = new cRemux(Channel->Vpid(), Channel->Apid1(), 0, 0, 0, true);
m_Active = false;
@@ -43,7 +46,11 @@ void cOsdPipReceiver::Receive(uchar *Data, int Length)
{
int put = m_TSBuffer->Put(Data, Length);
if (put != Length)
+#if VDRVERSNUM < 10313
esyslog("osdpip: ringbuffer overflow (%d bytes dropped)", Length - put);
+#else
+ m_TSBuffer->ReportOverflow(Length - put);
+#endif
}
void cOsdPipReceiver::Action(void)
@@ -58,6 +65,7 @@ void cOsdPipReceiver::Action(void)
int VideoBufferPos = 0;
while (m_Active) {
+#if VDRVERSNUM < 10313
int r;
const uchar *b = m_TSBuffer->Get(r);
if (b) {
@@ -90,6 +98,51 @@ void cOsdPipReceiver::Action(void)
}
} else
usleep(1); // this keeps the CPU load low
+#else
+ int r;
+ const uchar *b = m_TSBuffer->Get(r);
+ if (b) {
+ int Count = m_Remux->Put(b, r);
+ if (Count)
+ m_TSBuffer->Del(Count);
+ }
+
+ int Result;
+ uchar *p = m_Remux->Get(Result, &NewPictureType);
+ if (p) {
+ if (NewPictureType != NO_PICTURE) {
+ if ((OsdPipSetup.FrameMode == kFrameModeI && CurPictureType == I_FRAME) ||
+ (OsdPipSetup.FrameMode == kFrameModeIP && (CurPictureType == I_FRAME || CurPictureType == P_FRAME)) ||
+ (OsdPipSetup.FrameMode == kFrameModeIPB))
+ {
+ cFrame * frame = new cFrame(VideoBuffer, VideoBufferPos, ftVideo, CurPictureType);
+ if (!m_ESBuffer->Put(frame))
+ {
+ delete frame;
+ }
+ }
+ CurPictureType = NewPictureType;
+ VideoBufferPos = 0;
+ }
+
+ int t = 0;
+ int l = ((p[4] << 8) | p[5]) + 6;
+ while (t + l <= Result) {
+ cPESPacket Packet(p + t, l);
+ int PayloadLength = 0;
+ unsigned char * PayloadData = Packet.Payload(PayloadLength);
+ if ((Packet.StreamId() & 0xF0) == 0xE0) { // video packet
+ memcpy(&VideoBuffer[VideoBufferPos], PayloadData, PayloadLength);
+ VideoBufferPos += PayloadLength;
+ }
+ t += l;
+ if (t >= Result)
+ break;
+ l = ((p[t + 4] << 8) | p[t + 5]) + 6;
+ }
+ m_Remux->Del(t);
+ }
+#endif
}
dsyslog("osdpip: receiver thread ended (pid=%d)", getpid());