mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
- Fixed resetting the file size when regenerating the index file. - The new function cDevice::PatPmtParser() can be used in derived devices to access the PAT/PMT of the currently replayed material. - Updated the Italian OSD texts (thanks to Diego Pierotto). - The PCR pid in generated PMTs is now set to 0x1FFF ("no PCR pid") in cPatPmtGenerator::GeneratePmt(), because VDR doesn't record the PCR pid. - Updated the Estonian OSD texts (thanks to Arthur Konovalov). - The 'sky' plugin is no longer part of the VDR source. - Improved SPU handling on devices with limited OSD capabilities (thanks to Matthieu Castet). - Several code modifications to avoid compiler warnings (thanks to Winfried Köhler). - Added stream type 11172 AUDIO to cPatPmtParser::ParsePmt() (thanks to Johann Friedrichs). - Removed debug output of '-' from cTransfer::Receive(). - Added defines for large files to the 'newplugin' script (reported by Udo Richter). - Removed the workaround for short channel names of "Kabel Deutschland", because apparently they now have their data according to the DVB standard (thanks to Johann Friedrichs). - Some fixes to dvbspu.[hc] (thanks to Johann Friedrichs). - Fixed a busy loop when moving editing marks (thanks to Johann Friedrichs). - Updated sources.conf (thanks to Derek Kelly). - Modified cCharSetConv so that it can be used to convert from "whatever VDR uses" to a given code (thanks to Joachim Wilke). - Channel names containing commas are now handled correctly in channels.conf. If a channel's short name contains a comma, it is replaced with a '.'. - cDevice now logs the device number when a new device is created. - Fixed handling STREAMTYPE_11172_AUDIO in cPatPmtParser::ParsePmt(). - cParsePatPmt now has functions to retrieve the audio, dolby and subtitle pids. - cPatFilter::Process() now only stores CA descriptors for video and audio pids (thanks to Francesco Saverio Schiavarelli for reporting a problem with channels that have some encrypted components that VDR doesn't use). - cDevice::AddPid() now stores the stream type of the given pid (thanks to Andreas Regel). - Added cFont::FontName() and cFont::Size() (thanks to Andreas Regel). - cPatPmtParser now also stores the audio stream types. - The support for full featured DVB cards of the TT/FuSi design has been moved into the new plugin 'dvbsddevice'. On systems that use such a card as their primary device, this plugin now needs to be loaded when running VDR in order to view live or recorded video. If the plugin is not loaded, the card will be treated like a budget DVB card, and there will be no OSD or viewing capability. - Fixed handling the "CA PMT" generation (revised a change not mentioned in version 1.7.9's changes, which caused a malfunction with Conax and Viaccess CAMs). - Fixed stopping subtitle display when switching the primary device (thanks to Anssi Hannula). IMPORTANT NOTE TO PLUGIN AUTHORS: a plugin that implements a derived cDevice class that can replay video must now call the MakePrimaryDevice() function of its base class. - Fixed compiler warnings "format not a string literal and no format arguments" in some syslog calls (thanks to Rolf Ahrenberg). - The new command line options --edit and --genindex can be used to edit a recording or generate its index without actually starting the entire VDR (based on a patch from Helmut Auer). - Improved the description of the transponder parameters in vdr.5 (thanks to Winfried Köhler). - Avoiding setting the video stream type to 2 if the vpid is 0 (problem reported by Arthur Konovalov). - Implemented handling the "Content Descriptor" (based on a patch from Rolf Ahrenberg). The 'classic', 'sttng' and 'curses' skins display the textual representation of the content descriptors as "genre". The epg.data file stores the genre using the tag character 'G'. - Implemented handling the "Parental Rating Descriptor" (based on a patch from Rolf Ahrenberg). The 'classic', 'sttng' and 'curses' skins display the parental rating (if given) in their event displays. The epg.data file stores the parental rating using the tag character 'R'. IMPORTANT NOTE: if VDR doesn't display a parental rating, this does not necessarily mean that the given programme is suitable for all audiences! - Rearranged cEvent members to minimize memory waste. - After a CLRE command, no further EPG processing is now done for 10 seconds, so that data sent with subsequent PUTE commands doesn't interfere with data from the broadcasters (suggested by Helmut Auer). - Added support for DVB cards with multiple fontends. Note that this only works for DVB cards where each frontend can be used independently of all the others on the same adapter. - Fixed plugin arguments corruption with glibc 2.11 on x86_64 (thanks to Anssi Hannula).
278 lines
11 KiB
C++
278 lines
11 KiB
C++
/*
|
|
* channels.h: Channel handling
|
|
*
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
* how to reach the author.
|
|
*
|
|
* $Id: channels.h 2.7 2009/12/06 12:57:45 kls Exp $
|
|
*/
|
|
|
|
#ifndef __CHANNELS_H
|
|
#define __CHANNELS_H
|
|
|
|
#include "config.h"
|
|
#include "sources.h"
|
|
#include "thread.h"
|
|
#include "tools.h"
|
|
|
|
#define ISTRANSPONDER(f1, f2) (abs((f1) - (f2)) < 4) //XXX
|
|
|
|
#define CHANNELMOD_NONE 0x00
|
|
#define CHANNELMOD_ALL 0xFF
|
|
#define CHANNELMOD_NAME 0x01
|
|
#define CHANNELMOD_PIDS 0x02
|
|
#define CHANNELMOD_ID 0x04
|
|
#define CHANNELMOD_CA 0x10
|
|
#define CHANNELMOD_TRANSP 0x20
|
|
#define CHANNELMOD_LANGS 0x40
|
|
#define CHANNELMOD_RETUNE (CHANNELMOD_PIDS | CHANNELMOD_CA | CHANNELMOD_TRANSP)
|
|
|
|
#define CHANNELSMOD_NONE 0
|
|
#define CHANNELSMOD_AUTO 1
|
|
#define CHANNELSMOD_USER 2
|
|
|
|
#define MAXAPIDS 32 // audio
|
|
#define MAXDPIDS 16 // dolby (AC3 + DTS)
|
|
#define MAXSPIDS 32 // subtitles
|
|
#define MAXCAIDS 8 // conditional access
|
|
|
|
#define MAXLANGCODE1 4 // a 3 letter language code, zero terminated
|
|
#define MAXLANGCODE2 8 // up to two 3 letter language codes, separated by '+' and zero terminated
|
|
|
|
#define CA_FTA 0x0000
|
|
#define CA_DVB_MIN 0x0001
|
|
#define CA_DVB_MAX 0x000F
|
|
#define CA_USER_MIN 0x0010
|
|
#define CA_USER_MAX 0x00FF
|
|
#define CA_ENCRYPTED_MIN 0x0100
|
|
#define CA_ENCRYPTED_MAX 0xFFFF
|
|
|
|
struct tChannelParameterMap {
|
|
int userValue;
|
|
int driverValue;
|
|
const char *userString;
|
|
};
|
|
|
|
int MapToUser(int Value, const tChannelParameterMap *Map, const char **String = NULL);
|
|
int MapToDriver(int Value, const tChannelParameterMap *Map);
|
|
int UserIndex(int Value, const tChannelParameterMap *Map);
|
|
int DriverIndex(int Value, const tChannelParameterMap *Map);
|
|
|
|
extern const tChannelParameterMap InversionValues[];
|
|
extern const tChannelParameterMap BandwidthValues[];
|
|
extern const tChannelParameterMap CoderateValues[];
|
|
extern const tChannelParameterMap ModulationValues[];
|
|
extern const tChannelParameterMap SystemValues[];
|
|
extern const tChannelParameterMap TransmissionValues[];
|
|
extern const tChannelParameterMap GuardValues[];
|
|
extern const tChannelParameterMap HierarchyValues[];
|
|
extern const tChannelParameterMap RollOffValues[];
|
|
|
|
struct tChannelID {
|
|
private:
|
|
int source;
|
|
int nid; ///< actually the "original" network id
|
|
int tid;
|
|
int sid;
|
|
int rid;
|
|
public:
|
|
tChannelID(void) { source = nid = tid = sid = rid = 0; }
|
|
tChannelID(int Source, int Nid, int Tid, int Sid, int Rid = 0) { source = Source; nid = Nid; tid = Tid; sid = Sid; rid = Rid; }
|
|
bool operator== (const tChannelID &arg) const { return source == arg.source && nid == arg.nid && tid == arg.tid && sid == arg.sid && rid == arg.rid; }
|
|
bool Valid(void) const { return (nid || tid) && sid; } // rid is optional and source may be 0//XXX source may not be 0???
|
|
tChannelID &ClrRid(void) { rid = 0; return *this; }
|
|
tChannelID &ClrPolarization(void);
|
|
int Source(void) { return source; }
|
|
int Nid(void) { return nid; }
|
|
int Tid(void) { return tid; }
|
|
int Sid(void) { return sid; }
|
|
int Rid(void) { return rid; }
|
|
static tChannelID FromString(const char *s);
|
|
cString ToString(void) const;
|
|
static const tChannelID InvalidID;
|
|
};
|
|
|
|
class cChannel;
|
|
|
|
class cLinkChannel : public cListObject {
|
|
private:
|
|
cChannel *channel;
|
|
public:
|
|
cLinkChannel(cChannel *Channel) { channel = Channel; }
|
|
cChannel *Channel(void) { return channel; }
|
|
};
|
|
|
|
class cLinkChannels : public cList<cLinkChannel> {
|
|
};
|
|
|
|
class cSchedule;
|
|
|
|
class cChannel : public cListObject {
|
|
friend class cSchedules;
|
|
friend class cMenuEditChannel;
|
|
private:
|
|
static cString ToText(const cChannel *Channel);
|
|
char *name;
|
|
char *shortName;
|
|
char *provider;
|
|
char *portalName;
|
|
int __BeginData__;
|
|
int frequency; // MHz
|
|
int source;
|
|
int srate;
|
|
int vpid;
|
|
int ppid;
|
|
int vtype;
|
|
int apids[MAXAPIDS + 1]; // list is zero-terminated
|
|
char alangs[MAXAPIDS][MAXLANGCODE2];
|
|
int dpids[MAXDPIDS + 1]; // list is zero-terminated
|
|
char dlangs[MAXDPIDS][MAXLANGCODE2];
|
|
int spids[MAXSPIDS + 1]; // list is zero-terminated
|
|
char slangs[MAXSPIDS][MAXLANGCODE2];
|
|
uchar subtitlingTypes[MAXSPIDS];
|
|
uint16_t compositionPageIds[MAXSPIDS];
|
|
uint16_t ancillaryPageIds[MAXSPIDS];
|
|
int tpid;
|
|
int caids[MAXCAIDS + 1]; // list is zero-terminated
|
|
int nid;
|
|
int tid;
|
|
int sid;
|
|
int rid;
|
|
int number; // Sequence number assigned on load
|
|
bool groupSep;
|
|
char polarization;
|
|
int inversion;
|
|
int bandwidth;
|
|
int coderateH;
|
|
int coderateL;
|
|
int modulation;
|
|
int system;
|
|
int transmission;
|
|
int guard;
|
|
int hierarchy;
|
|
int rollOff;
|
|
int __EndData__;
|
|
int modification;
|
|
mutable const cSchedule *schedule;
|
|
cLinkChannels *linkChannels;
|
|
cChannel *refChannel;
|
|
cString TransponderDataToString(void) const;
|
|
cString ParametersToString(void) const;
|
|
bool StringToParameters(const char *s);
|
|
public:
|
|
cChannel(void);
|
|
cChannel(const cChannel &Channel);
|
|
~cChannel();
|
|
cChannel& operator= (const cChannel &Channel);
|
|
cString ToText(void) const;
|
|
bool Parse(const char *s);
|
|
bool Save(FILE *f);
|
|
const char *Name(void) const { return name; }
|
|
const char *ShortName(bool OrName = false) const { return (OrName && isempty(shortName)) ? name : shortName; }
|
|
const char *Provider(void) const { return provider; }
|
|
const char *PortalName(void) const { return portalName; }
|
|
int Frequency(void) const { return frequency; } ///< Returns the actual frequency, as given in 'channels.conf'
|
|
int Transponder(void) const; ///< Returns the transponder frequency in MHz, plus the polarization in case of sat
|
|
static int Transponder(int Frequency, char Polarization); ///< builds the transponder from the given Frequency and Polarization
|
|
int Source(void) const { return source; }
|
|
int Srate(void) const { return srate; }
|
|
int Vpid(void) const { return vpid; }
|
|
int Ppid(void) const { return ppid; }
|
|
int Vtype(void) const { return vtype; }
|
|
const int *Apids(void) const { return apids; }
|
|
const int *Dpids(void) const { return dpids; }
|
|
const int *Spids(void) const { return spids; }
|
|
int Apid(int i) const { return (0 <= i && i < MAXAPIDS) ? apids[i] : 0; }
|
|
int Dpid(int i) const { return (0 <= i && i < MAXDPIDS) ? dpids[i] : 0; }
|
|
int Spid(int i) const { return (0 <= i && i < MAXSPIDS) ? spids[i] : 0; }
|
|
const char *Alang(int i) const { return (0 <= i && i < MAXAPIDS) ? alangs[i] : ""; }
|
|
const char *Dlang(int i) const { return (0 <= i && i < MAXDPIDS) ? dlangs[i] : ""; }
|
|
const char *Slang(int i) const { return (0 <= i && i < MAXSPIDS) ? slangs[i] : ""; }
|
|
uchar SubtitlingType(int i) const { return (0 <= i && i < MAXSPIDS) ? subtitlingTypes[i] : uchar(0); }
|
|
uint16_t CompositionPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? compositionPageIds[i] : uint16_t(0); }
|
|
uint16_t AncillaryPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? ancillaryPageIds[i] : uint16_t(0); }
|
|
int Tpid(void) const { return tpid; }
|
|
const int *Caids(void) const { return caids; }
|
|
int Ca(int Index = 0) const { return Index < MAXCAIDS ? caids[Index] : 0; }
|
|
int Nid(void) const { return nid; }
|
|
int Tid(void) const { return tid; }
|
|
int Sid(void) const { return sid; }
|
|
int Rid(void) const { return rid; }
|
|
int Number(void) const { return number; }
|
|
void SetNumber(int Number) { number = Number; }
|
|
bool GroupSep(void) const { return groupSep; }
|
|
char Polarization(void) const { return polarization; }
|
|
int Inversion(void) const { return inversion; }
|
|
int Bandwidth(void) const { return bandwidth; }
|
|
int CoderateH(void) const { return coderateH; }
|
|
int CoderateL(void) const { return coderateL; }
|
|
int Modulation(void) const { return modulation; }
|
|
int System(void) const { return system; }
|
|
int Transmission(void) const { return transmission; }
|
|
int Guard(void) const { return guard; }
|
|
int Hierarchy(void) const { return hierarchy; }
|
|
int RollOff(void) const { return rollOff; }
|
|
const cLinkChannels* LinkChannels(void) const { return linkChannels; }
|
|
const cChannel *RefChannel(void) const { return refChannel; }
|
|
bool IsCable(void) const { return cSource::IsCable(source); }
|
|
bool IsSat(void) const { return cSource::IsSat(source); }
|
|
bool IsTerr(void) const { return cSource::IsTerr(source); }
|
|
tChannelID GetChannelID(void) const { return tChannelID(source, nid, (nid || tid) ? tid : Transponder(), sid, rid); }
|
|
bool HasTimer(void) const;
|
|
int Modification(int Mask = CHANNELMOD_ALL);
|
|
void CopyTransponderData(const cChannel *Channel);
|
|
bool SetSatTransponderData(int Source, int Frequency, char Polarization, int Srate, int CoderateH, int Modulation, int System, int RollOff);
|
|
bool SetCableTransponderData(int Source, int Frequency, int Modulation, int Srate, int CoderateH);
|
|
bool SetTerrTransponderData(int Source, int Frequency, int Bandwidth, int Modulation, int Hierarchy, int CodeRateH, int CodeRateL, int Guard, int Transmission);
|
|
void SetId(int Nid, int Tid, int Sid, int Rid = 0);
|
|
void SetName(const char *Name, const char *ShortName, const char *Provider);
|
|
void SetPortalName(const char *PortalName);
|
|
void SetPids(int Vpid, int Ppid, int Vtype, int *Apids, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int *Spids, char SLangs[][MAXLANGCODE2], int Tpid);
|
|
void SetCaIds(const int *CaIds); // list must be zero-terminated
|
|
void SetCaDescriptors(int Level);
|
|
void SetLinkChannels(cLinkChannels *LinkChannels);
|
|
void SetRefChannel(cChannel *RefChannel);
|
|
void SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds);
|
|
};
|
|
|
|
class cChannels : public cRwLock, public cConfig<cChannel> {
|
|
private:
|
|
int maxNumber;
|
|
int modified;
|
|
int beingEdited;
|
|
cHash<cChannel> channelsHashSid;
|
|
void DeleteDuplicateChannels(void);
|
|
public:
|
|
cChannels(void);
|
|
bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
|
|
void HashChannel(cChannel *Channel);
|
|
void UnhashChannel(cChannel *Channel);
|
|
int GetNextGroup(int Idx); // Get next channel group
|
|
int GetPrevGroup(int Idx); // Get previous channel group
|
|
int GetNextNormal(int Idx); // Get next normal channel (not group)
|
|
int GetPrevNormal(int Idx); // Get previous normal channel (not group)
|
|
void ReNumber(void); // Recalculate 'number' based on channel type
|
|
cChannel *GetByNumber(int Number, int SkipGap = 0);
|
|
cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID);
|
|
cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false);
|
|
cChannel *GetByTransponderID(tChannelID ChannelID);
|
|
int BeingEdited(void) { return beingEdited; }
|
|
void IncBeingEdited(void) { beingEdited++; }
|
|
void DecBeingEdited(void) { beingEdited--; }
|
|
bool HasUniqueChannelID(cChannel *NewChannel, cChannel *OldChannel = NULL);
|
|
bool SwitchTo(int Number);
|
|
int MaxNumber(void) { return maxNumber; }
|
|
void SetModified(bool ByUser = false);
|
|
int Modified(void);
|
|
///< Returns 0 if no channels have been modified, 1 if an automatic
|
|
///< modification has been made, and 2 if the user has made a modification.
|
|
///< Calling this function resets the 'modified' flag to 0.
|
|
cChannel *NewChannel(const cChannel *Transponder, const char *Name, const char *ShortName, const char *Provider, int Nid, int Tid, int Sid, int Rid = 0);
|
|
};
|
|
|
|
extern cChannels Channels;
|
|
|
|
cString ChannelString(const cChannel *Channel, int Number);
|
|
|
|
#endif //__CHANNELS_H
|