From 782b517c51eaa6d2641fe9b6801afdad50be8586 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 20 Mar 2005 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.3.23=20-=20The=20setup=20option=20"DVB/Vide?= =?UTF-8?q?o=20display=20format"=20is=20now=20only=20available=20if=20"Vid?= =?UTF-8?q?eo=20format"=20=20=20is=20set=20to=20"4:3"=20(suggested=20by=20?= =?UTF-8?q?Mikko=20Salo).=20-=20Updated=20the=20Russian=20OSD=20texts=20(t?= =?UTF-8?q?hanks=20to=20Vyacheslav=20Dikonov).=20-=20Dropped=20CA=20suppor?= =?UTF-8?q?t=20for=20the=20old=20'-icam'=20firmware.=20-=20Updated=20the?= =?UTF-8?q?=20Finnish=20OSD=20texts=20(thanks=20to=20Rolf=20Ahrenberg).=20?= =?UTF-8?q?-=20Updated=20the=20Swedish=20OSD=20texts=20(thanks=20to=20Toma?= =?UTF-8?q?s=20Prybil).=20-=20Fixed=20a=20few=20French=20OSD=20texts=20tha?= =?UTF-8?q?t=20were=20in=20the=20wrong=20place.=20-=20Improved=20matching?= =?UTF-8?q?=20timers=20to=20EPG=20events,=20especially=20in=20case=20there?= =?UTF-8?q?=20are=20several=20events=20=20=20with=20the=20same=20VPS=20tim?= =?UTF-8?q?e.=20-=20Fixed=20cDolbyRepacker=20to=20allow=20recording=20ProS?= =?UTF-8?q?ieben=20HD=20broadcasts=20(thanks=20to=20Reinhard=20=20=20Nissl?= =?UTF-8?q?).=20-=20Fixed=20cDvbDevice::SetVideoDisplayFormat()=20in=20cas?= =?UTF-8?q?e=20of=2016:9=20(thanks=20to=20Marco=20Schl=C3=BC=C3=9Fler).=20?= =?UTF-8?q?-=20The=20running=20status=20of=20a=20VPS=20event=20is=20now=20?= =?UTF-8?q?only=20taken=20seriously=20if=20that=20event=20has=20been=20=20?= =?UTF-8?q?=20seen=20within=20the=20last=2030=20seconds=20-=20otherwise=20?= =?UTF-8?q?recording=20is=20done=20as=20if=20no=20VPS=20was=20=20=20availa?= =?UTF-8?q?ble.=20-=20The=20day=20of=20a=20timer=20is=20now=20stored=20as?= =?UTF-8?q?=20a=20full=20date=20in=20ISO=20notation=20("YYYY-MM-DD")=20in?= =?UTF-8?q?=20=20=20'timers.conf'=20and=20for=20the=20result=20of=20the=20?= =?UTF-8?q?SVDRP=20command=20LSTT=20(based=20in=20parts=20on=20a=20=20=20p?= =?UTF-8?q?atch=20by=20Roman=20Krenick=C3=BD).=20-=20Some=20fixes=20to=20a?= =?UTF-8?q?void=20compiler=20warnings=20in=20gcc=204.0=20(thanks=20to=20Vi?= =?UTF-8?q?lle=20Skytt=C3=A4=20for=20reporting=20=20=20these).=20-=20Singl?= =?UTF-8?q?e=20shot=20timers=20are=20now=20reliably=20deleted=20when=20the?= =?UTF-8?q?y=20have=20expired.=20-=20Fixed=20setting=20the=20colored=20but?= =?UTF-8?q?ton=20help=20after=20deleting=20a=20recording=20in=20case=20the?= =?UTF-8?q?=20next=20=20=20menu=20entry=20is=20a=20directory=20(thanks=20t?= =?UTF-8?q?o=20Steffen=20Beyer).=20-=20Improved=20falling=20back=20to=20no?= =?UTF-8?q?rmal=20recording=20if=20the=20VPS=20data=20hasn't=20been=20seen?= =?UTF-8?q?=20for=20more=20=20=20than=2030=20seconds.=20-=20Added=20a=20mi?= =?UTF-8?q?ssing=20cMutexLock=20to=20cRemote::HasKeys()=20(thanks=20to=20W?= =?UTF-8?q?olfgang=20Rohdewald).=20-=20All=20log=20entries=20regarding=20t?= =?UTF-8?q?imers=20now=20contain=20a=20short=20description=20of=20the=20ti?= =?UTF-8?q?mer.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- remux.c | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'remux.c') diff --git a/remux.c b/remux.c index ca65a61..135fa79 100644 --- a/remux.c +++ b/remux.c @@ -11,7 +11,7 @@ * The cDolbyRepacker code was originally written by Reinhard Nissl , * and adapted to the VDR coding style by Klaus.Schmidinger@cadsoft.de. * - * $Id: remux.c 1.31 2005/02/13 14:36:23 kls Exp $ + * $Id: remux.c 1.33 2005/03/20 13:18:15 kls Exp $ */ #include "remux.h" @@ -46,6 +46,8 @@ private: int fragmentTodo; uchar pesHeader[6 + 3 + 255 + 4 + 4]; int pesHeaderLen; + uchar pesHeaderBackup[6 + 3 + 255]; + int pesHeaderBackupLen; uchar chk1; uchar chk2; int ac3todo; @@ -57,8 +59,8 @@ private: get_length, output_packet } state; - void ResetPesHeader(void); - void AppendSubStreamID(void); + void ResetPesHeader(bool ContinuationFrame = false); + void AppendSubStreamID(bool ContinuationFrame = false); bool FinishRemainder(cRingBufferLinear *ResultBuffer, const uchar *const Data, const int Todo, int &Done, int &Bite); bool StartNewPacket(cRingBufferLinear *ResultBuffer, const uchar *const Data, const int Todo, int &Done, int &Bite); public: @@ -103,23 +105,26 @@ cDolbyRepacker::cDolbyRepacker(void) Reset(); } -void cDolbyRepacker::AppendSubStreamID(void) +void cDolbyRepacker::AppendSubStreamID(bool ContinuationFrame) { if (subStreamId) { pesHeader[pesHeaderLen++] = subStreamId; + // number of ac3 frames "starting" in this packet (1 by design). + pesHeader[pesHeaderLen++] = 0x01; + // offset to start of first ac3 frame (0 means "no ac3 frame starting" + // so 1 (by design) addresses the first byte after the next two bytes). pesHeader[pesHeaderLen++] = 0x00; - pesHeader[pesHeaderLen++] = 0x00; - pesHeader[pesHeaderLen++] = 0x00; + pesHeader[pesHeaderLen++] = (ContinuationFrame ? 0x00 : 0x01); } } -void cDolbyRepacker::ResetPesHeader(void) +void cDolbyRepacker::ResetPesHeader(bool ContinuationFrame) { pesHeader[6] = 0x80; pesHeader[7] = 0x00; pesHeader[8] = 0x00; pesHeaderLen = 9; - AppendSubStreamID(); + AppendSubStreamID(ContinuationFrame); } void cDolbyRepacker::Reset(void) @@ -131,6 +136,7 @@ void cDolbyRepacker::Reset(void) chk2 = 0; fragmentLen = 0; fragmentTodo = 0; + pesHeaderBackupLen = 0; } bool cDolbyRepacker::FinishRemainder(cRingBufferLinear *ResultBuffer, const uchar *const Data, const int Todo, int &Done, int &Bite) @@ -229,12 +235,17 @@ int cDolbyRepacker::Put(cRingBufferLinear *ResultBuffer, const uchar *Data, int if ((Data[6] & 0xC0) != 0x80) return 0; + // backup PES header + if (Data[6] != 0x80 || Data[7] != 0x00 || Data[8] != 0x00) { + pesHeaderBackupLen = 6 + 3 + Data[8]; + memcpy(pesHeaderBackup, Data, pesHeaderBackupLen); + } + // skip PES header int done = 6 + 3 + Data[8]; int todo = Count - done; const uchar *data = Data + done; - bool headerCopied = false; - + // look for 0x0B 0x77 while (todo > 0) { switch (state) { @@ -242,10 +253,10 @@ int cDolbyRepacker::Put(cRingBufferLinear *ResultBuffer, const uchar *Data, int if (*data == 0x0B) { ++(int &)state; // copy header information once for later use - if (!headerCopied) { - headerCopied = true; - pesHeaderLen = 6 + 3 + Data[8]; - memcpy(pesHeader, Data, pesHeaderLen); + if (pesHeaderBackupLen > 0) { + pesHeaderLen = pesHeaderBackupLen; + pesHeaderBackupLen = 0; + memcpy(pesHeader, pesHeaderBackup, pesHeaderLen); AppendSubStreamID(); } } @@ -279,9 +290,8 @@ int cDolbyRepacker::Put(cRingBufferLinear *ResultBuffer, const uchar *Data, int ac3todo = 2 * frameSizes[*data]; // frameSizeCode was invalid => restart searching if (ac3todo <= 0) { - // reset PES header instead of using/copying a wrong one + // reset PES header instead of using a wrong one ResetPesHeader(); - headerCopied = true; if (chk1 == 0x0B) { if (chk2 == 0x77) { state = store_chk1; @@ -320,8 +330,8 @@ int cDolbyRepacker::Put(cRingBufferLinear *ResultBuffer, const uchar *Data, int // start a new packet if (!StartNewPacket(ResultBuffer, data, todo, done, bite)) return done; - // prepare for next packet - ResetPesHeader(); + // prepare for next (continuation) packet + ResetPesHeader(state == output_packet); } data += bite; done += bite; -- cgit v1.2.3