diff options
author | Andreas Regel <andreas.regel@powarman.de> | 2004-01-28 19:11:00 +0100 |
---|---|---|
committer | Andreas Regel <andreas.regel@powarman.de> | 2004-01-28 19:11:00 +0100 |
commit | 64fe6b70d0a5b34a80ff458fbf1664018d5c0182 (patch) | |
tree | 4fe036adaf90fef0d0dc910b84dbc11269e40008 /receiver.c | |
parent | 310f5b2a62343d0c9b7624c09efe35828785ef26 (diff) | |
download | vdr-plugin-osdpip-0.0.3.tar.gz vdr-plugin-osdpip-0.0.3.tar.bz2 |
Release version 0.0.3v0.0.3
- new TS->ES remuxer: now using VDR's cRemux for TS->PES and some own code
for PES->ES
- now using libavcodec from ffmpeg instead of mpeg2dec
- frames to decode configurable (I-frames, I-/P-frames, all frames)
- frame dropping configurable
- added new color depths:
- 128 shades greyscale
- 128 colors with variable palette using Wu's quantizer (patch needed)
- changed osd size setting to 6 configurable values
Diffstat (limited to 'receiver.c')
-rw-r--r-- | receiver.c | 39 |
1 files changed, 32 insertions, 7 deletions
@@ -1,15 +1,22 @@ +/* + * OSD Picture in Picture plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + */ + #include "receiver.h" -#include "remux/ts2es.h" +#include "pes.h" #include <vdr/channels.h> +#include <vdr/remux.h> #include <vdr/ringbuffer.h> cOsdPipReceiver::cOsdPipReceiver(const cChannel *Channel, - cRingBufferLinear *ESBuffer): + cRingBufferFrame *ESBuffer): cReceiver(Channel->Ca(), 0, 2, Channel->Vpid(), Channel->Apid1()) { m_TSBuffer = new cRingBufferLinear(MEGABYTE(3), TS_SIZE * 2, true); m_ESBuffer = ESBuffer; - m_Remux = new cTS2ESRemux(Channel->Vpid()); + m_Remux = new cRemux(Channel->Vpid(), Channel->Apid1(), 0, 0, 0, true); m_Active = false; } @@ -37,17 +44,35 @@ void cOsdPipReceiver::Receive(uchar *Data, int Length) { void cOsdPipReceiver::Action(void) { dsyslog("osdpip: receiver thread started (pid=%d)", getpid()); - m_Active = true; + m_Active = true; + + unsigned char NewPictureType = NO_PICTURE; + unsigned char CurPictureType = NO_PICTURE; + unsigned char VideoBuffer[200000]; + int VideoBufferPos = 0; + while (m_Active) { int r; const uchar *b = m_TSBuffer->Get(r); if (b) { int Count = r, Result; - uchar *p = m_Remux->Process(b, Count, Result); + uchar *p = m_Remux->Process(b, Count, Result, &NewPictureType); m_TSBuffer->Del(Count); - if (p) - m_ESBuffer->Put(p, Result); + if (p) { + if (NewPictureType != NO_PICTURE) { + m_ESBuffer->Put(new cFrame(VideoBuffer, VideoBufferPos, ftVideo, CurPictureType)); + CurPictureType = NewPictureType; + VideoBufferPos = 0; + } + cPESPacket Packet(p, Result); + int PayloadLength = 0; + unsigned char * PayloadData = Packet.Payload(PayloadLength); + if ((Packet.StreamId() & 0xF0) == 0xE0) { // video packet + memcpy(&VideoBuffer[VideoBufferPos], PayloadData, PayloadLength); + VideoBufferPos += PayloadLength; + } + } } else usleep(1); // this keeps the CPU load low } |