summaryrefslogtreecommitdiff
path: root/cutter.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-12-02 14:33:06 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-12-02 14:33:06 +0100
commit441bf300321d5ae6c56a16bf59e88888981f4fa0 (patch)
tree8684f86dcc9f26a4a6d9cc7f9b660e2d7378553d /cutter.c
parenta23a13873f1c209312fcfde5254e3ef24ee165fd (diff)
downloadvdr-441bf300321d5ae6c56a16bf59e88888981f4fa0.tar.gz
vdr-441bf300321d5ae6c56a16bf59e88888981f4fa0.tar.bz2
Simplified calculating the PTS offset in cPtsFixer::Fix() and fixed the overflow handling of PCR values
Diffstat (limited to 'cutter.c')
-rw-r--r--cutter.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/cutter.c b/cutter.c
index 81df1869..300eef43 100644
--- a/cutter.c
+++ b/cutter.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: cutter.c 2.20 2012/11/29 15:30:01 kls Exp $
+ * $Id: cutter.c 2.21 2012/12/02 14:30:55 kls Exp $
*/
#include "cutter.h"
@@ -192,14 +192,8 @@ void cPtsFixer::Fix(uchar *Data, int Length, bool CutIn)
// Determine the PTS offset at the beginning of each sequence (except the first one):
if (CutIn && lastPts >= 0) {
int64_t Pts = TsGetPts(Data, Length);
- if (Pts >= 0) {
- // offset is calculated so that Pts + offset results in lastPts + delta:
- offset = Pts - PtsAdd(lastPts, delta);
- if (offset <= 0)
- offset = -offset;
- else
- offset = MAX33BIT + 1 - offset;
- }
+ if (Pts >= 0)
+ offset = (lastPts + delta - Pts) & MAX33BIT; // offset is calculated so that Pts + offset results in lastPts + delta
fixCounters = true;
}
// Keep track of the highest video PTS:
@@ -262,7 +256,7 @@ void cPtsFixer::Fix(uchar *Data, int Length, bool CutIn)
int64_t Pcr = TsGetPcr(p);
if (Pcr >= 0) {
int64_t NewPcr = Pcr + offset * PCRFACTOR;
- if (NewPcr >= MAX27MHZ)
+ if (NewPcr > MAX27MHZ)
NewPcr -= MAX27MHZ + 1;
TsSetPcr(p, NewPcr);
}