mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Improved reaction on user input in fast/slow forward/back modes
This commit is contained in:
		
							
								
								
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -116,3 +116,4 @@ Video Disk Recorder Revision History | ||||
|   but rather resumes normal replay mode after a "pause", "forward" or "backward" | ||||
|   operation. Use the "Skip -60s" function repeatedly to go back to the beginning | ||||
|   of the recording. | ||||
| - Improved reaction on user input in fast/slow forward/back modes. | ||||
|   | ||||
							
								
								
									
										4
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								config.h
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: config.h 1.12 2000/07/29 18:18:00 kls Exp $ | ||||
|  * $Id: config.h 1.13 2000/08/02 16:38:40 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #ifndef __CONFIG_H | ||||
| @@ -17,7 +17,7 @@ | ||||
| #include "dvbapi.h" | ||||
| #include "tools.h" | ||||
|  | ||||
| #define VDRVERSION "0.6" | ||||
| #define VDRVERSION "0.61" | ||||
|  | ||||
| #define MaxBuffer 10000 | ||||
|  | ||||
|   | ||||
							
								
								
									
										62
									
								
								dvbapi.c
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								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.19 2000/07/30 16:14:22 kls Exp $ | ||||
|  * $Id: dvbapi.c 1.20 2000/08/01 18:06:39 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "dvbapi.h" | ||||
| @@ -347,7 +347,6 @@ protected: | ||||
|   int Readable(void) { return (tail >= head) ? size - tail - (head ? 0 : 1) : head - tail - 1; } // keep a 1 byte gap! | ||||
|   int Writeable(void) { return (tail >= head) ? tail - head : size - head; } | ||||
|   int Byte(int Offset); | ||||
|   bool WaitForOutFile(int Timeout); | ||||
| public: | ||||
|   cRingBuffer(int *InFile, int *OutFile, int Size, int FreeLimit = 0, int AvailLimit = 0); | ||||
|   virtual ~cRingBuffer(); | ||||
| @@ -408,22 +407,6 @@ void cRingBuffer::Skip(int n) | ||||
|      } | ||||
| } | ||||
|  | ||||
| bool cRingBuffer::WaitForOutFile(int Timeout) | ||||
| { | ||||
|   fd_set set; | ||||
|   FD_ZERO(&set); | ||||
|   FD_SET(*outFile, &set); | ||||
|   struct timeval timeout; | ||||
|   timeout.tv_sec = 0; | ||||
|   timeout.tv_usec = Timeout; | ||||
|   if (select(FD_SETSIZE, NULL, &set, NULL, &timeout) > 0) { | ||||
|      if (FD_ISSET(*outFile, &set)) | ||||
|         return true; | ||||
|      } | ||||
|   esyslog(LOG_ERR, "ERROR: timeout in WaitForOutFile(%d)", Timeout);   | ||||
|   return false; | ||||
| } | ||||
|  | ||||
| int cRingBuffer::Read(int Max) | ||||
| { | ||||
|   if (buffer) { | ||||
| @@ -1001,7 +984,7 @@ int cReplayBuffer::Read(int Max = -1) | ||||
|            int FileOffset, Length; | ||||
|            if (mode == rmSlowRewind && (brakeCounter++ % 24) != 0) { | ||||
|               // show every I_FRAME 24 times in rmSlowRewind mode to achieve roughly the same speed as in slow forward mode | ||||
|               Index = index->GetNextIFrame(Index, true, &FileNumber, &FileOffset, &Length); //springe eine Frame vorw<72>rts! | ||||
|               Index = index->GetNextIFrame(Index, true, &FileNumber, &FileOffset, &Length); // jump ahead one frame | ||||
|               } | ||||
|            Index = index->GetNextIFrame(Index, mode == rmFastForward, &FileNumber, &FileOffset, &Length); | ||||
|            if (Index >= 0) { | ||||
| @@ -1043,28 +1026,27 @@ int cReplayBuffer::Read(int Max = -1) | ||||
| int cReplayBuffer::Write(int Max) | ||||
| { | ||||
|   int Written = 0; | ||||
|  | ||||
|   do { | ||||
|      if (skipAudio) { | ||||
|         SkipAudioBlocks(); | ||||
|         Max = GetAvPesLength(); | ||||
|         } | ||||
|      while (Max) { | ||||
|            int w = cFileBuffer::Write(Max); | ||||
|            if (w >= 0) { | ||||
|               fileOffset += w; | ||||
|               Written += w; | ||||
|               if (Max < 0) | ||||
|                  break; | ||||
|               Max -= w; | ||||
|               } | ||||
|            else | ||||
|               return w; | ||||
|                //XXX??? Why does the buffer get empty here??? | ||||
|            if (Empty() || !WaitForOutFile(1000000)) | ||||
|               return Written; | ||||
|   int Av = Available(); | ||||
|   if (skipAudio) { | ||||
|      SkipAudioBlocks(); | ||||
|      Max = GetAvPesLength(); | ||||
|      fileOffset += Av - Available(); | ||||
|      } | ||||
|   if (Max) { | ||||
|      int w; | ||||
|      do { | ||||
|         w = cFileBuffer::Write(Max); | ||||
|         if (w >= 0) { | ||||
|            fileOffset += w; | ||||
|            Written += w; | ||||
|            if (Max < 0) | ||||
|               break; | ||||
|            Max -= w; | ||||
|            } | ||||
|      } while (skipAudio && Available()); | ||||
|         else | ||||
|            return w; | ||||
|         } while (Max > 0); // we MUST write this entire AV_PES block | ||||
|      } | ||||
|   return Written; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user