mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
- Updated the Estonian OSD texts (thanks to Arthur Konovalov). - Some cable providers don't mark short channel names according to the standard, but rather go their own way and use "name>short name". VDR now splits at this character for cable channels (thanks to Gerhard Steiner for reporting this one). - Added a check for Setup.DiSEqC in cDvbDevice::ProvidesTransponder(), otherwise the EPG scan didn't work on systems that don't use DiSEqC (thanks to Michael Reinelt for reporting this one). - Made the Makefile patch friendlier (thanks to Ludwig Nussel). - Made cOsd::isOpen an integer counter to avoid problems with messages when a cOsdObject uses the raw OSD (thanks to Andreas Regel for reporting this one). - Updated the Danish OSD texts (thanks to Mogens Elneff). - The file 'summary.vdr' has been replaced with 'info.vdr' and now contains the information about a recording, in the same format as the events are stored in 'epg.data' (see man vdr(5) for details). Existing summary files can be converted to the new format by running the Perl script 'summary2info.pl', as in summary2info.pl /video (the parameter given has to be the video directory). If there is no 'info.vdr' file for a recording, an attempt is made to read a 'summary.vdr'. - The "Summary" button in the "Recordings" menu has been renamed to "Info", and the page it brings up now shows the recording's information, much like the EPG event page. Therefore it now no longer uses the skin's SetText() function, but rather the SetRecording() function. Skin plugins may need to adjust that function accordingly (see skinsttng.c, for instance). - The SVDRP command LSTR now lists the recording information in the same tagged format as the LSTE command lists the EPG data. - The audio track menu now contains track descriptions when replaying (provided such descriptions were available in the EPG data when the recording was made, and are stored in the info.vdr file). - Avoiding extra blanks at the end of names of instant recordings. - Removed converting byte order on big endian systems from cDvbOsd::Flush(), which, according to Johannes Stezenbach and Paavo Hartikainen, is wrong. - Added cPlayer::DeviceSetVideoDisplayFormat() (thanks to Marco Schlüßler). - No longer saving the setup in case of a fatal error, to keep the volume level from being set to a wrong value (thanks to Marco Schlüßler). - Fixed a possible hangup when ending a replay session while cIndexFile::CatchUp() is waiting (thanks to Marco Schlüßler). - The SVDRP command DELR no longer deletes recordings that are currently being written to by a timer (thanks to Sascha Volkenandt for pointing out this one). - Pressing the "Play" key in live viewing mode now resumes a previous replay session (thanks to Mirko Dölle). - Now dropping EPG events that have a zero start time or duration (thanks to Oliver Endriss). - No longer stopping Transfer Mode or replay immediately when the Power button is pressed (thanks to Rolf Ahrenberg). - Moved the NPTL and UTF-8 checks after the version and help output (thanks to Andreas Kool for pointing out that 'vdr --version' failed on an UTF-8 system). - Made tChannelID::operator==() inline for better performance (thanks to Georg Acher). - Introduced cListBase::count for better performance (thanks to Georg Acher). - cEvent no longer stores the channelID directly, but rather has a pointer to the schedule it is in. - Now using hash tables to speed up cSchedule::GetEvent() (partially based on a patch from Georg Acher). - Avoiding unnecessary calls to getLength() in libsi/si.c, and avoiding the '& 0xff' in CRC32::crc32() of libsi/util.c (thanks to Georg Acher). - Speeded up deleting duplicate channels. - Fixed listing recordings with empty episode names in the LSTR command (thanks to Stefan Huelswitt for pointing this out). - Added cThread::SetPriority() and using it in cSectionHandler::Action() to reduce the priority of the section handler threads (as suggested by Georg Acher).
154 lines
3.8 KiB
C++
154 lines
3.8 KiB
C++
/*
|
|
* thread.h: A simple thread base class
|
|
*
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
* how to reach the author.
|
|
*
|
|
* $Id: thread.h 1.28 2005/05/29 11:31:24 kls Exp $
|
|
*/
|
|
|
|
#ifndef __THREAD_H
|
|
#define __THREAD_H
|
|
|
|
#include <pthread.h>
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
|
|
class cCondWait {
|
|
private:
|
|
pthread_mutex_t mutex;
|
|
pthread_cond_t cond;
|
|
bool signaled;
|
|
public:
|
|
cCondWait(void);
|
|
~cCondWait();
|
|
static void SleepMs(int TimeoutMs);
|
|
///< Creates a cCondWait object and uses it to sleep for TimeoutMs
|
|
///< milliseconds, immediately giving up the calling thread's time
|
|
///< slice and thus avoiding a "busy wait".
|
|
///< In order to avoid a possible busy wait, TimeoutMs will be automatically
|
|
///< limited to values >2.
|
|
bool Wait(int TimeoutMs = 0);
|
|
///< Waits at most TimeoutMs milliseconds for a call to Signal(), or
|
|
///< forever if TimeoutMs is 0.
|
|
///< \return Returns true if Signal() has been called, false it the given
|
|
///< timeout has expired.
|
|
void Signal(void);
|
|
///< Signals a caller of Wait() that the condition it is waiting for is met.
|
|
};
|
|
|
|
class cMutex;
|
|
|
|
class cCondVar {
|
|
private:
|
|
pthread_cond_t cond;
|
|
public:
|
|
cCondVar(void);
|
|
~cCondVar();
|
|
void Wait(cMutex &Mutex);
|
|
bool TimedWait(cMutex &Mutex, int TimeoutMs);
|
|
void Broadcast(void);
|
|
};
|
|
|
|
class cRwLock {
|
|
private:
|
|
pthread_rwlock_t rwlock;
|
|
public:
|
|
cRwLock(bool PreferWriter = false);
|
|
~cRwLock();
|
|
bool Lock(bool Write, int TimeoutMs = 0);
|
|
void Unlock(void);
|
|
};
|
|
|
|
class cMutex {
|
|
friend class cCondVar;
|
|
private:
|
|
pthread_mutex_t mutex;
|
|
int locked;
|
|
public:
|
|
cMutex(void);
|
|
~cMutex();
|
|
void Lock(void);
|
|
void Unlock(void);
|
|
};
|
|
|
|
class cThread {
|
|
friend class cThreadLock;
|
|
private:
|
|
bool running;
|
|
pthread_t childTid;
|
|
cMutex mutex;
|
|
char *description;
|
|
static bool emergencyExitRequested;
|
|
static void *StartThread(cThread *Thread);
|
|
protected:
|
|
void SetPriority(int Priority);
|
|
void Lock(void) { mutex.Lock(); }
|
|
void Unlock(void) { mutex.Unlock(); }
|
|
virtual void Action(void) = 0;
|
|
void Cancel(int WaitSeconds = 0);
|
|
public:
|
|
cThread(const char *Description = NULL);
|
|
virtual ~cThread();
|
|
void SetDescription(const char *Description, ...);
|
|
bool Start(void);
|
|
bool Active(void);
|
|
static bool EmergencyExit(bool Request = false);
|
|
};
|
|
|
|
// cMutexLock can be used to easily set a lock on mutex and make absolutely
|
|
// sure that it will be unlocked when the block will be left. Several locks can
|
|
// be stacked, so a function that makes many calls to another function which uses
|
|
// cMutexLock may itself use a cMutexLock to make one longer lock instead of many
|
|
// short ones.
|
|
|
|
class cMutexLock {
|
|
private:
|
|
cMutex *mutex;
|
|
bool locked;
|
|
public:
|
|
cMutexLock(cMutex *Mutex = NULL);
|
|
~cMutexLock();
|
|
bool Lock(cMutex *Mutex);
|
|
};
|
|
|
|
// cThreadLock can be used to easily set a lock in a thread and make absolutely
|
|
// sure that it will be unlocked when the block will be left. Several locks can
|
|
// be stacked, so a function that makes many calls to another function which uses
|
|
// cThreadLock may itself use a cThreadLock to make one longer lock instead of many
|
|
// short ones.
|
|
|
|
class cThreadLock {
|
|
private:
|
|
cThread *thread;
|
|
bool locked;
|
|
public:
|
|
cThreadLock(cThread *Thread = NULL);
|
|
~cThreadLock();
|
|
bool Lock(cThread *Thread);
|
|
};
|
|
|
|
#define LOCK_THREAD cThreadLock ThreadLock(this)
|
|
|
|
// cPipe implements a pipe that closes all unnecessary file descriptors in
|
|
// the child process.
|
|
|
|
class cPipe {
|
|
private:
|
|
pid_t pid;
|
|
FILE *f;
|
|
public:
|
|
cPipe(void);
|
|
~cPipe();
|
|
operator FILE* () { return f; }
|
|
bool Open(const char *Command, const char *Mode);
|
|
int Close(void);
|
|
};
|
|
|
|
// SystemExec() implements a 'system()' call that closes all unnecessary file
|
|
// descriptors in the child process.
|
|
|
|
int SystemExec(const char *Command);
|
|
|
|
#endif //__THREAD_H
|