VDR-1.3.31: moving cutting marks: cDvbPlayer::SkipFrames() is off by one for I frame only recordings (currently radio recordings)

Message ID 43123E88.3070008@gmx.de
State New
Headers

Commit Message

Reinhard Nissl Aug. 28, 2005, 10:45 p.m. UTC
  Hi,

you may have experienced that moving cutting marks in radio recordings 
always changes the frame counter by 2. The attached patch fixes this issue.

Bye.
  

Patch

--- ../vdr-1.3.31-orig/dvbplayer.c	2005-08-14 12:52:45.000000000 +0200
+++ dvbplayer.c	2005-08-29 00:38:32.000000000 +0200
@@ -621,7 +820,10 @@  int cDvbPlayer::SkipFrames(int Frames)
      int Current, Total;
      GetIndex(Current, Total, true);
      int OldCurrent = Current;
-     Current = index->GetNextIFrame(Current + Frames, Frames > 0);
+     // As GetNextIFrame() increments/decrements at least once, the 
+     // destination frame (= Current + Frames) must be adjusted by
+     // -1/+1 respectively.
+     Current = index->GetNextIFrame(Current + Frames + (Frames > 0 ? -1 : 1), Frames > 0);
      return Current >= 0 ? Current : OldCurrent;
      }
   return -1;