summaryrefslogtreecommitdiff
path: root/remux.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-03-20 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-03-20 18:00:00 +0100
commit782b517c51eaa6d2641fe9b6801afdad50be8586 (patch)
tree0d7b59865417ded6a8dfcb22b97ad2e32260982a /remux.c
parent05402c740765e6e0ca2aaf1760c77d9e3d3ed5a5 (diff)
downloadvdr-patch-lnbsharing-782b517c51eaa6d2641fe9b6801afdad50be8586.tar.gz
vdr-patch-lnbsharing-782b517c51eaa6d2641fe9b6801afdad50be8586.tar.bz2
Version 1.3.23vdr-1.3.23
- The setup option "DVB/Video display format" is now only available if "Video format" is set to "4:3" (suggested by Mikko Salo). - Updated the Russian OSD texts (thanks to Vyacheslav Dikonov). - Dropped CA support for the old '-icam' firmware. - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Swedish OSD texts (thanks to Tomas Prybil). - Fixed a few French OSD texts that were in the wrong place. - Improved matching timers to EPG events, especially in case there are several events with the same VPS time. - Fixed cDolbyRepacker to allow recording ProSieben HD broadcasts (thanks to Reinhard Nissl). - Fixed cDvbDevice::SetVideoDisplayFormat() in case of 16:9 (thanks to Marco Schlüßler). - The running status of a VPS event is now only taken seriously if that event has been seen within the last 30 seconds - otherwise recording is done as if no VPS was available. - The day of a timer is now stored as a full date in ISO notation ("YYYY-MM-DD") in 'timers.conf' and for the result of the SVDRP command LSTT (based in parts on a patch by Roman Krenický). - Some fixes to avoid compiler warnings in gcc 4.0 (thanks to Ville Skyttä for reporting these). - Single shot timers are now reliably deleted when they have expired. - Fixed setting the colored button help after deleting a recording in case the next menu entry is a directory (thanks to Steffen Beyer). - Improved falling back to normal recording if the VPS data hasn't been seen for more than 30 seconds. - Added a missing cMutexLock to cRemote::HasKeys() (thanks to Wolfgang Rohdewald). - All log entries regarding timers now contain a short description of the timer.
Diffstat (limited to 'remux.c')
-rw-r--r--remux.c46
1 files changed, 28 insertions, 18 deletions
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 <rnissl@gmx.de>,
* 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 <chk1> <chk2> <frameSize>
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;