10#define MUTE_DEPRECATED_FLUSH
28 virtual void Receive(
const uchar *Data,
int Length)
override;
70#define MIN_PRE_1_3_19_PRIVATESTREAM 10
120 esyslog(
"ERROR: too many devices!");
136 for (time_t t0 = time(NULL); time(NULL) - t0 < Timeout; ) {
164 esyslog(
"ERROR: invalid value in nextCardIndex(%d)", n);
205 isyslog(
"setting primary device to %d", n + 1);
215 esyslog(
"ERROR: invalid primary device number: %d", n + 1);
244 int MaxNumProvidedSystems = (1 << AvailableBits) - 1;
246 if (NumProvidedSystems > MaxNumProvidedSystems) {
247 esyslog(
"ERROR: device %d supports %d modulation systems but cDevice::GetDevice() currently only supports %d delivery systems which should be fixed", Device->
DeviceNumber() + 1, NumProvidedSystems, MaxNumProvidedSystems);
248 NumProvidedSystems = MaxNumProvidedSystems;
250 else if (NumProvidedSystems <= 0) {
251 esyslog(
"ERROR: device %d reported an invalid number (%d) of supported delivery systems - assuming 1", Device->
DeviceNumber() + 1, NumProvidedSystems);
252 NumProvidedSystems = 1;
254 return NumProvidedSystems;
261 int SlotPriority[NumCamSlots + 1];
262 int NumUsableSlots = 0;
263 bool InternalCamNeeded =
false;
277 InternalCamNeeded =
true;
280 bool NeedsDetachReceivers =
false;
284 uint32_t Impact = 0xFFFFFFFF;
285 for (
int j = 0; j < NumCamSlots || !NumUsableSlots; j++) {
286 if (NumUsableSlots && SlotPriority[j] >
MAXPRIORITY)
299 bool OccupiedOtherTransponder = !TunedToTransponder &&
device[i]->
Occupied();
300 if (OccupiedOtherTransponder)
305 if ((csj->
MtdActive() ? csi->MasterSlot() : csi) != csj)
324 imp <<= 1; imp |= ndr;
325 imp <<= 1; imp |= (NumUsableSlots || InternalCamNeeded) ? 0 :
device[i]->
HasCi();
333 NeedsDetachReceivers = ndr;
344 if (!Query && NeedsDetachReceivers)
439 if (d->IsTunedToTransponder(Channel))
441 if (d->ProvidesTransponder(Channel)) {
442 if (d->MaySwitchTransponder(Channel))
458 if (!cs->IsDecrypting() && !cs->IsActivating())
491 int fd = open(FileName, O_WRONLY | O_CREAT | O_NOFOLLOW | O_TRUNC, DEFFILEMODE);
496 if (
safe_write(fd, Image, ImageSize) == ImageSize)
497 isyslog(
"grabbed image to %s", FileName);
522 switch (VideoDisplayFormat) {
532 default:
esyslog(
"ERROR: invalid value for VideoDisplayFormat '%d'", VideoDisplayFormat);
579 if (Pid || PidType ==
ptPcr) {
582 if (PidType !=
ptPcr) {
639 NotifySlot->
SetPid(Pid,
true);
648 if (Pid || PidType ==
ptPcr) {
650 if (PidType ==
ptPcr)
675 NotifySlot->
SetPid(Pid,
false);
726 return safe_read(Handle, Buffer, Length);
807bool cDevice::SignalStats(
int &Valid,
double *Strength,
double *Cnr,
double *BerPre,
double *BerPost,
double *Per,
int *Status)
const
854 for (
int i = 3; i--;) {
856 case scrOk:
return true;
862 default:
esyslog(
"ERROR: invalid return value from SetChannel");
872 Direction =
sgn(Direction);
880 while ((Channel = Channels->GetByNumber(n, Direction)) != NULL) {
884 n = Channel->
Number() + Direction;
889 dsyslog(
"skipped channel %d", first);
891 dsyslog(
"skipped channels %d..%d", first, n -
sgn(d));
927 bool NeedsTransferMode = LiveView && Device !=
PrimaryDevice();
931 NeedsTransferMode =
true;
938 if (NeedsTransferMode) {
955 cs->AddChannel(Channel);
965 cs->StartDecrypting();
971 if (Result ==
scrOk) {
986 if (!NeedsTransferMode)
996 if (NeedsTransferMode)
1020 return Seconds > 0 ? Seconds : 0;
1099 return (0 <= c && c <= 2) ? c : 0;
1104 if (0 <= AudioChannel && AudioChannel <= 2)
1128 if (DescriptionsOnly) {
1173 esyslog(
"ERROR: SetAvailableTrack called with invalid Type/Index (%d/%d)", Type, Index);
1195 for (
int i = FirstTrack; i <= LastTrack; i++) {
1267 if (TrackId && TrackId->
id) {
1290 int PreferredAudioChannel = 0;
1291 int LanguagePreference = -1;
1294 for (
int i = StartCheck; i <= EndCheck; i++) {
1299 PreferredAudioChannel = pos;
1310 dsyslog(
"setting audio track to %d (%d)", PreferredTrack, PreferredAudioChannel);
1323 int LanguagePreference = INT_MAX;
1389 if (Data[0] == 0x47) {
1395 int Pid =
TsPid(Data);
1405 int NewSize = Size + l;
1406 if (
uchar *NewBuffer = (
uchar *)realloc(buf, NewSize)) {
1409 memcpy(buf + Offset, p, l);
1427 int NewSize = Size + l;
1428 if (
uchar *NewBuffer = (
uchar *)realloc(buf, NewSize)) {
1431 memcpy(buf + Offset, p, l);
1434 esyslog(
"ERROR: out of memory");
1483 if (Player &&
player == Player) {
1557 bool FirstLoop =
true;
1561 while (
Start < End) {
1562 int d = End -
Start;
1579 int PayloadOffset = Data[8] + 9;
1582 if ((Data[7] & 0x01) && (Data[PayloadOffset - 3] & 0x81) == 0x01 && Data[PayloadOffset - 2] == 0x81)
1585 uchar SubStreamId = Data[PayloadOffset];
1586 uchar SubStreamType = SubStreamId & 0xF0;
1587 uchar SubStreamIndex = SubStreamId & 0x1F;
1590pre_1_3_19_PrivateStreamDetected:
1593 SubStreamType = 0x80;
1598 switch (SubStreamType) {
1627 dsyslog(
"switching to pre 1.3.19 Dolby Digital compatibility mode - substream id = %02X", SubStreamId);
1630 goto pre_1_3_19_PrivateStreamDetected;
1643 esyslog(
"ERROR: incomplete PES packet write!");
1660 while (i <= Length - 6) {
1661 if (Data[i] == 0x00 && Data[i + 1] == 0x00 && Data[i + 2] == 0x01) {
1663 if (i + l > Length) {
1664 esyslog(
"ERROR: incomplete PES packet!");
1671 return i == 0 ? w : i;
1677 esyslog(
"ERROR: leftover PES data!");
1741 return Data ? Length : 1;
1753 esyslog(
"ERROR: skipped %d bytes of TS fragment", Length);
1758 if (
int Skipped =
TS_SYNC(Data, Length))
1759 return Played + Skipped;
1760 int Pid =
TsPid(Data);
1763 if (PayloadOffset <
TS_SIZE) {
1772 return Played ? Played : w;
1780 return Played ? Played : w;
1795 return Played ? Played : w;
1837#define TS_SCRAMBLING_TIMEOUT 3
1838#define TS_SCRAMBLING_TIME_OK 3
1839#define EIT_INJECTION_TIME 10
1859 if (Receiver && Receiver->
WantsPid(Pid)) {
1867 time_t Now = time(NULL);
1891 time_t Now = time(NULL);
1931 if (Receiver->
device ==
this)
1935#ifdef WAIT_FOR_TUNER_LOCK
1936#define TUNER_LOCK_TIMEOUT 5000
1937 if (!
HasLock(TUNER_LOCK_TIMEOUT)) {
1945 for (
int n = 0; n < Receiver->
numPids; n++) {
1978 esyslog(
"ERROR: no free receiver slot!");
1984 if (!Receiver || Receiver->
device !=
this)
1986 bool receiversLeft =
false;
1992 receiversLeft =
true;
1999 for (
int n = 0; n < Receiver->
numPids; n++)
2003 cs->StartDecrypting();
2019 if (Receiver && Receiver->
WantsPid(Pid))
2065 bool firstRead =
true;
2068 if (firstRead || Poller.
Poll(100)) {
2072 if (errno == EOVERFLOW)
2097 for (
int i = 1; i < Count; i++) {
2104 esyslog(
"ERROR: skipped %d bytes to sync on TS packet on device %d", Count,
deviceNumber);
#define LOCK_CHANNELS_READ
cChannelCamRelations ChannelCamRelations
void PlayAudio(const uchar *Data, int Length, uchar Id)
void PlayTsAudio(const uchar *Data, int Length)
bool MtdActive(void)
Returns true if MTD is currently active.
virtual bool IsDecrypting(void)
Returns true if the CAM in this slot is currently used for decrypting.
virtual void InjectEit(int Sid)
Injects a generated EIT with a "present event" for the given Sid into the TS data stream sent to the ...
int Priority(void)
Returns the priority of the device this slot is currently assigned to, or IDLEPRIORITY if it is not a...
cCamSlot * MasterSlot(void)
Returns this CAM slot's master slot, or a pointer to itself if it is a master slot.
int MasterSlotNumber(void)
Returns the number of this CAM's master slot within the whole system.
virtual eModuleStatus ModuleStatus(void)
Returns the status of the CAM in this slot.
bool WantsTsData(void) const
Returns true if this CAM slot wants to receive the TS data through its Decrypt() function.
virtual bool Assign(cDevice *Device, bool Query=false)
Assigns this CAM slot to the given Device, if this is possible.
cDevice * Device(void)
Returns the device this CAM slot is currently assigned to.
virtual void SetPid(int Pid, bool Active)
Sets the given Pid (which has previously been added through a call to AddPid()) to Active.
virtual void StartDecrypting(void)
Sends all CA_PMT entries to the CAM that have been modified since the last call to this function.
virtual bool IsActivating(void)
Returns true if this CAM slot is currently activating a smart card.
virtual bool TsPostProcess(uchar *Data)
If there is a cCiSession that needs to do additional processing on TS packets (after the CAM has done...
cCamSlot * MtdSpawn(void)
If this CAM slot can do MTD ("Multi Transponder Decryption"), a call to this function returns a cMtdC...
virtual bool ProvidesCa(const int *CaSystemIds)
Returns true if the CAM in this slot provides one of the given CaSystemIds.
int NumReadyMasterSlots(void)
Returns the number of master CAM slots in the system that are ready to decrypt.
void SetChecked(tChannelID ChannelID, int CamSlotNumber)
bool CamDecrypt(tChannelID ChannelID, int CamSlotNumber)
bool CamChecked(tChannelID ChannelID, int CamSlotNumber)
void SetDecrypt(tChannelID ChannelID, int CamSlotNumber)
const char * Slang(int i) const
const char * Name(void) const
tChannelID GetChannelID(void) const
int Ca(int Index=0) const
const char * Dlang(int i) const
const int * Caids(void) const
const char * Alang(int i) const
static void SleepMs(int TimeoutMs)
Creates a cCondWait object and uses it to sleep for TimeoutMs milliseconds, immediately giving up the...
static void Shutdown(void)
static void Launch(cControl *Control)
virtual bool DeviceProvidesEIT(const cDevice *Device) const
Returns true if the given Device can provide EIT data.
cDeviceHook(void)
Creates a new device hook object.
virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const
Returns true if the given Device can provide the given Channel's transponder.
std::atomic< eTrackType > currentAudioTrack
static int NextCardIndex(int n=0)
Calculates the next card index.
int Occupied(int Priority=MINPRIORITY) const
Returns the number of seconds this device is still occupied for with a priority >= Priority.
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
static cList< cDeviceHook > deviceHooks
bool Replaying(void) const
Returns true if we are currently replaying.
virtual bool Poll(cPoller &Poller, int TimeoutMs=0)
Returns true if the device itself or any of the file handles in Poller is ready for further action.
int currentAudioTrackMissingCount
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
int Priority(bool IgnoreOccupied=false) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY),...
virtual bool SignalStats(int &Valid, double *Strength=NULL, double *Cnr=NULL, double *BerPre=NULL, double *BerPost=NULL, double *Per=NULL, int *Status=NULL) const
Returns statistics about the currently received signal (if available).
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
cSectionHandler * sectionHandler
bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual=false)
Sets the current subtitle track to the given Type.
virtual bool HasInternalCam(void)
Returns true if this device handles encrypted channels itself without VDR assistance.
virtual uchar * GrabImage(int &Size, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1)
Grabs the currently visible screen image.
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect)
Returns the Width, Height and VideoAspect ratio of the currently displayed video material.
bool GrabImageFile(const char *FileName, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1)
Calls GrabImage() and stores the resulting image in a file with the given name.
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
cMutex mutexCurrentAudioTrack
virtual const cPositioner * Positioner(void) const
Returns a pointer to the positioner (if any) this device has used to move the satellite dish to the r...
bool GetTrackId(eTrackType Type, tTrackId &TrackId)
Copies the given track id into TrackId and returns true, or returns false if Type is not a valid trac...
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly=false)
Plays all valid PES packets in Data with the given Length.
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
void ReleaseCamSlot(void)
Releases the CAM slot if it is currently not used.
virtual void Action(void) override
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
cDvbSubtitleConverter * dvbSubtitleConverter
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
bool autoSelectPreferredSubtitleLanguage
static bool WaitForAllDevicesReady(int Timeout=0)
Waits until all devices have become ready, or the given Timeout (seconds) has expired.
void SetCamSlot(cCamSlot *CamSlot)
Sets the given CamSlot to be used with this device.
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise.
static cDevice * PrimaryDevice(void)
Returns the primary device.
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
virtual bool MaySwitchTransponder(const cChannel *Channel) const
Returns true if it is ok to switch to the Channel's transponder on this device, without disturbing an...
eTrackType GetCurrentSubtitleTrack(void) const
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
static void Shutdown(void)
Closes down all devices.
eTrackType GetCurrentAudioTrack(void) const
bool DeviceHooksProvidesEIT(void) const
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices - 1).
virtual void SetPowerSaveMode(bool On)
Puts the device into power save mode, if applicable.
virtual bool DrainDevice(void)
Tells the device to play out all data it still holds in its buffers and decoders (data may be held ba...
virtual bool ProvidesEIT(void) const
Returns true if this device provides EIT data and thus wants to be tuned to the channels it can recei...
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
cReceiver * receiver[MAXRECEIVERS]
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
bool IsPrimaryDevice(bool CheckDecoder=true) const
virtual bool AvoidRecording(void) const
Returns true if this device should only be used for recording if no other device is available.
static cDevice * primaryDevice
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
bool Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
void StopReplay(void)
Stops the current replay session (if any).
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const
Returns true if this is the only device that is able to provide the given channel's transponder.
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
virtual bool ProvidesChannel(const cChannel *Channel, int Priority=IDLEPRIORITY, bool *NeedsDetachReceivers=NULL) const
Returns true if this device can provide the given channel.
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
int GetAudioChannel(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
cPidHandle pidHandles[MAXPIDHANDLES]
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
void Detach(cFilter *Filter)
Detaches the given filter from this device.
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
virtual bool OpenDvr(void)
Opens the DVR of this device and prepares it to deliver a Transport Stream for use in a cReceiver.
const tTrackId * GetTrack(eTrackType Type)
Returns a pointer to the given track id, or NULL if Type is not less than ttMaxTrackTypes.
void SetVolume(int Volume, bool Absolute=false)
Sets the volume to the given value, either absolutely or relative to the current volume.
virtual void TrickSpeed(int Speed, bool Forward)
Sets the device into a mode where replay is done slower.
cLiveSubtitle * liveSubtitle
virtual void Mute(void)
Turns off audio while replaying.
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
static int NumDevices(void)
Returns the total number of devices.
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
Sets the video display format to the given one (only useful if this device has an MPEG decoder).
virtual bool Flush(int TimeoutMs=0)
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
virtual void SetVideoFormat(bool VideoFormat16_9)
Sets the output video format to either 16:9 or 4:3 (only useful if this device has an MPEG decoder).
virtual void CloseDvr(void)
Shuts down the DVR.
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
virtual bool HasProgramme(void) const
Returns true if the device is currently showing any programme to the user, either through replaying o...
friend class cLiveSubtitle
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
std::atomic< cPlayer * > player
virtual cSpuDecoder * GetSpuDecoder(void)
Returns a pointer to the device's SPU decoder (or NULL, if this device doesn't have an SPU decoder).
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds.
virtual bool Ready(void)
Returns true if this device is ready.
static cDevice * GetDeviceForTransponder(const cChannel *Channel, int Priority)
Returns a device that is not currently "occupied" and can be tuned to the transponder of the given Ch...
virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect)
Returns the Width, Height and PixelAspect ratio the OSD should use to best fit the resolution of the ...
tTrackId availableTracks[ttMaxTrackTypes]
virtual bool GetTSPacket(uchar *&Data)
Gets exactly one TS packet from the DVR of this device and returns a pointer to it in Data.
virtual void Clear(void)
Clears all video and audio data from the device.
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
cCamSlot * CamSlot(void) const
Returns the CAM slot that is currently used with this device, or NULL if no CAM slot is in use.
bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language=NULL, const char *Description=NULL)
Sets the track of the given Type and Index to the given values.
void SetOccupied(int Seconds, int Priority=MINPRIORITY, time_t From=0)
Sets the occupied timeout for this device to the given number of Seconds, This can be used to tune a ...
std::atomic< eTrackType > currentSubtitleTrack
bool Drain(void)
Tells the device that the last data of the current stream has been delivered and no more will follow,...
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly=false)
Plays the single PES packet in Data with the given Length.
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
void SetPowerSaveIfUnused(void)
Sets this device into a power save mode if it is not currently used and has implemented SetPowerSaveM...
void DelLivePids(void)
Deletes the live viewing PIDs.
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
cPatPmtParser patPmtParser
bool AddPid(int Pid, ePidType PidType=ptOther, int StreamType=0)
Adds a PID to the set of PIDs this device shall receive.
virtual ~cDevice() override
cMutex mutexCurrentSubtitleTrack
int pre_1_3_19_PrivateStream
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask)
Opens a file handle for the given filter data.
static cDevice * device[MAXDEVICES]
std::atomic< cCamSlot * > camSlot
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
void SetTempSubtitles(void)
Temporarily turn on subtitles after a fast rewind during reply.
virtual bool ProvidesTransponder(const cChannel *Channel) const
Returns true if this device can provide the transponder of the given Channel (which implies that it c...
virtual void SetDigitalAudioDevice(bool On)
Tells the output device that the current audio track is Dolby Digital.
static std::atomic< int > currentChannel
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
int Convert(const uchar *Data, int Length)
void SetTempVisible(void)
void SetVisible(bool Visible)
int ConvertFragments(const uchar *Data, int Length)
void Add(cListObject *Object, cListObject *After=NULL)
const T * First(void) const
Returns the first element in this list, or NULL if the list is empty.
const T * Next(const T *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
const T * Get(int Index) const
Returns the list element at the given Index, or NULL if no such element exists.
virtual ~cLiveSubtitle() override
virtual void Receive(const uchar *Data, int Length) override
This function is called from the cDevice we are attached to, and delivers one TS packet from the set ...
bool Lock(int TimeoutMs=0, bool *TimedOut=NULL)
Returns true if the mutex was successfully locked.
cNitFilter(cSdtFilter *SdtFilter)
void Reset(void)
Resets the parser.
void ParsePat(const uchar *Data, int Length)
Parses the PAT data from the single TS packet in Data.
void ParsePmt(const uchar *Data, int Length)
Parses the PMT data from the single TS packet in Data.
bool IsPmtPid(int Pid) const
Returns true if Pid the one of the PMT pids as defined by the current PAT.
int Ppid(void) const
Returns the PCR pid as defined by the current PMT, or 0 if no PCR pid has been detected,...
int Vpid(void) const
Returns the video pid as defined by the current PMT, or 0 if no video pid has been detected,...
std::atomic< cDevice * > device
virtual void Activate(bool On)
bool Poll(int TimeoutMs=0)
A steerable satellite dish generally points to the south on the northern hemisphere,...
std::atomic< int > pids[MAXRECEIVEPIDS]
tChannelID ChannelID(void)
std::atomic< cDevice * > device
virtual void Receive(const uchar *Data, int Length)=0
This function is called from the cDevice we are attached to, and delivers one TS packet from the set ...
bool AddPid(int Pid)
Adds the given Pid to the list of PIDs of this receiver.
std::atomic< int > numPids
time_t startScrambleDetection
time_t lastScrambledPacket
cReceiver(const cChannel *Channel=NULL, int Priority=MINPRIORITY)
Creates a new receiver for the given Channel with the given Priority.
virtual void Activate(bool On)
This function is called just before the cReceiver gets attached to (On == true) and right after it ge...
cRingBufferLinear(int Size, int Margin=0, bool Statistics=false, const char *Description=NULL)
Creates a linear ring buffer.
void Del(int Count)
Deletes at most Count bytes from the ring buffer.
uchar * Get(int &Count)
Gets data from the ring buffer.
int Read(int FileHandle, int Max=0)
Reads at most Max bytes from FileHandle and stores them in the ring buffer.
virtual int Available(void) override
void SetTimeouts(int PutTimeout, int GetTimeout)
cSdtFilter(cPatFilter *PatFilter)
void SetChannel(const cChannel *Channel)
cSectionHandler(cDevice *Device)
void Attach(cFilter *Filter)
void Detach(cFilter *Filter)
int SubtitleLanguages[I18N_MAX_LANGUAGES+1]
int AudioLanguages[I18N_MAX_LANGUAGES+1]
int QueueMessage(eMessageType Type, const char *s, int Seconds=0, int Timeout=0)
Like Message(), but this function may be called from a background thread.
virtual void setScaleMode(cSpuDecoder::eScaleMode ScaleMode)=0
static void MsgSetVolume(int Volume, bool Absolute)
static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
cTSBuffer(int File, int Size, int DeviceNumber)
uchar * Get(int *Available=NULL, bool CheckAvailable=false)
Returns a pointer to the first TS packet in the buffer.
virtual ~cTSBuffer() override
cRingBufferLinear * ringBuffer
void Skip(int Count)
If after a call to Get() more or less than TS_SIZE of the available data has been processed,...
virtual void Action(void) override
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
void SetDescription(const char *Description,...) __attribute__((format(printf
bool Running(void)
Returns false if a derived cThread object shall leave its Action() function.
void Cancel(int WaitSeconds=0)
Cancels the thread by first setting 'running' to false, so that the Action() loop can finish in an or...
static cDevice * ReceiverDevice(void)
cTransferControl(cDevice *ReceiverDevice, const cChannel *Channel)
void PutTs(const uchar *Data, int Length)
Puts the payload data of the single TS packet at Data into the converter.
void SetRepeatLast(void)
Makes the next call to GetPes() return exactly the same data as the last one (provided there was no c...
const uchar * GetPes(int &Length)
Gets a pointer to the complete PES packet, or NULL if the packet is not complete yet.
void Reset(void)
Resets the converter.
#define EIT_INJECTION_TIME
static int GetClippedNumProvidedSystems(int AvailableBits, cDevice *Device)
#define TS_SCRAMBLING_TIMEOUT
#define MIN_PRE_1_3_19_PRIVATESTREAM
#define TS_SCRAMBLING_TIME_OK
#define MAXOCCUPIEDTIMEOUT
#define IS_AUDIO_TRACK(t)
#define IS_SUBTITLE_TRACK(t)
#define IS_DOLBY_TRACK(t)
bool I18nIsPreferredLanguage(int *PreferredLanguages, const char *LanguageCode, int &OldPreference, int *Position)
Checks the given LanguageCode (which may be something like "eng" or "eng+deu") against the PreferredL...
int TsPid(const uchar *p)
bool TsHasPayload(const uchar *p)
bool TsIsScrambled(const uchar *p)
bool TsPayloadStart(const uchar *p)
#define TS_SYNC(Data, Length)
int TsPayloadOffset(const uchar *p)
int PesLength(const uchar *p)
cString ToString(void) const
char language[MAXLANGCODE2]