summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de>2012-02-19 14:54:00 +0100
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2012-02-19 16:36:45 +0100
commitc2d9577b3dd7557b7a9c702d5c1fd3b1bbe0e5e7 (patch)
treea59a457cc3975f5835e7b307dccc5fd0f0e1b1be /recording.c
parent59f0138a7d03fed4fc33e1083928bf5b28e0e4ff (diff)
downloadvdr-patches-c2d9577b3dd7557b7a9c702d5c1fd3b1bbe0e5e7.tar.gz
vdr-patches-c2d9577b3dd7557b7a9c702d5c1fd3b1bbe0e5e7.tar.bz2
Version 1.7.24
Original announce message: VDR developer version 1.7.24 is now available at ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.24.tar.bz2 A 'diff' against the previous version is available at ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.23-1.7.24.diff MD5 checksums: a034c5e399417dfc583483f650d003ee vdr-1.7.24.tar.bz2 aa1a2b202da92e65945ff39470b26618 vdr-1.7.23-1.7.24.diff WARNING: ======== This is a developer version. Even though I use it in my productive environment. I strongly recommend that you only use it under controlled conditions and for testing and debugging. From the HISTORY file: - Updated the Italian OSD texts (thanks to Diego Pierotto). - Fixed a high load in case a transponder can't be received. - Improved the way DVB_API_VERSION is checked. - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed asserting there is a live programme if the primary device is bonded with a device that starts a recording on a different band. - Fixed the return type of cMyDeviceHook::DeviceProvidesTransponder() in PLUGINS.html. - Fixed a crash in a plugin using cDeviceHook when VDR ends (reported by Oliver Endriss). - Some improvements to the Makefiles (thanks to Christian Ruppert). - Fixed cRecording::LengthInSeconds(), which wrongfully rounded the result to full minutes (thanks to Christoph Haubrich). - Symbolic links are no longer resolved in cRecordings::ScanVideoDir() (thanks to Sundararaj Reel). - The epg.data file is now read in a separate thread to make the startup process faster in case the file is very large (suggested by Helmut Auer). - Fixed selecting the primary device for receiving the live viewing channel in case it is bonded with an other device and has no receiver attached to it. - Fixed a possible crash when canceling VDR while displaying subtitles, and the primary device is no longer available. - Improved handling subtitles of BBC channels. - No longer using tabs as delimiter in the EPG bugfix log (they were garbled in the log file). - Added a missing '.' after the month in VPS strings. - Added some missing 'const' to cDevice (thanks to Joachim Wilke). - Fixed handling the PrimaryLimit when requesting a device for live viewing (reported by Uwe Scheffler). - Removed superfluous calls to SetVideoFormat() from device constructors. This function is called in cDevice::SetPrimaryDevice(), anyway. - An ongoing editing process is now canceled if either the original or the edited version of the recording is deleted from the Recordings menu. - The SVDRP command DELR now won't delete a recording that is currently being edited. - Removed code stub for obsolete SVDRP command MOVT. - The DVB device adapters/frontends are now probed by scanning the /dev/dvb directory instead of looping through adapter/frontend numbers. This allows for "holes" in the device numbering. - cReadDir::Next() now skips directory entries "." and "..". - Fixed a possible deadlock in time shift mode. - Fixed switching into time shift mode when pausing live video (thanks to Reinhard Nissl for helping to debug this one).
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c90
1 files changed, 47 insertions, 43 deletions
diff --git a/recording.c b/recording.c
index cf35bb7..7617d73 100644
--- a/recording.c
+++ b/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 2.43 2012/01/15 11:04:24 kls Exp $
+ * $Id: recording.c 2.50 2012/02/19 10:44:45 kls Exp $
*/
#include "recording.h"
@@ -875,11 +875,11 @@ const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level) cons
s = name;
cString Length("");
if (NewIndicator) {
- int Seconds = max(0, LengthInSeconds());
+ int Minutes = max(0, (LengthInSeconds() + 30) / 60);
Length = cString::sprintf("%c%d:%02d",
Delimiter,
- Seconds / 3600,
- Seconds / 60 % 60
+ Minutes / 60,
+ Minutes % 60
);
}
titleBuffer = strdup(cString::sprintf("%02d.%02d.%02d%c%02d:%02d%s%c%c%s",
@@ -1059,7 +1059,7 @@ int cRecording::LengthInSeconds(void) const
{
int nf = NumFrames();
if (nf >= 0)
- return int((nf / FramesPerSecond() + 30) / 60) * 60;
+ return int(nf / FramesPerSecond());
return -1;
}
@@ -1109,43 +1109,38 @@ void cRecordings::ScanVideoDir(const char *DirName, bool Foreground, int LinkLev
cReadDir d(DirName);
struct dirent *e;
while ((Foreground || Running()) && (e = d.Next()) != NULL) {
- if (strcmp(e->d_name, ".") && strcmp(e->d_name, "..")) {
- cString buffer = AddDirectory(DirName, e->d_name);
- struct stat st;
- if (lstat(buffer, &st) == 0) {
- int Link = 0;
- if (S_ISLNK(st.st_mode)) {
- if (LinkLevel > MAX_LINK_LEVEL) {
- isyslog("max link level exceeded - not scanning %s", *buffer);
- continue;
- }
- Link = 1;
- buffer = ReadLink(buffer);
- if (!*buffer)
- continue;
- if (stat(buffer, &st) != 0)
- continue;
+ cString buffer = AddDirectory(DirName, e->d_name);
+ struct stat st;
+ if (lstat(buffer, &st) == 0) {
+ int Link = 0;
+ if (S_ISLNK(st.st_mode)) {
+ if (LinkLevel > MAX_LINK_LEVEL) {
+ isyslog("max link level exceeded - not scanning %s", *buffer);
+ continue;
}
- if (S_ISDIR(st.st_mode)) {
- if (endswith(buffer, deleted ? DELEXT : RECEXT)) {
- cRecording *r = new cRecording(buffer);
- if (r->Name()) {
- r->NumFrames(); // initializes the numFrames member
- Lock();
- Add(r);
- ChangeState();
- Unlock();
- if (deleted) {
- r->fileSizeMB = DirSizeMB(buffer);
- r->deleted = time(NULL);
- }
+ Link = 1;
+ if (stat(buffer, &st) != 0)
+ continue;
+ }
+ if (S_ISDIR(st.st_mode)) {
+ if (endswith(buffer, deleted ? DELEXT : RECEXT)) {
+ cRecording *r = new cRecording(buffer);
+ if (r->Name()) {
+ r->NumFrames(); // initializes the numFrames member
+ Lock();
+ Add(r);
+ ChangeState();
+ Unlock();
+ if (deleted) {
+ r->fileSizeMB = DirSizeMB(buffer);
+ r->deleted = time(NULL);
}
- else
- delete r;
}
else
- ScanVideoDir(buffer, Foreground, LinkLevel + Link);
+ delete r;
}
+ else
+ ScanVideoDir(buffer, Foreground, LinkLevel + Link);
}
}
}
@@ -1220,12 +1215,14 @@ void cRecordings::DelByName(const char *FileName)
char *ext = strrchr(recording->fileName, '.');
if (ext) {
strncpy(ext, DELEXT, strlen(ext));
- recording->fileSizeMB = DirSizeMB(recording->FileName());
- recording->deleted = time(NULL);
- DeletedRecordings.Add(recording);
+ if (access(recording->FileName(), F_OK) == 0) {
+ recording->fileSizeMB = DirSizeMB(recording->FileName());
+ recording->deleted = time(NULL);
+ DeletedRecordings.Add(recording);
+ recording = NULL; // to prevent it from being deleted below
+ }
}
- else
- delete recording;
+ delete recording;
ChangeState();
TouchUpdate();
}
@@ -1558,8 +1555,9 @@ struct tIndexTs {
#define MAXWAITFORINDEXFILE 10 // max. time to wait for the regenerated index file (seconds)
#define INDEXFILECHECKINTERVAL 500 // ms between checks for existence of the regenerated index file
+#define INDEXFILETESTINTERVAL 10 // ms between tests for the size of the index file in case of pausing live video
-cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording)
+cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording, bool PauseLive)
:resumeFile(FileName, IsPesRecording)
{
f = -1;
@@ -1570,6 +1568,12 @@ cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording)
indexFileGenerator = NULL;
if (FileName) {
fileName = IndexFileName(FileName, isPesRecording);
+ if (!Record && PauseLive) {
+ // Wait until the index file contains at least two frames:
+ time_t tmax = time(NULL) + MAXWAITFORINDEXFILE;
+ while (time(NULL) < tmax && FileSize(fileName) < 2 * sizeof(tIndexTs))
+ cCondWait::SleepMs(INDEXFILETESTINTERVAL);
+ }
int delta = 0;
if (!Record && access(fileName, R_OK) != 0) {
// Index file doesn't exist, so try to regenerate it: