mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Improved fast forwarding to the end of a timeshift recording
This commit is contained in:
		
							
								
								
									
										3
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								HISTORY
									
									
									
									
									
								
							@@ -7010,7 +7010,7 @@ Video Disk Recorder Revision History
 | 
				
			|||||||
    which is higher than any normal table id that is broadcast in the EIT data.
 | 
					    which is higher than any normal table id that is broadcast in the EIT data.
 | 
				
			||||||
  See PLUGINS.html, section "Electronic Program Guide" for more information.
 | 
					  See PLUGINS.html, section "Electronic Program Guide" for more information.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2012-03-11: Version 1.7.27
 | 
					2012-03-12: Version 1.7.27
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
 | 
					- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
 | 
				
			||||||
- Changed the Green button in the "Edit timer" menu from "Once" to "Single"
 | 
					- Changed the Green button in the "Edit timer" menu from "Once" to "Single"
 | 
				
			||||||
@@ -7032,3 +7032,4 @@ Video Disk Recorder Revision History
 | 
				
			|||||||
  Plugin authors may want to change -Woverloaded-virtual to -Werror=overloaded-virtual
 | 
					  Plugin authors may want to change -Woverloaded-virtual to -Werror=overloaded-virtual
 | 
				
			||||||
  in their Makefiles.
 | 
					  in their Makefiles.
 | 
				
			||||||
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
 | 
					- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
 | 
				
			||||||
 | 
					- Improved fast forwarding to the end of a timeshift recording.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										22
									
								
								dvbplayer.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								dvbplayer.c
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
				
			|||||||
 * See the main source file 'vdr.c' for copyright information and
 | 
					 * See the main source file 'vdr.c' for copyright information and
 | 
				
			||||||
 * how to reach the author.
 | 
					 * how to reach the author.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * $Id: dvbplayer.c 2.25 2012/02/21 11:34:04 kls Exp $
 | 
					 * $Id: dvbplayer.c 2.26 2012/03/12 14:36:55 kls Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "dvbplayer.h"
 | 
					#include "dvbplayer.h"
 | 
				
			||||||
@@ -441,9 +441,9 @@ void cDvbPlayer::Action(void)
 | 
				
			|||||||
                         int NewIndex = readIndex + d;
 | 
					                         int NewIndex = readIndex + d;
 | 
				
			||||||
                         if (NewIndex <= 0 && readIndex > 0)
 | 
					                         if (NewIndex <= 0 && readIndex > 0)
 | 
				
			||||||
                            NewIndex = 1; // make sure the very first frame is delivered
 | 
					                            NewIndex = 1; // make sure the very first frame is delivered
 | 
				
			||||||
                         NewIndex = index->GetNextIFrame(NewIndex, playDir == pdForward, &FileNumber, &FileOffset, &Length, TimeShiftMode);
 | 
					                         NewIndex = index->GetNextIFrame(NewIndex, playDir == pdForward, &FileNumber, &FileOffset, &Length);
 | 
				
			||||||
                         if (NewIndex < 0 && TimeShiftMode && playDir == pdForward)
 | 
					                         if (NewIndex < 0 && TimeShiftMode && playDir == pdForward)
 | 
				
			||||||
                            SwitchToPlayFrame = Index;
 | 
					                            SwitchToPlayFrame = readIndex;
 | 
				
			||||||
                         Index = NewIndex;
 | 
					                         Index = NewIndex;
 | 
				
			||||||
                         readIndependent = true;
 | 
					                         readIndependent = true;
 | 
				
			||||||
                         }
 | 
					                         }
 | 
				
			||||||
@@ -452,7 +452,7 @@ void cDvbPlayer::Action(void)
 | 
				
			|||||||
                         if (!NextFile(FileNumber, FileOffset))
 | 
					                         if (!NextFile(FileNumber, FileOffset))
 | 
				
			||||||
                            continue;
 | 
					                            continue;
 | 
				
			||||||
                         }
 | 
					                         }
 | 
				
			||||||
                      else
 | 
					                      else if (!(TimeShiftMode && playDir == pdForward))
 | 
				
			||||||
                         eof = true;
 | 
					                         eof = true;
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
                   else if (index) {
 | 
					                   else if (index) {
 | 
				
			||||||
@@ -486,16 +486,16 @@ void cDvbPlayer::Action(void)
 | 
				
			|||||||
                         }
 | 
					                         }
 | 
				
			||||||
                      readFrame = new cFrame(b, -r, ftUnknown, readIndex, Pts); // hands over b to the ringBuffer
 | 
					                      readFrame = new cFrame(b, -r, ftUnknown, readIndex, Pts); // hands over b to the ringBuffer
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
                   else if (r < 0 && errno == EAGAIN)
 | 
					                   else if (r < 0) {
 | 
				
			||||||
                      WaitingForData = true;
 | 
					                      if (errno == EAGAIN)
 | 
				
			||||||
                   else {
 | 
					                         WaitingForData = true;
 | 
				
			||||||
                      if (r == 0)
 | 
					                      else if (FATALERRNO) {
 | 
				
			||||||
                         eof = true;
 | 
					 | 
				
			||||||
                      else if (r < 0 && FATALERRNO) {
 | 
					 | 
				
			||||||
                         LOG_ERROR;
 | 
					                         LOG_ERROR;
 | 
				
			||||||
                         break;
 | 
					                         break;
 | 
				
			||||||
                         }
 | 
					                         }
 | 
				
			||||||
                      }
 | 
					                      }
 | 
				
			||||||
 | 
					                   else
 | 
				
			||||||
 | 
					                      eof = true;
 | 
				
			||||||
                   }
 | 
					                   }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -764,7 +764,7 @@ void cDvbPlayer::SkipSeconds(int Seconds)
 | 
				
			|||||||
     if (Index >= 0) {
 | 
					     if (Index >= 0) {
 | 
				
			||||||
        Index = max(Index + SecondsToFrames(Seconds, framesPerSecond), 0);
 | 
					        Index = max(Index + SecondsToFrames(Seconds, framesPerSecond), 0);
 | 
				
			||||||
        if (Index > 0)
 | 
					        if (Index > 0)
 | 
				
			||||||
           Index = index->GetNextIFrame(Index, false, NULL, NULL, NULL, true);
 | 
					           Index = index->GetNextIFrame(Index, false, NULL, NULL, NULL);
 | 
				
			||||||
        if (Index >= 0)
 | 
					        if (Index >= 0)
 | 
				
			||||||
           readIndex = Index - 1; // Action() will first increment it!
 | 
					           readIndex = Index - 1; // Action() will first increment it!
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								recording.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								recording.c
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
				
			|||||||
 * See the main source file 'vdr.c' for copyright information and
 | 
					 * See the main source file 'vdr.c' for copyright information and
 | 
				
			||||||
 * how to reach the author.
 | 
					 * how to reach the author.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * $Id: recording.c 2.51 2012/02/26 13:58:26 kls Exp $
 | 
					 * $Id: recording.c 2.52 2012/03/12 14:49:28 kls Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "recording.h"
 | 
					#include "recording.h"
 | 
				
			||||||
@@ -1526,9 +1526,6 @@ void cIndexFileGenerator::Action(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define INDEXFILESUFFIX     "/index"
 | 
					#define INDEXFILESUFFIX     "/index"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// The number of frames to stay off the end in case of time shift:
 | 
					 | 
				
			||||||
#define INDEXSAFETYLIMIT 150 // frames
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// The maximum time to wait before giving up while catching up on an index file:
 | 
					// The maximum time to wait before giving up while catching up on an index file:
 | 
				
			||||||
#define MAXINDEXCATCHUP   8 // seconds
 | 
					#define MAXINDEXCATCHUP   8 // seconds
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1728,7 +1725,7 @@ bool cIndexFile::CatchUp(int Index)
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
         else
 | 
					         else
 | 
				
			||||||
            LOG_ERROR_STR(*fileName);
 | 
					            LOG_ERROR_STR(*fileName);
 | 
				
			||||||
         if (Index < last - (i ? 2 * INDEXSAFETYLIMIT : 0) || Index > 10 * INDEXSAFETYLIMIT) // keep off the end in case of "Pause live video"
 | 
					         if (Index < last)
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
         cCondWait::SleepMs(1000);
 | 
					         cCondWait::SleepMs(1000);
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
@@ -1775,13 +1772,13 @@ bool cIndexFile::Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *I
 | 
				
			|||||||
  return false;
 | 
					  return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int cIndexFile::GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber, off_t *FileOffset, int *Length, bool StayOffEnd)
 | 
					int cIndexFile::GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber, off_t *FileOffset, int *Length)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (CatchUp()) {
 | 
					  if (CatchUp()) {
 | 
				
			||||||
     int d = Forward ? 1 : -1;
 | 
					     int d = Forward ? 1 : -1;
 | 
				
			||||||
     for (;;) {
 | 
					     for (;;) {
 | 
				
			||||||
         Index += d;
 | 
					         Index += d;
 | 
				
			||||||
         if (Index >= 0 && Index < last - ((Forward && StayOffEnd) ? INDEXSAFETYLIMIT : 0)) {
 | 
					         if (Index >= 0 && Index < last) {
 | 
				
			||||||
            if (index[Index].independent) {
 | 
					            if (index[Index].independent) {
 | 
				
			||||||
               uint16_t fn;
 | 
					               uint16_t fn;
 | 
				
			||||||
               if (!FileNumber)
 | 
					               if (!FileNumber)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
 * See the main source file 'vdr.c' for copyright information and
 | 
					 * See the main source file 'vdr.c' for copyright information and
 | 
				
			||||||
 * how to reach the author.
 | 
					 * how to reach the author.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * $Id: recording.h 2.28 2012/03/11 15:26:01 kls Exp $
 | 
					 * $Id: recording.h 2.29 2012/03/12 11:44:06 kls Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __RECORDING_H
 | 
					#ifndef __RECORDING_H
 | 
				
			||||||
@@ -284,7 +284,7 @@ public:
 | 
				
			|||||||
  bool Ok(void) { return index != NULL; }
 | 
					  bool Ok(void) { return index != NULL; }
 | 
				
			||||||
  bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset);
 | 
					  bool Write(bool Independent, uint16_t FileNumber, off_t FileOffset);
 | 
				
			||||||
  bool Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *Independent = NULL, int *Length = NULL);
 | 
					  bool Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *Independent = NULL, int *Length = NULL);
 | 
				
			||||||
  int GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber = NULL, off_t *FileOffset = NULL, int *Length = NULL, bool StayOffEnd = false);
 | 
					  int GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber = NULL, off_t *FileOffset = NULL, int *Length = NULL);
 | 
				
			||||||
  int Get(uint16_t FileNumber, off_t FileOffset);
 | 
					  int Get(uint16_t FileNumber, off_t FileOffset);
 | 
				
			||||||
  int Last(void) { CatchUp(); return last; }
 | 
					  int Last(void) { CatchUp(); return last; }
 | 
				
			||||||
  int GetResume(void) { return resumeFile.Read(); }
 | 
					  int GetResume(void) { return resumeFile.Read(); }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user