mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-12-26 23:06:44 +01:00
cRecording now fetches priority, lifetime and framesPerSecond from cRecordingInfo
This commit is contained in:
4
HISTORY
4
HISTORY
@@ -10119,6 +10119,8 @@ Video Disk Recorder Revision History
|
|||||||
- Now deleting old recording info before reading modified info file (suggested by
|
- Now deleting old recording info before reading modified info file (suggested by
|
||||||
Stefan Hofmann).
|
Stefan Hofmann).
|
||||||
|
|
||||||
2025-04-12:
|
2025-04-15:
|
||||||
|
|
||||||
- Fixed some misplaced 'override' keywords in the 'hello' and 'skincurses' plugins.
|
- Fixed some misplaced 'override' keywords in the 'hello' and 'skincurses' plugins.
|
||||||
|
- cRecording now fetches priority, lifetime and framesPerSecond from cRecordingInfo.
|
||||||
|
APIVERSNUM is now 30008.
|
||||||
|
|||||||
6
config.h
6
config.h
@@ -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: config.h 5.30 2025/04/12 08:32:04 kls Exp $
|
* $Id: config.h 5.31 2025/04/15 19:38:46 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
// The plugin API's version number:
|
// The plugin API's version number:
|
||||||
|
|
||||||
#define APIVERSION "7"
|
#define APIVERSION "8"
|
||||||
#define APIVERSNUM 30007
|
#define APIVERSNUM 30008
|
||||||
|
|
||||||
// When loading plugins, VDR searches files by their APIVERSION, which
|
// When loading plugins, VDR searches files by their APIVERSION, which
|
||||||
// is different from VDRVERSION. APIVERSION is a plain number, incremented
|
// is different from VDRVERSION. APIVERSION is a plain number, incremented
|
||||||
|
|||||||
46
recording.c
46
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 5.39 2025/04/11 12:39:03 kls Exp $
|
* $Id: recording.c 5.40 2025/04/15 19:38:46 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
@@ -467,6 +467,16 @@ void cRecordingInfo::SetFramesPerSecond(double FramesPerSecond)
|
|||||||
framesPerSecond = FramesPerSecond;
|
framesPerSecond = FramesPerSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cRecordingInfo::SetPriority(int Priority)
|
||||||
|
{
|
||||||
|
priority = Priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cRecordingInfo::SetLifetime(int Lifetime)
|
||||||
|
{
|
||||||
|
lifetime = Lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
void cRecordingInfo::SetFrameParams(uint16_t FrameWidth, uint16_t FrameHeight, eScanType ScanType, eAspectRatio AspectRatio)
|
void cRecordingInfo::SetFrameParams(uint16_t FrameWidth, uint16_t FrameHeight, eScanType ScanType, eAspectRatio AspectRatio)
|
||||||
{
|
{
|
||||||
frameWidth = FrameWidth;
|
frameWidth = FrameWidth;
|
||||||
@@ -869,7 +879,6 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
|
|||||||
instanceId = InstanceId;
|
instanceId = InstanceId;
|
||||||
isPesRecording = false;
|
isPesRecording = false;
|
||||||
isOnVideoDirectoryFileSystem = -1; // unknown
|
isOnVideoDirectoryFileSystem = -1; // unknown
|
||||||
framesPerSecond = DEFAULTFRAMESPERSECOND;
|
|
||||||
numFrames = -1;
|
numFrames = -1;
|
||||||
deleted = 0;
|
deleted = 0;
|
||||||
// set up the actual name:
|
// set up the actual name:
|
||||||
@@ -903,13 +912,11 @@ cRecording::cRecording(cTimer *Timer, const cEvent *Event)
|
|||||||
// substitute characters that would cause problems in file names:
|
// substitute characters that would cause problems in file names:
|
||||||
strreplace(name, '\n', ' ');
|
strreplace(name, '\n', ' ');
|
||||||
start = Timer->StartTime();
|
start = Timer->StartTime();
|
||||||
priority = Timer->Priority();
|
|
||||||
lifetime = Timer->Lifetime();
|
|
||||||
// handle info:
|
// handle info:
|
||||||
info = new cRecordingInfo(Timer->Channel(), Event);
|
info = new cRecordingInfo(Timer->Channel(), Event);
|
||||||
info->SetAux(Timer->Aux());
|
info->SetAux(Timer->Aux());
|
||||||
info->priority = priority;
|
info->SetPriority(Timer->Priority());
|
||||||
info->lifetime = lifetime;
|
info->SetLifetime(Timer->Lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
cRecording::cRecording(const char *FileName)
|
cRecording::cRecording(const char *FileName)
|
||||||
@@ -919,11 +926,8 @@ cRecording::cRecording(const char *FileName)
|
|||||||
fileSizeMB = -1; // unknown
|
fileSizeMB = -1; // unknown
|
||||||
channel = -1;
|
channel = -1;
|
||||||
instanceId = -1;
|
instanceId = -1;
|
||||||
priority = MAXPRIORITY; // assume maximum in case there is no info file
|
|
||||||
lifetime = MAXLIFETIME;
|
|
||||||
isPesRecording = false;
|
isPesRecording = false;
|
||||||
isOnVideoDirectoryFileSystem = -1; // unknown
|
isOnVideoDirectoryFileSystem = -1; // unknown
|
||||||
framesPerSecond = DEFAULTFRAMESPERSECOND;
|
|
||||||
numFrames = -1;
|
numFrames = -1;
|
||||||
deleted = 0;
|
deleted = 0;
|
||||||
titleBuffer = NULL;
|
titleBuffer = NULL;
|
||||||
@@ -942,6 +946,8 @@ cRecording::cRecording(const char *FileName)
|
|||||||
struct tm tm_r;
|
struct tm tm_r;
|
||||||
struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
|
struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
|
||||||
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
|
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
|
||||||
|
int priority = MAXPRIORITY;
|
||||||
|
int lifetime = MAXLIFETIME;
|
||||||
if (7 == sscanf(p + 1, DATAFORMATTS, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &channel, &instanceId)
|
if (7 == sscanf(p + 1, DATAFORMATTS, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &channel, &instanceId)
|
||||||
|| 7 == sscanf(p + 1, DATAFORMATPES, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &priority, &lifetime)) {
|
|| 7 == sscanf(p + 1, DATAFORMATPES, &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &priority, &lifetime)) {
|
||||||
t.tm_year -= 1900;
|
t.tm_year -= 1900;
|
||||||
@@ -963,10 +969,9 @@ cRecording::cRecording(const char *FileName)
|
|||||||
if (f) {
|
if (f) {
|
||||||
if (!info->Read(f))
|
if (!info->Read(f))
|
||||||
esyslog("ERROR: EPG data problem in file %s", *InfoFileName);
|
esyslog("ERROR: EPG data problem in file %s", *InfoFileName);
|
||||||
else if (!isPesRecording) {
|
else if (isPesRecording) {
|
||||||
priority = info->priority;
|
info->SetPriority(priority);
|
||||||
lifetime = info->lifetime;
|
info->SetLifetime(lifetime);
|
||||||
framesPerSecond = info->framesPerSecond;
|
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
@@ -1156,8 +1161,8 @@ const char *cRecording::FileName(void) const
|
|||||||
struct tm tm_r;
|
struct tm tm_r;
|
||||||
struct tm *t = localtime_r(&start, &tm_r);
|
struct tm *t = localtime_r(&start, &tm_r);
|
||||||
const char *fmt = isPesRecording ? NAMEFORMATPES : NAMEFORMATTS;
|
const char *fmt = isPesRecording ? NAMEFORMATPES : NAMEFORMATTS;
|
||||||
int ch = isPesRecording ? priority : channel;
|
int ch = isPesRecording ? info->Priority() : channel;
|
||||||
int ri = isPesRecording ? lifetime : instanceId;
|
int ri = isPesRecording ? info->Lifetime() : instanceId;
|
||||||
char *Name = LimitNameLengths(strdup(name), DirectoryPathMax - strlen(cVideoDirectory::Name()) - 1 - 42, DirectoryNameMax); // 42 = length of an actual recording directory name (generated with DATAFORMATTS) plus some reserve
|
char *Name = LimitNameLengths(strdup(name), DirectoryPathMax - strlen(cVideoDirectory::Name()) - 1 - 42, DirectoryNameMax); // 42 = length of an actual recording directory name (generated with DATAFORMATTS) plus some reserve
|
||||||
if (strcmp(Name, name) != 0)
|
if (strcmp(Name, name) != 0)
|
||||||
dsyslog("recording file name '%s' truncated to '%s'", name, Name);
|
dsyslog("recording file name '%s' truncated to '%s'", name, Name);
|
||||||
@@ -1279,9 +1284,6 @@ bool cRecording::DeleteMarks(void)
|
|||||||
void cRecording::ReadInfo(void)
|
void cRecording::ReadInfo(void)
|
||||||
{
|
{
|
||||||
info->Read();
|
info->Read();
|
||||||
priority = info->priority;
|
|
||||||
lifetime = info->lifetime;
|
|
||||||
framesPerSecond = info->framesPerSecond;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cRecording::WriteInfo(const char *OtherFileName)
|
bool cRecording::WriteInfo(const char *OtherFileName)
|
||||||
@@ -1316,10 +1318,10 @@ bool cRecording::ChangePriorityLifetime(int NewPriority, int NewLifetime)
|
|||||||
{
|
{
|
||||||
if (NewPriority != Priority() || NewLifetime != Lifetime()) {
|
if (NewPriority != Priority() || NewLifetime != Lifetime()) {
|
||||||
dsyslog("changing priority/lifetime of '%s' to %d/%d", Name(), NewPriority, NewLifetime);
|
dsyslog("changing priority/lifetime of '%s' to %d/%d", Name(), NewPriority, NewLifetime);
|
||||||
|
info->SetPriority(NewPriority);
|
||||||
|
info->SetLifetime(NewLifetime);
|
||||||
if (IsPesRecording()) {
|
if (IsPesRecording()) {
|
||||||
cString OldFileName = FileName();
|
cString OldFileName = FileName();
|
||||||
priority = NewPriority;
|
|
||||||
lifetime = NewLifetime;
|
|
||||||
free(fileName);
|
free(fileName);
|
||||||
fileName = NULL;
|
fileName = NULL;
|
||||||
cString NewFileName = FileName();
|
cString NewFileName = FileName();
|
||||||
@@ -1328,8 +1330,6 @@ bool cRecording::ChangePriorityLifetime(int NewPriority, int NewLifetime)
|
|||||||
info->SetFileName(NewFileName);
|
info->SetFileName(NewFileName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
priority = info->priority = NewPriority;
|
|
||||||
lifetime = info->lifetime = NewLifetime;
|
|
||||||
if (!WriteInfo())
|
if (!WriteInfo())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1465,7 +1465,7 @@ int cRecording::NumFramesAfterEdit(void) const
|
|||||||
int IndexLength = cIndexFile::GetLength(fileName, isPesRecording);
|
int IndexLength = cIndexFile::GetLength(fileName, isPesRecording);
|
||||||
if (IndexLength > 0) {
|
if (IndexLength > 0) {
|
||||||
cMarks Marks;
|
cMarks Marks;
|
||||||
if (Marks.Load(fileName, framesPerSecond, isPesRecording))
|
if (Marks.Load(fileName, FramesPerSecond(), isPesRecording))
|
||||||
return Marks.GetFrameAfterEdit(IndexLength - 1, IndexLength - 1);
|
return Marks.GetFrameAfterEdit(IndexLength - 1, IndexLength - 1);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
15
recording.h
15
recording.h
@@ -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 5.13 2025/03/02 11:03:35 kls Exp $
|
* $Id: recording.h 5.14 2025/04/15 19:38:46 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RECORDING_H
|
#ifndef __RECORDING_H
|
||||||
@@ -93,6 +93,8 @@ public:
|
|||||||
const cComponents *Components(void) const { return event->Components(); }
|
const cComponents *Components(void) const { return event->Components(); }
|
||||||
const char *Aux(void) const { return aux; }
|
const char *Aux(void) const { return aux; }
|
||||||
double FramesPerSecond(void) const { return framesPerSecond; }
|
double FramesPerSecond(void) const { return framesPerSecond; }
|
||||||
|
int Priority(void) const { return priority; }
|
||||||
|
int Lifetime(void) const { return lifetime; }
|
||||||
uint16_t FrameWidth(void) const { return frameWidth; }
|
uint16_t FrameWidth(void) const { return frameWidth; }
|
||||||
uint16_t FrameHeight(void) const { return frameHeight; }
|
uint16_t FrameHeight(void) const { return frameHeight; }
|
||||||
eScanType ScanType(void) const { return scanType; }
|
eScanType ScanType(void) const { return scanType; }
|
||||||
@@ -101,6 +103,8 @@ public:
|
|||||||
const char *AspectRatioText(void) const { return AspectRatioTexts[aspectRatio]; }
|
const char *AspectRatioText(void) const { return AspectRatioTexts[aspectRatio]; }
|
||||||
cString FrameParams(void) const;
|
cString FrameParams(void) const;
|
||||||
void SetFramesPerSecond(double FramesPerSecond);
|
void SetFramesPerSecond(double FramesPerSecond);
|
||||||
|
void SetPriority(int Priority);
|
||||||
|
void SetLifetime(int Lifetime);
|
||||||
void SetFrameParams(uint16_t FrameWidth, uint16_t FrameHeight, eScanType ScanType, eAspectRatio AspectRatio);
|
void SetFrameParams(uint16_t FrameWidth, uint16_t FrameHeight, eScanType ScanType, eAspectRatio AspectRatio);
|
||||||
void SetFileName(const char *FileName);
|
void SetFileName(const char *FileName);
|
||||||
int Errors(void) const { return errors; } // returns -1 if undefined
|
int Errors(void) const { return errors; } // returns -1 if undefined
|
||||||
@@ -128,7 +132,6 @@ private:
|
|||||||
int instanceId;
|
int instanceId;
|
||||||
bool isPesRecording;
|
bool isPesRecording;
|
||||||
mutable int isOnVideoDirectoryFileSystem; // -1 = unknown, 0 = no, 1 = yes
|
mutable int isOnVideoDirectoryFileSystem; // -1 = unknown, 0 = no, 1 = yes
|
||||||
double framesPerSecond;
|
|
||||||
cRecordingInfo *info;
|
cRecordingInfo *info;
|
||||||
cRecording(const cRecording&); // can't copy cRecording
|
cRecording(const cRecording&); // can't copy cRecording
|
||||||
cRecording &operator=(const cRecording &); // can't assign cRecording
|
cRecording &operator=(const cRecording &); // can't assign cRecording
|
||||||
@@ -137,8 +140,6 @@ private:
|
|||||||
void ClearSortName(void);
|
void ClearSortName(void);
|
||||||
void SetId(int Id); // should only be set by cRecordings
|
void SetId(int Id); // should only be set by cRecordings
|
||||||
time_t start;
|
time_t start;
|
||||||
int priority;
|
|
||||||
int lifetime;
|
|
||||||
time_t deleted;
|
time_t deleted;
|
||||||
public:
|
public:
|
||||||
cRecording(cTimer *Timer, const cEvent *Event);
|
cRecording(cTimer *Timer, const cEvent *Event);
|
||||||
@@ -146,8 +147,8 @@ public:
|
|||||||
virtual ~cRecording() override;
|
virtual ~cRecording() override;
|
||||||
int Id(void) const { return id; }
|
int Id(void) const { return id; }
|
||||||
time_t Start(void) const { return start; }
|
time_t Start(void) const { return start; }
|
||||||
int Priority(void) const { return priority; }
|
int Priority(void) const { return info->Priority(); }
|
||||||
int Lifetime(void) const { return lifetime; }
|
int Lifetime(void) const { return info->Lifetime(); }
|
||||||
time_t Deleted(void) const { return deleted; }
|
time_t Deleted(void) const { return deleted; }
|
||||||
void SetDeleted(void) { deleted = time(NULL); }
|
void SetDeleted(void) { deleted = time(NULL); }
|
||||||
virtual int Compare(const cListObject &ListObject) const override;
|
virtual int Compare(const cListObject &ListObject) const override;
|
||||||
@@ -171,7 +172,7 @@ public:
|
|||||||
const char *PrefixFileName(char Prefix);
|
const char *PrefixFileName(char Prefix);
|
||||||
int HierarchyLevels(void) const;
|
int HierarchyLevels(void) const;
|
||||||
void ResetResume(void) const;
|
void ResetResume(void) const;
|
||||||
double FramesPerSecond(void) const { return framesPerSecond; }
|
double FramesPerSecond(void) const { return info->FramesPerSecond(); }
|
||||||
int NumFrames(void) const;
|
int NumFrames(void) const;
|
||||||
///< Returns the number of frames in this recording.
|
///< Returns the number of frames in this recording.
|
||||||
///< If the number of frames is unknown, -1 will be returned.
|
///< If the number of frames is unknown, -1 will be returned.
|
||||||
|
|||||||
Reference in New Issue
Block a user