mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Recordings now avoid zero sized video data files
This commit is contained in:
		| @@ -1326,3 +1326,6 @@ Daniel Thompson <daniel.thompson@st.com> | ||||
|  | ||||
| Matthias L<>tzke <Matthias@Loetzke.de> | ||||
|  for adding missing text internationalization for "Starting EPG scan" | ||||
|  | ||||
| Wolfgang Fritz <wolfgang.fritz@gmx.net> | ||||
|  for making recordings avoid zero sized video data files | ||||
|   | ||||
							
								
								
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -3507,3 +3507,4 @@ Video Disk Recorder Revision History | ||||
| - No longer retuning or restarting a recording if only the language code of an | ||||
|   audio or dolby PID changes. | ||||
| - Now preferring budget cards when selecting a DVB device for recording. | ||||
| - Recordings now avoid zero sized video data files (thanks to Wolfgang Fitz). | ||||
|   | ||||
							
								
								
									
										19
									
								
								recording.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								recording.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: recording.c 1.97 2005/05/06 14:00:23 kls Exp $ | ||||
|  * $Id: recording.c 1.98 2005/05/07 15:25:15 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "recording.h" | ||||
| @@ -1124,8 +1124,21 @@ int cFileName::SetOffset(int Number, int Offset) | ||||
|      fileNumber = Number; | ||||
|      sprintf(pFileNumber, RECORDFILESUFFIX, fileNumber); | ||||
|      if (record) { | ||||
|         if (access(fileName, F_OK) == 0) // file exists, let's try next suffix | ||||
|            return SetOffset(Number + 1); | ||||
|         if (access(fileName, F_OK) == 0) { | ||||
|            // files exists, check if it has non-zero size | ||||
|            struct stat buf; | ||||
|            if (stat(fileName, &buf) == 0) { | ||||
|               if (buf.st_size != 0) | ||||
|                  return SetOffset(Number + 1); // file exists and has non zero size, let's try next suffix | ||||
|               else { | ||||
|                  // zero size file, remove it | ||||
|                  dsyslog ("cFileName::SetOffset: removing zero-sized file %s\n", fileName); | ||||
|                  unlink (fileName); | ||||
|                  } | ||||
|               } | ||||
|            else | ||||
|               return SetOffset(Number + 1); // error with fstat - should not happen, just to be on the safe side | ||||
|            } | ||||
|         else if (errno != ENOENT) { // something serious has happened | ||||
|            LOG_ERROR_STR(fileName); | ||||
|            return -1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user