From 26a2d985243eed98276f0bc68dc7db6f61d87128 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 18 May 2002 09:24:10 +0200 Subject: [PATCH] Fixed the cutting mechanism to make it re-sync in case a frame is larger than the buffer --- CONTRIBUTORS | 4 ++++ HISTORY | 2 ++ dvbapi.c | 9 ++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index edee769c..ef3d842b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -347,3 +347,7 @@ Rudi Hofer (Rudi.Hofer@cadsoft.de) Gregoire Favre for fixing some function headers to make them compile with gcc 3.x + +Sven Grothklags + for fixing the cutting mechanism to make it re-sync in case a frame is larger + than the buffer diff --git a/HISTORY b/HISTORY index 180a1580..056e0f17 100644 --- a/HISTORY +++ b/HISTORY @@ -1304,3 +1304,5 @@ Video Disk Recorder Revision History started a plugin project, you may want to change this in your Makefile accordingly. - Fixed some function headers to make them compile with gcc 3.x (thanks to Gregoire Favre). +- Fixed the cutting mechanism to make it re-sync in case a frame is larger than the + buffer (thanks to Sven Grothklags). diff --git a/dvbapi.c b/dvbapi.c index 0b14a871..7475a0b6 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.175 2002/05/13 16:29:17 kls Exp $ + * $Id: dvbapi.c 1.176 2002/05/18 09:21:39 kls Exp $ */ #include "dvbapi.h" @@ -1527,11 +1527,14 @@ void cCuttingBuffer::Action(void) CurrentFileNumber = FileNumber; } if (fromFile >= 0) { - Length = ReadFrame(fromFile, buffer, Length, sizeof(buffer)); - if (Length < 0) { + int len = ReadFrame(fromFile, buffer, Length, sizeof(buffer)); + if (len < 0) { error = "ReadFrame"; break; } + if (len != Length) + CurrentFileNumber = 0; // this re-syncs in case the frame was larger than the buffer + Length = len; } else { error = "fromFile";