summaryrefslogtreecommitdiff
path: root/recording.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2009-01-06 20:31:53 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2009-01-06 20:31:53 +0100
commitc2966475942fcb9d4b8d41dbf026ff57630a1ad6 (patch)
tree1b41925820073ddee361c5acb0fd68fbadcd11a8 /recording.h
parent1834751c4510edb66c96d0b741def5922738e74c (diff)
downloadvdr-patch-lnbsharing-c2966475942fcb9d4b8d41dbf026ff57630a1ad6.tar.gz
vdr-patch-lnbsharing-c2966475942fcb9d4b8d41dbf026ff57630a1ad6.tar.bz2
Version 1.7.3vdr-1.7.3
- Updated the Russian OSD texts (thanks to Oleg Roitburd). - Fixed handling the 'pointer field' in generating and parsing PAT/PMT (thanks to Frank Schmirler). - Fixed handling modulation types for DVB-S transponders when processing the NIT. - Changed cDvbDevice::GrabImage() to use V4L2 (thanks to Marco Schlüßler). - Added a poll to cDvbDevice::PlayVideo() and cDvbDevice::PlayAudio() to avoid excessive CPU load (this is just a makeshift solution until the FF DVB cards can play TS directly). - The recording format is now Transport Stream. Existing recordings in PES format can still be replayed and edited, but new recordings are done in TS. All code for recording in PES has been removed. The following changes were made to switch to TS recording format: + The index file format has been changed to support file sizes of up to 1TB (previously 2GB), and up to 65535 separate files per recording (previously 255). + The recording file names are now of the form 00001.ts (previously 001.vdr). + The frame rate is now detected by looking at two subsequent PTS values. The "frame duration" (in multiples of 1/90000) is stored in the info.vdr file using the new tag F (thanks to Artur Skawina for helping to get the IndexToHMSF() calculation right). + Several functions now have an additional parameter FramesPerSecond. + Several functions now have an additional parameter IsPesRecording. + The functionality of cFileWriter was moved into cRecorder, and cRemux is now obsolete. This also avoids one level of data copying while recording. + cRemux, cRingBufferLinearPes, cTS2PES and all c*Repacker classes have been removed. + A PAT/PMT is inserted before every independent frame, so that no extra measures need to be taken when editing a recording. + The directory name for a recording has been changed from YYYY-MM-DD-hh[.:]mm.pr.lt.rec (pr=priority, lt=lifetime) to YYYY-MM-DD-hh.mm.ch-ri.rec (ch=channel, ri=resumeId). Priority and Lifetime are now stored in the info.vdr file with the new tags P and L (if no such file exists, the maximum values are assumed by default, which avoids inadvertently deleting a recording if disk space is low). No longer storing Priority and Lifetime in the directory name avoids starting a new recording if one of these is changed in the timer and the recording is re-started for some reason. Instead of Priority and Lifetime, the directory name now contains the channel number from which the recording was made, and the "resume id" of this instance of VDR. This avoids problems if several VDR instances record the same show on different channels, or even on the same channel. The '-' between channel number and resumeId prevents older versions of VDR from "seeing" these recordings, which makes sure they won't even try to replay them, or remove them in case the disk runs full. + The semantics of PlayTs*() have been changed. These functions are now required to return the given Length (which is TS_SIZE) if they have processed the TS packet. + The files "index", "info", "marks" and "resume" within a TS recording directory are now created without the ".vdr" extension. + The "resume" file is no longer a binary file, but contains tagged lines to be able to store additional information, like the selected audio or subtitle track. + cDevice::StillPicture() will now be called with either TS or PES data. + cDvbPlayer::Goto() no longer appends a "sequence end code" to the data. If the output device needs this, it has to take care of it by itself. - Fixed cPatPmtParser::ParsePmt() to reset vpid and vtype when switching from a video to an audio channel (thanks to Reinhard Nissl). - cDvbDevice now uses the FE_CAN_2G_MODULATION flag to determine whether a device can handle DVB-S2. The #define is still there to allow people with older drivers who don't need DVB-S2 to use this version without pathcing.
Diffstat (limited to 'recording.h')
-rw-r--r--recording.h61
1 files changed, 42 insertions, 19 deletions
diff --git a/recording.h b/recording.h
index a201f5a..a1d497d 100644
--- a/recording.h
+++ b/recording.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.h 2.0 2007/10/14 10:11:34 kls Exp $
+ * $Id: recording.h 2.1 2009/01/06 10:49:59 kls Exp $
*/
#ifndef __RECORDING_H
@@ -30,8 +30,9 @@ void AssertFreeDiskSpace(int Priority = 0, bool Force = false);
class cResumeFile {
private:
char *fileName;
+ bool isPesRecording;
public:
- cResumeFile(const char *FileName);
+ cResumeFile(const char *FileName, bool IsPesRecording);
~cResumeFile();
int Read(void);
bool Save(int Index);
@@ -46,10 +47,15 @@ private:
const cEvent *event;
cEvent *ownEvent;
char *aux;
+ double framesPerSecond;
+ int priority;
+ int lifetime;
+ char *fileName;
cRecordingInfo(const cChannel *Channel = NULL, const cEvent *Event = NULL);
void SetData(const char *Title, const char *ShortText, const char *Description);
void SetAux(const char *Aux);
public:
+ cRecordingInfo(const char *FileName);
~cRecordingInfo();
tChannelID ChannelID(void) const { return channelID; }
const char *ChannelName(void) const { return channelName; }
@@ -58,8 +64,12 @@ public:
const char *Description(void) const { return event->Description(); }
const cComponents *Components(void) const { return event->Components(); }
const char *Aux(void) const { return aux; }
+ double FramesPerSecond(void) const { return framesPerSecond; }
+ void SetFramesPerSecond(double FramesPerSecond);
bool Read(FILE *f);
bool Write(FILE *f, const char *Prefix = "") const;
+ bool Read(void);
+ bool Write(void) const;
};
class cRecording : public cListObject {
@@ -71,6 +81,10 @@ private:
mutable char *fileName;
mutable char *name;
mutable int fileSizeMB;
+ int channel;
+ int resumeId;
+ bool isPesRecording;
+ double framesPerSecond;
cRecordingInfo *info;
cRecording(const cRecording&); // can't copy cRecording
cRecording &operator=(const cRecording &); // can't assign cRecording
@@ -93,8 +107,10 @@ public:
const char *PrefixFileName(char Prefix);
int HierarchyLevels(void) const;
void ResetResume(void) const;
+ double FramesPerSecond(void) { return framesPerSecond; }
bool IsNew(void) const { return GetResume() <= 0; }
bool IsEdited(void) const;
+ bool IsPesRecording(void) const { return isPesRecording; }
bool WriteInfo(void);
bool Delete(void);
// Changes the file name so that it will no longer be visible in the "Recordings" menu
@@ -149,11 +165,15 @@ public:
extern cRecordings Recordings;
extern cRecordings DeletedRecordings;
+#define DEFAULTFRAMESPERSECOND 25.0
+
class cMark : public cListObject {
+private:
+ double framesPerSecond;
public:
int position;
char *comment;
- cMark(int Position = 0, const char *Comment = NULL);
+ cMark(int Position = 0, const char *Comment = NULL, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
virtual ~cMark();
cString ToText(void);
bool Parse(const char *s);
@@ -161,8 +181,10 @@ public:
};
class cMarks : public cConfig<cMark> {
+private:
+ double framesPerSecond;
public:
- bool Load(const char *RecordingFileName);
+ bool Load(const char *RecordingFileName, double FramesPerSecond = DEFAULTFRAMESPERSECOND, bool IsPesRecording = false);
void Sort(void);
cMark *Add(int Position);
cMark *Get(int Position);
@@ -182,9 +204,6 @@ public:
static void InvokeCommand(const char *State, const char *RecordingFileName);
};
-//XXX+
-#define FRAMESPERSEC 25
-
// The maximum size of a single frame (up to HDTV 1920x1080):
#define MAXFRAMESIZE KILOBYTE(512)
@@ -197,24 +216,27 @@ public:
#define MAXVIDEOFILESIZE 2000 // MB
#define MINVIDEOFILESIZE 100 // MB
+struct tIndexTs;
+
class cIndexFile {
private:
- struct tIndex { int offset; uchar type; uchar number; short reserved; };
int f;
char *fileName;
int size, last;
- tIndex *index;
+ tIndexTs *index;
+ bool isPesRecording;
cResumeFile resumeFile;
cMutex mutex;
+ void ConvertFromPes(tIndexTs *IndexTs, int Count);
bool CatchUp(int Index = -1);
public:
- cIndexFile(const char *FileName, bool Record);
+ cIndexFile(const char *FileName, bool Record, bool IsPesRecording = false);
~cIndexFile();
bool Ok(void) { return index != NULL; }
- bool Write(uchar PictureType, uchar FileNumber, int FileOffset);
- bool Get(int Index, uchar *FileNumber, int *FileOffset, uchar *PictureType = NULL, int *Length = NULL);
- int GetNextIFrame(int Index, bool Forward, uchar *FileNumber = NULL, int *FileOffset = NULL, int *Length = NULL, bool StayOffEnd = false);
- int Get(uchar FileNumber, int 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);
+ int GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber = NULL, off_t *FileOffset = NULL, int *Length = NULL, bool StayOffEnd = false);
+ int Get(uint16_t FileNumber, off_t FileOffset);
int Last(void) { CatchUp(); return last; }
int GetResume(void) { return resumeFile.Read(); }
bool StoreResume(int Index) { return resumeFile.Save(Index); }
@@ -228,22 +250,23 @@ private:
char *fileName, *pFileNumber;
bool record;
bool blocking;
+ bool isPesRecording;
public:
- cFileName(const char *FileName, bool Record, bool Blocking = false);
+ cFileName(const char *FileName, bool Record, bool Blocking = false, bool IsPesRecording = false);
~cFileName();
const char *Name(void) { return fileName; }
int Number(void) { return fileNumber; }
cUnbufferedFile *Open(void);
void Close(void);
- cUnbufferedFile *SetOffset(int Number, int Offset = 0);
+ cUnbufferedFile *SetOffset(int Number, off_t Offset = 0);
cUnbufferedFile *NextFile(void);
};
-cString IndexToHMSF(int Index, bool WithFrame = false);
+cString IndexToHMSF(int Index, bool WithFrame = false, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
// Converts the given index to a string, optionally containing the frame number.
-int HMSFToIndex(const char *HMSF);
+int HMSFToIndex(const char *HMSF, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
// Converts the given string (format: "hh:mm:ss.ff") to an index.
-int SecondsToFrames(int Seconds); //XXX+ ->player???
+int SecondsToFrames(int Seconds, double FramesPerSecond = DEFAULTFRAMESPERSECOND);
// Returns the number of frames corresponding to the given number of seconds.
int ReadFrame(cUnbufferedFile *f, uchar *b, int Length, int Max);