vdr/timers.h
Klaus Schmidinger 7df66b0587 Version 1.7.20
Original announce message:
VDR developer version 1.7.20 is now available at

       ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.20.tar.bz2

A 'diff' against the previous version is available at

       ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.19-1.7.20.diff

MD5 checksums:

eda2911fff1715ba5b1482b20ad18188  vdr-1.7.20.tar.bz2
a8f5bcaf3294cc9fce87283a618d5ce1  vdr-1.7.19-1.7.20.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.

This version contains functions to determine the "signal strength"
and "signal quality" through cDevice. If you are using a DVB card that
contains an stb0899 frontend chip (like the TT-budget S2-3200) you may
want to apply the patches from

   ftp://ftp.tvdr.de/vdr/Developer/Driver-Patches

to the LinuxDVB driver source in order to receive useful results from
that frontend.

From the HISTORY file:
- Added some missing 'const' to tChannelID (reported by Sundararaj Reel).
- The isnumber() function now checks the given pointer for NULL (thanks to Holger
  Dengler).
- Now checking Setup.InitialChannel for NULL before using it (reported by
  Christoph Haubrich).
- cSkins::Message() now blocks calls from background threads (thanks to Michael
  Eiler for reporting a crash in such a scenario).
- Fixed the return value of the svdrpsend.pl script in case of an error (thanks to
  Jonas Diemer).
- Increased MAXCAIDS to 12 (thanks to Jerome Lacarriere).
- Fixed handling DiSEqC codes (thanks to Mark Hawes for reporting the bug, and
  Udo Richter for suggesting the fix).
- Added a mechanism to defer timer handling in case of problems (reported by
  Frank Niederwipper).
- Fixed distortions that happened when splitting recording into several files
  (was a side effect of "Fixed detecting frames in case the Picture Start Code or
  Access Unit Delimiter extends over TS packet boundaries" in version 1.7.19).
  cRecorder::Action() now buffers TS packets in case the frame type is
  not yet known when a new payload starts. This adds no overhead for channels
  that broadcast the frame type within the first TS packet of a payload; it only
  kicks in if that information is not in the first TS packet.
- Fixed handling the channelID in cMenuEditChanItem (thanks to Udo Richter).
- cStringList::Sort() can now be called with a boolean parameter that controls
  case insensitive sorting (suggested by Sundararaj Reel).
- Now scanning new transponders before old ones, to make sure transponder changes
  are recognized (thanks to Reinhard Nissl).
- Implemented static cIndexFile::IndexFileName().
- The length (as number of frames) of a recording's index file can now be determined
  by a call to cIndexFile::GetLength() (suggested by Christoph Haubrich).
- Fixed some crashes in subtitle display (thanks to Rolf Ahrenberg).
- Made DELETENULL() thread safe (reported by Rolf Ahrenberg).
- The pic2mpg script of the 'pictures' plugin now generates HD images (thanks to
  Andre Weidemann for his support in using convert/ffmpeg). The old SD version is
  still available as pic2mpg-sd.
- Added a mutex to protect cOsd::Osds from simultaneous access from different threads
  (reported by Rolf Ahrenberg).
- The cutter now sets the 'broken link' flag for MPEG2 TS recordings (thanks to
  Oliver Endriss).
- Fixed language code entry for Portuguese.
- The new command line options --filesize (suggested by Marco Göbenich) and --split
  can be used together with --edit to set the maximum video file size and turn on
  splitting edited files at the editing marks. These options must be given before
  --edit to have an effect.
- cTimeMs is no longer initialized to the current time if the value given to the
  constructor is negative (avoids the "cTimeMs: using monotonic clock..." log message
  before VDR's starting log message).
2011-08-16 20:32:01 +02:00

133 lines
4.5 KiB
C++

/*
* timers.h: Timer handling
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.h 2.1 2011/08/06 12:59:32 kls Exp $
*/
#ifndef __TIMERS_H
#define __TIMERS_H
#include "channels.h"
#include "config.h"
#include "epg.h"
#include "tools.h"
enum eTimerFlags { tfNone = 0x0000,
tfActive = 0x0001,
tfInstant = 0x0002,
tfVps = 0x0004,
tfRecording = 0x0008,
tfAll = 0xFFFF,
};
enum eTimerMatch { tmNone, tmPartial, tmFull };
class cTimer : public cListObject {
friend class cMenuEditTimer;
private:
mutable time_t startTime, stopTime;
time_t lastSetEvent;
mutable time_t deferred; ///< Matches(time_t, ...) will return false if the current time is before this value
bool recording, pending, inVpsMargin;
uint flags;
cChannel *channel;
mutable time_t day; ///< midnight of the day this timer shall hit, or of the first day it shall hit in case of a repeating timer
int weekdays; ///< bitmask, lowest bits: SSFTWTM (the 'M' is the LSB)
int start;
int stop;
int priority;
int lifetime;
mutable char file[MaxFileName];
char *aux;
const cEvent *event;
public:
cTimer(bool Instant = false, bool Pause = false, cChannel *Channel = NULL);
cTimer(const cEvent *Event);
cTimer(const cTimer &Timer);
virtual ~cTimer();
cTimer& operator= (const cTimer &Timer);
virtual int Compare(const cListObject &ListObject) const;
bool Recording(void) const { return recording; }
bool Pending(void) const { return pending; }
bool InVpsMargin(void) const { return inVpsMargin; }
uint Flags(void) const { return flags; }
const cChannel *Channel(void) const { return channel; }
time_t Day(void) const { return day; }
int WeekDays(void) const { return weekdays; }
int Start(void) const { return start; }
int Stop(void) const { return stop; }
int Priority(void) const { return priority; }
int Lifetime(void) const { return lifetime; }
const char *File(void) const { return file; }
time_t FirstDay(void) const { return weekdays ? day : 0; }
const char *Aux(void) const { return aux; }
time_t Deferred(void) const { return deferred; }
cString ToText(bool UseChannelID = false) const;
cString ToDescr(void) const;
const cEvent *Event(void) const { return event; }
bool Parse(const char *s);
bool Save(FILE *f);
bool IsSingleEvent(void) const;
static int GetMDay(time_t t);
static int GetWDay(time_t t);
bool DayMatches(time_t t) const;
static time_t IncDay(time_t t, int Days);
static time_t SetTime(time_t t, int SecondsFromMidnight);
char *SetFile(const char *File);
bool Matches(time_t t = 0, bool Directly = false, int Margin = 0) const;
int Matches(const cEvent *Event, int *Overlap = NULL) const;
bool Expired(void) const;
time_t StartTime(void) const;
time_t StopTime(void) const;
void SetEventFromSchedule(const cSchedules *Schedules = NULL);
void SetEvent(const cEvent *Event);
void SetRecording(bool Recording);
void SetPending(bool Pending);
void SetInVpsMargin(bool InVpsMargin);
void SetPriority(int Priority);
void SetDeferred(int Seconds);
void SetFlags(uint Flags);
void ClrFlags(uint Flags);
void InvFlags(uint Flags);
bool HasFlags(uint Flags) const;
void Skip(void);
void OnOff(void);
cString PrintFirstDay(void) const;
static int TimeToInt(int t);
static bool ParseDay(const char *s, time_t &Day, int &WeekDays);
static cString PrintDay(time_t Day, int WeekDays, bool SingleByteChars);
};
class cTimers : public cConfig<cTimer> {
private:
int state;
int beingEdited;
time_t lastSetEvents;
time_t lastDeleteExpired;
public:
cTimers(void);
cTimer *GetTimer(cTimer *Timer);
cTimer *GetMatch(time_t t);
cTimer *GetMatch(const cEvent *Event, int *Match = NULL);
cTimer *GetNextActiveTimer(void);
int BeingEdited(void) { return beingEdited; }
void IncBeingEdited(void) { beingEdited++; }
void DecBeingEdited(void) { if (!--beingEdited) lastSetEvents = 0; }
void SetModified(void);
bool Modified(int &State);
///< Returns true if any of the timers have been modified, which
///< is detected by State being different than the internal state.
///< Upon return the internal state will be stored in State.
void SetEvents(void);
void DeleteExpired(void);
void Add(cTimer *Timer, cTimer *After = NULL);
void Ins(cTimer *Timer, cTimer *Before = NULL);
void Del(cTimer *Timer, bool DeleteObject = true);
};
extern cTimers Timers;
#endif //__TIMERS_H