diff options
Diffstat (limited to 'receiver.c')
-rw-r--r-- | receiver.c | 31 |
1 files changed, 13 insertions, 18 deletions
@@ -12,14 +12,12 @@ #include <vdr/remux.h> #include <vdr/ringbuffer.h> -cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel, +cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel, cRingBufferFrame *ESBuffer): #if VDRVERSNUM >= 10319 - cReceiver(Channel->Ca(), 0, Channel->Vpid(), Channel->Apids()) -#elif VDRVERSNUM >= 10318 - cReceiver(Channel->Ca(), 0, 2, Channel->Vpid(), Channel->Apid(0)) + cReceiver(Channel->Ca(), 0, Channel->Vpid()) #else - cReceiver(Channel->Ca(), 0, 2, Channel->Vpid(), Channel->Apid1()) + cReceiver(Channel->Ca(), 0, 1, Channel->Vpid()) #endif { m_TSBuffer = new cRingBufferLinear(MEGABYTE(3), TS_SIZE * 2, true); @@ -28,11 +26,9 @@ cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel, #endif m_ESBuffer = ESBuffer; #if VDRVERSNUM >= 10319 - m_Remux = new cRemux(Channel->Vpid(), Channel->Apids(), 0, 0, true); -#elif VDRVERSNUM >= 10318 - m_Remux = new cRemux(Channel->Vpid(), Channel->Apid(0), 0, 0, 0, true); + m_Remux = new cRemux(Channel->Vpid(), NULL, NULL, NULL, true); #else - m_Remux = new cRemux(Channel->Vpid(), Channel->Apid1(), 0, 0, 0, true); + m_Remux = new cRemux(Channel->Vpid(), 0, 0, 0, 0, true); #endif m_Active = false; } @@ -137,22 +133,21 @@ void cOsdPipReceiver::Action(void) VideoBufferPos = 0; } - int t = 0; - int l = ((p[4] << 8) | p[5]) + 6; - while (t + l <= Result) { - cPESPacket Packet(p + t, l); + int pos = 0; + while (pos + 6 < Result) + { + cPESPacket Packet(p + pos, Result - pos); + if (pos + 6 + Packet.PacketLength() > Result) + break; 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; + pos += Packet.PacketLength() + 6; } - m_Remux->Del(t); + m_Remux->Del(pos); } #endif } |