summaryrefslogtreecommitdiff
path: root/remux.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-03-20 13:18:15 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-03-20 13:18:15 +0100
commitfa512884b9327480fcb70749fb26ff960aa626ca (patch)
tree0a166481bb7ca5920dc2118446fe4bbbec95e649 /remux.c
parent5d17dc3fdc49ee2f2665824133cbf35fdf6bb13c (diff)
downloadvdr-fa512884b9327480fcb70749fb26ff960aa626ca.tar.gz
vdr-fa512884b9327480fcb70749fb26ff960aa626ca.tar.bz2
Additional fixes to cDolbyRepacker
Diffstat (limited to 'remux.c')
-rw-r--r--remux.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/remux.c b/remux.c
index 2000fc86..135fa797 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.32 2005/03/13 12:02:15 kls Exp $
+ * $Id: remux.c 1.33 2005/03/20 13:18:15 kls Exp $
*/
#include "remux.h"
@@ -59,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:
@@ -105,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)
@@ -327,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;