vdr 2.8.4
device.h
Go to the documentation of this file.
1/*
2 * device.h: The basic device interface
3 *
4 * See the main source file 'vdr.c' for copyright information and
5 * how to reach the author.
6 *
7 * $Id: device.h 5.12 2026/09/24 20:28:19 kls Exp $
8 */
9
10#ifndef __DEVICE_H
11#define __DEVICE_H
12
13#include <atomic>
14#include "channels.h"
15#include "ci.h"
16#include "dvbsubtitle.h"
17#include "eit.h"
18#include "filter.h"
19#include "nit.h"
20#include "pat.h"
21#include "positioner.h"
22#include "remux.h"
23#include "ringbuffer.h"
24#include "sdt.h"
25#include "sections.h"
26#include "spu.h"
27#include "thread.h"
28#include "tools.h"
29
30#define MAXDEVICES 32 // the maximum number of devices in the system
31#define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
32#define MAXRECEIVERS 16 // the maximum number of receivers per device
33#define MAXVOLUME 255
34#define VOLUMEDELTA (MAXVOLUME / Setup.VolumeSteps) // used to increase/decrease the volume
35#define MAXOCCUPIEDTIMEOUT 99 // max. time (in seconds) a device may be occupied
36
38
39// Note that VDR itself always uses pmAudioVideo when replaying a recording!
40enum ePlayMode { pmNone, // audio/video from decoder
41 pmAudioVideo, // audio/video from player
42 pmAudioOnly, // audio only from player, video from decoder
43 pmAudioOnlyBlack, // audio only from player, no video (black screen)
44 pmVideoOnly, // video only from player, audio from decoder
46 // external player (e.g. MPlayer), release the device
47 // WARNING: USE THIS MODE ONLY AS A LAST RESORT, IF YOU
48 // ABSOLUTELY, POSITIVELY CAN'T IMPLEMENT YOUR PLAYER
49 // THE WAY IT IS SUPPOSED TO WORK. FORCING THE DEVICE
50 // TO RELEASE ITS FILES HANDLES (OR WHATEVER RESOURCES
51 // IT MAY USE) TO ALLOW AN EXTERNAL PLAYER TO ACCESS
52 // THEM MEANS THAT SUCH A PLAYER WILL NEED TO HAVE
53 // DETAILED KNOWLEDGE ABOUT THE INTERNALS OF THE DEVICE
54 // IN USE. AS A CONSEQUENCE, YOUR PLAYER MAY NOT WORK
55 // IF A PARTICULAR VDR INSTALLATION USES A DEVICE NOT
56 // KNOWN TO YOUR PLAYER.
57 };
58
63
77#define IS_AUDIO_TRACK(t) (ttAudioFirst <= (t) && (t) <= ttAudioLast)
78#define IS_DOLBY_TRACK(t) (ttDolbyFirst <= (t) && (t) <= ttDolbyLast)
79#define IS_SUBTITLE_TRACK(t) (ttSubtitleFirst <= (t) && (t) <= ttSubtitleLast)
80
81struct tTrackId {
82 uint16_t id; // The PES packet id or the PID.
83 char language[MAXLANGCODE2]; // something like either "eng" or "deu+eng"
84 char description[32]; // something like "Dolby Digital 5.1"
85 };
86
87class cPlayer;
88class cReceiver;
89class cLiveSubtitle;
90
91class cDeviceHook : public cListObject {
92public:
93 cDeviceHook(void);
97 virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const;
99 virtual bool DeviceProvidesEIT(const cDevice *Device) const;
101 };
102
104
105#define DTV_STAT_VALID_NONE 0x0000
106#define DTV_STAT_VALID_STRENGTH 0x0001
107#define DTV_STAT_VALID_CNR 0x0002
108#define DTV_STAT_VALID_BERPRE 0x0004
109#define DTV_STAT_VALID_BERPOST 0x0008
110#define DTV_STAT_VALID_PER 0x0010
111#define DTV_STAT_VALID_STATUS 0x0020
112
113#define DTV_STAT_HAS_NONE 0x0000
114#define DTV_STAT_HAS_SIGNAL 0x0001
115#define DTV_STAT_HAS_CARRIER 0x0002
116#define DTV_STAT_HAS_VITERBI 0x0004
117#define DTV_STAT_HAS_SYNC 0x0008
118#define DTV_STAT_HAS_LOCK 0x0010
119
120class cDevice : public cThread {
121 friend class cLiveSubtitle;
122 friend class cDeviceHook;
123 friend class cReceiver;
124private:
125 static int numDevices;
126 static int useDevice;
127 static cDevice *device[MAXDEVICES];
129public:
130 static int NumDevices(void) { return numDevices; }
132 static bool WaitForAllDevicesReady(int Timeout = 0);
138 static void SetUseDevice(int n);
142 static bool UseDevice(int n) { return useDevice == 0 || (useDevice & (1 << n)) != 0; }
145 static bool SetPrimaryDevice(int n);
149 static cDevice *PrimaryDevice(void) { return primaryDevice; }
151 static cDevice *ActualDevice(void);
154 static cDevice *GetDevice(int Index);
158 static cDevice *GetDevice(const cChannel *Channel, int Priority, bool LiveView, bool Query = false);
177 static cDevice *GetDeviceForTransponder(const cChannel *Channel, int Priority);
185 static void Shutdown(void);
188private:
189 static int nextCardIndex;
191protected:
192 cDevice(void);
193 virtual ~cDevice() override;
194 virtual bool Ready(void);
199 static int NextCardIndex(int n = 0);
211 virtual void MakePrimaryDevice(bool On);
218 virtual bool IsBonded(void) const { return false; }
223public:
224 bool IsPrimaryDevice(bool CheckDecoder = true) const { return this == primaryDevice && (!CheckDecoder || HasDecoder()); }
225 int CardIndex(void) const { return cardIndex; }
227 int DeviceNumber(void) const;
229 virtual cString DeviceType(void) const;
235 virtual cString DeviceName(void) const;
238 virtual bool HasDecoder(void) const;
240 virtual bool AvoidRecording(void) const { return false; }
243
244// Device hooks
245
246private:
248protected:
249 bool DeviceHooksProvidesTransponder(const cChannel *Channel) const;
250 bool DeviceHooksProvidesEIT(void) const;
251
252// SPU facilities
253
254private:
257public:
258 virtual cSpuDecoder *GetSpuDecoder(void);
261
262// Channel facilities
263
264private:
269protected:
270 static std::atomic<int> currentChannel; // set by whichever thread switches the channel, read by any
271public:
272 virtual bool ProvidesSource(int Source) const;
274 virtual bool ProvidesTransponder(const cChannel *Channel) const;
278 virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const;
281 virtual bool ProvidesChannel(const cChannel *Channel, int Priority = IDLEPRIORITY, bool *NeedsDetachReceivers = NULL) const;
295 virtual bool ProvidesEIT(void) const;
299 virtual int NumProvidedSystems(void) const;
305 virtual const cPositioner *Positioner(void) const;
310 virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
327 virtual int SignalStrength(void) const;
332 virtual int SignalQuality(void) const;
337 virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
342 virtual bool IsTunedToTransponder(const cChannel *Channel) const;
345 virtual bool MaySwitchTransponder(const cChannel *Channel) const;
350 virtual void SetPowerSaveMode(bool On);
355 void SetPowerSaveIfUnused(void);
358 bool SwitchChannel(const cChannel *Channel, bool LiveView);
361 static bool SwitchChannel(int Direction);
365private:
366 eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
368protected:
369 virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
371public:
372 static int CurrentChannel(void) { return primaryDevice ? currentChannel.load() : 0; }
374 static void SetCurrentChannel(int ChannelNumber) { currentChannel = ChannelNumber; }
378 void ForceTransferMode(void);
380 int Occupied(int Priority = MINPRIORITY) const;
383 void SetOccupied(int Seconds, int Priority = MINPRIORITY, time_t From = 0);
395 virtual bool HasLock(int TimeoutMs = 0) const;
401 virtual bool HasProgramme(void) const;
404
405// PID handle facilities
406
407private:
409 virtual void Action(void) override;
410protected:
413 public:
414 int pid;
417 int used;
418 cPidHandle(void) { pid = streamType = used = 0; handle = -1; }
419 };
421 bool HasPid(int Pid) const;
423 bool AddPid(int Pid, ePidType PidType = ptOther, int StreamType = 0);
425 void DelPid(int Pid, ePidType PidType = ptOther);
427 virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
435public:
436 void DelLivePids(void);
438
439// Section filter facilities
440
441private:
447protected:
448 void StartSectionHandler(void);
452 void StopSectionHandler(void);
456public:
457 virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
461 virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
465 virtual void CloseFilter(int Handle);
470 void AttachFilter(cFilter *Filter);
472 void Detach(cFilter *Filter);
474 const cSdtFilter *SdtFilter(void) const { return sdtFilter; }
476
477// Common Interface facilities:
478
479private:
480 std::atomic<cCamSlot *> camSlot; // set by cCamSlot::Assign() in any thread, read without a lock
481 void ReleaseCamSlot(void);
483public:
484 virtual bool HasCi(void);
486 virtual bool HasInternalCam(void) { return false; }
494 cCamSlot *CamSlot(void) const { return camSlot; }
497
498// Image Grab facilities
499
500public:
501 virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
513 bool GrabImageFile(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
518
519// Video format facilities
520
521public:
522 virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
528 virtual void SetVideoFormat(bool VideoFormat16_9);
533 virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
540 virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
551
552// Track facilities
553
554private:
556 // read without a lock by PlayTs() and the getters, while other threads change them:
557 std::atomic<eTrackType> currentAudioTrack;
558 std::atomic<eTrackType> currentSubtitleTrack;
562 std::atomic<bool> autoSelectPreferredSubtitleLanguage; // set by EnsureSubtitleTrack() on the player and main threads
565protected:
566 virtual void SetAudioTrackDevice(eTrackType Type);
568 virtual void SetSubtitleTrackDevice(eTrackType Type);
570public:
571 void ClrAvailableTracks(bool DescriptionsOnly = false, bool IdsOnly = false);
576 bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL);
583 const tTrackId *GetTrack(eTrackType Type);
586 bool GetTrackId(eTrackType Type, tTrackId &TrackId);
591 int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const;
594 int NumAudioTracks(void) const;
598 int NumSubtitleTracks(void) const;
605 bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual = false);
611 void SetTempSubtitles(void);
613 void EnsureAudioTrack(bool Force = false);
617 void EnsureSubtitleTrack(void);
620 void SetKeepTracks(bool KeepTracks) { keepTracks = KeepTracks; }
624
625// Audio facilities
626
627private:
628 // changed by whichever thread handles the key or SVDRP command, read by skins and plugins:
629 std::atomic<bool> mute;
630 std::atomic<int> volume;
631protected:
632 virtual int GetAudioChannelDevice(void);
635 virtual void SetAudioChannelDevice(int AudioChannel);
637 virtual void SetVolumeDevice(int Volume);
639 virtual void SetDigitalAudioDevice(bool On);
643public:
644 bool IsMute(void) const { return mute.load(); }
645 bool ToggleMute(void);
647 int GetAudioChannel(void);
650 void SetAudioChannel(int AudioChannel);
653 void SetVolume(int Volume, bool Absolute = false);
656 static int CurrentVolume(void) { return primaryDevice ? primaryDevice->volume.load() : 0; }//XXX???
657
658// Player facilities
659
660private:
661 std::atomic<cPlayer *> player; // cleared by Detach() in any thread, read without a lock
667protected:
668 const cPatPmtParser *PatPmtParser(void) const { return &patPmtParser; }
671 virtual bool CanReplay(void) const;
673 virtual bool SetPlayMode(ePlayMode PlayMode);
676 virtual int PlayVideo(const uchar *Data, int Length);
683 virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
691 virtual int PlaySubtitle(const uchar *Data, int Length);
698 virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly = false);
703 virtual int PlayTsVideo(const uchar *Data, int Length);
716 virtual int PlayTsAudio(const uchar *Data, int Length);
726 virtual int PlayTsSubtitle(const uchar *Data, int Length);
736 virtual bool DrainDevice(void);
751public:
752 virtual int64_t GetSTC(void);
763 virtual bool IsPlayingVideo(void) const { return isPlayingVideo; }
766 virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter) { return cRect::Null; }
787 virtual void ScaleVideo(const cRect &Rect = cRect::Null) {}
795 virtual bool HasIBPTrickSpeed(void) { return false; }
798 virtual void TrickSpeed(int Speed, bool Forward);
809 virtual void Clear(void);
813 virtual void Play(void);
816 virtual void Freeze(void);
818 virtual void Mute(void);
822 virtual void StillPicture(const uchar *Data, int Length);
828 virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
833#ifndef MUTE_DEPRECATED_FLUSH
834 [[deprecated("use Drain() instead")]]
835#endif
836 virtual bool Flush(int TimeoutMs = 0);
837 bool Drain(void);
845 virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly = false);
855 virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly = false);
871 bool Replaying(void) const;
873 bool Transferring(void) const;
875 void StopReplay(void);
877 bool AttachPlayer(cPlayer *Player);
879 void Detach(cPlayer *Player);
881
882// Receiver facilities
883
884private:
887public:
888 int Priority(bool IgnoreOccupied = false) const;
892protected:
893 virtual bool OpenDvr(void);
896 virtual void CloseDvr(void);
898 virtual bool GetTSPacket(uchar *&Data);
905public:
906 bool Receiving(bool Dummy = false) const;
908 bool AttachReceiver(cReceiver *Receiver);
910 void Detach(cReceiver *Receiver, bool ReleaseCam = true);
915 void DetachAll(int Pid);
917 virtual void DetachAllReceivers(void);
919 };
920
928
929class cTSBuffer : public cThread {
930private:
931 int f;
935 virtual void Action(void) override;
936public:
937 cTSBuffer(int File, int Size, int DeviceNumber);
938 virtual ~cTSBuffer() override;
939 uchar *Get(int *Available = NULL, bool CheckAvailable = false);
950 void Skip(int Count);
957 };
958
959#endif //__DEVICE_H
#define MAXLANGCODE2
Definition channels.h:37
Definition ci.h:232
virtual bool DeviceProvidesEIT(const cDevice *Device) const
Returns true if the given Device can provide EIT data.
Definition device.c:62
cDeviceHook(void)
Creates a new device hook object.
Definition device.c:52
virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const
Returns true if the given Device can provide the given Channel's transponder.
Definition device.c:57
friend class cReceiver
Definition device.h:123
friend class cDeviceHook
Definition device.h:122
std::atomic< eTrackType > currentAudioTrack
Definition device.h:557
static int NextCardIndex(int n=0)
Calculates the next card index.
Definition device.c:156
int Occupied(int Priority=MINPRIORITY) const
Returns the number of seconds this device is still occupied for with a priority >= Priority.
Definition device.c:1020
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
Definition device.c:182
static cList< cDeviceHook > deviceHooks
Definition device.h:247
bool Replaying(void) const
Returns true if we are currently replaying.
Definition device.c:1458
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.
Definition device.c:1520
void SetKeepTracks(bool KeepTracks)
Controls whether the current audio and subtitle track settings shall be kept as they currently are,...
Definition device.h:620
int currentAudioTrackMissingCount
Definition device.h:561
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
Definition device.c:703
int Priority(bool IgnoreOccupied=false) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY),...
Definition device.c:1819
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).
Definition device.c:807
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
Definition device.c:1080
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition device.c:1059
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition device.c:1546
cSectionHandler * sectionHandler
Definition device.h:442
std::atomic< bool > mute
Definition device.h:629
static bool UseDevice(int n)
Tells whether the device with the given card index shall be used in this instance of VDR.
Definition device.h:142
bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual=false)
Sets the current subtitle track to the given Type.
Definition device.c:1242
virtual bool HasInternalCam(void)
Returns true if this device handles encrypted channels itself without VDR assistance.
Definition device.h:486
virtual uchar * GrabImage(int &Size, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1)
Grabs the currently visible screen image.
Definition device.c:483
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect)
Returns the Width, Height and VideoAspect ratio of the currently displayed video material.
Definition device.c:542
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.
Definition device.c:488
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
Definition device.c:901
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
Definition device.c:1048
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
Definition device.c:692
virtual bool IsPlayingVideo(void) const
Returns true if the currently attached player has delivered any video packets.
Definition device.h:763
@ ptTeletext
Definition device.h:411
@ ptPcr
Definition device.h:411
@ ptOther
Definition device.h:411
@ ptDolby
Definition device.h:411
@ ptAudio
Definition device.h:411
@ ptVideo
Definition device.h:411
cMutex mutexCurrentAudioTrack
Definition device.h:559
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...
Definition device.c:802
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...
Definition device.c:1187
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
Definition device.c:797
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
Definition device.c:1213
bool keepTracks
Definition device.h:563
virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly=false)
Plays all valid PES packets in Data with the given Length.
Definition device.c:1663
cMutex mutexReceiver
Definition device.h:885
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
Definition device.c:746
void ReleaseCamSlot(void)
Releases the CAM slot if it is currently not used.
Definition device.c:455
static int useDevice
Definition device.h:126
virtual void Action(void) override
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
Definition device.c:1853
cDvbSubtitleConverter * dvbSubtitleConverter
Definition device.h:256
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
Definition device.c:559
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
Definition device.c:1076
std::atomic< bool > autoSelectPreferredSubtitleLanguage
Definition device.h:562
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
Definition device.c:678
static int nextCardIndex
Definition device.h:189
cTsToPes tsToPesAudio
Definition device.h:664
cNitFilter * nitFilter
Definition device.h:446
static bool WaitForAllDevicesReady(int Timeout=0)
Waits until all devices have become ready, or the given Timeout (seconds) has expired.
Definition device.c:134
void SetCamSlot(cCamSlot *CamSlot)
Sets the given CamSlot to be used with this device.
Definition device.c:468
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise.
Definition device.c:229
static cDevice * PrimaryDevice(void)
Returns the primary device.
Definition device.h:149
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
Definition device.c:150
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...
Definition device.c:832
eTrackType GetCurrentSubtitleTrack(void) const
Definition device.h:604
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
Definition device.c:237
static void Shutdown(void)
Closes down all devices.
Definition device.c:474
cPatFilter * patFilter
Definition device.h:444
eTrackType GetCurrentAudioTrack(void) const
Definition device.h:600
cDevice(void)
Definition device.c:80
bool DeviceHooksProvidesEIT(void) const
Definition device.c:762
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
Definition device.c:847
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition device.c:1693
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices - 1).
Definition device.c:168
virtual void SetPowerSaveMode(bool On)
Puts the device into power save mode, if applicable.
Definition device.c:837
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...
Definition device.c:1541
cEitFilter * eitFilter
Definition device.h:443
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...
Definition device.c:792
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition device.c:1064
cReceiver * receiver[MAXRECEIVERS]
Definition device.h:886
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
Definition device.c:643
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
Definition device.c:1939
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
Definition device.h:372
bool IsPrimaryDevice(bool CheckDecoder=true) const
Definition device.h:224
virtual bool AvoidRecording(void) const
Returns true if this device should only be used for recording if no other device is available.
Definition device.h:240
static cDevice * primaryDevice
Definition device.h:128
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
Definition device.c:201
bool Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
Definition device.c:1839
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
Definition device.c:1463
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
Definition device.c:1715
time_t occupiedTimeout
Definition device.h:267
void StopReplay(void)
Stops the current replay session (if any).
Definition device.c:1511
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
Definition device.c:187
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.
Definition device.c:778
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
Definition device.c:2024
virtual bool ProvidesChannel(const cChannel *Channel, int Priority=IDLEPRIORITY, bool *NeedsDetachReceivers=NULL) const
Returns true if this device can provide the given channel.
Definition device.c:787
bool IsMute(void) const
Definition device.h:644
virtual cRect CanScaleVideo(const cRect &Rect, int Alignment=taCenter)
Asks the output device whether it can scale the currently shown video in such a way that it fits into...
Definition device.h:766
int cardIndex
Definition device.h:190
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
Definition device.c:817
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
Definition device.c:812
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
Definition device.c:1378
const cPatPmtParser * PatPmtParser(void) const
Returns a pointer to the patPmtParser, so that a derived device can use the stream information from i...
Definition device.h:668
int GetAudioChannel(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition device.c:1101
const cSdtFilter * SdtFilter(void) const
Definition device.h:474
cPidHandle pidHandles[MAXPIDHANDLES]
Definition device.h:420
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
Definition device.c:1296
void Detach(cFilter *Filter)
Detaches the given filter from this device.
Definition device.c:740
cTsToPes tsToPesVideo
Definition device.h:663
cSectionHandler * SectionHandler(void) const
Definition device.h:475
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
Definition device.c:1356
virtual bool OpenDvr(void)
Opens the DVR of this device and prepares it to deliver a Transport Stream for use in a cReceiver.
Definition device.c:1925
const tTrackId * GetTrack(eTrackType Type)
Returns a pointer to the given track id, or NULL if Type is not less than ttMaxTrackTypes.
Definition device.c:1182
static void SetCurrentChannel(int ChannelNumber)
Sets the number of the current channel on the primary device, without actually switching to it.
Definition device.h:374
void SetVolume(int Volume, bool Absolute=false)
Sets the volume to the given value, either absolutely or relative to the current volume.
Definition device.c:1113
virtual void TrickSpeed(int Speed, bool Forward)
Sets the device into a mode where replay is done slower.
Definition device.c:1366
cLiveSubtitle * liveSubtitle
Definition device.h:255
virtual void Mute(void)
Turns off audio while replaying.
Definition device.c:1394
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
Definition device.c:463
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
Definition device.c:177
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
Definition device.c:822
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
Definition device.c:1386
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition device.c:1107
static int NumDevices(void)
Returns the total number of devices.
Definition device.h:130
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
Definition device.c:1361
virtual bool IsBonded(void) const
Returns true if this device is bonded to an other device.
Definition device.h:218
time_t occupiedFrom
Definition device.h:266
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
Sets the video display format to the given one (only useful if this device has an MPEG decoder).
Definition device.c:515
bool isPlayingVideo
Definition device.h:666
virtual bool Flush(int TimeoutMs=0)
Definition device.c:1525
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
Definition device.c:219
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition device.c:1733
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).
Definition device.c:538
virtual void CloseDvr(void)
Shuts down the DVR.
Definition device.c:1930
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
Definition device.c:729
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
Definition device.c:1043
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
Definition device.c:1468
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
Definition device.c:1128
virtual bool HasProgramme(void) const
Returns true if the device is currently showing any programme to the user, either through replaying o...
Definition device.c:1053
friend class cLiveSubtitle
Definition device.h:121
virtual void ScaleVideo(const cRect &Rect=cRect::Null)
Scales the currently shown video in such a way that it fits into the given Rect.
Definition device.h:787
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
Definition device.c:1329
static int CurrentVolume(void)
Definition device.h:656
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
Definition device.c:2040
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
Definition device.c:827
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
Definition device.c:1351
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
Definition device.c:1197
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
Definition device.c:734
std::atomic< cPlayer * > player
Definition device.h:661
virtual cSpuDecoder * GetSpuDecoder(void)
Returns a pointer to the device's SPU decoder (or NULL, if this device doesn't have an SPU decoder).
Definition device.c:224
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds.
Definition device.h:795
virtual bool Ready(void)
Returns true if this device is ready.
Definition device.c:1834
cMutex mutexChannel
Definition device.h:265
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...
Definition device.c:434
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 ...
Definition device.c:549
tTrackId availableTracks[ttMaxTrackTypes]
Definition device.h:555
virtual bool GetTSPacket(uchar *&Data)
Gets exactly one TS packet from the DVR of this device and returns a pointer to it in Data.
Definition device.c:1934
virtual void Clear(void)
Clears all video and audio data from the device.
Definition device.c:1370
cTsToPes tsToPesSubtitle
Definition device.h:665
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
Definition device.h:225
cCamSlot * CamSlot(void) const
Returns the CAM slot that is currently used with this device, or NULL if no CAM slot is in use.
Definition device.h:494
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.
Definition device.c:1152
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 ...
Definition device.c:1028
std::atomic< eTrackType > currentSubtitleTrack
Definition device.h:558
static int numDevices
Definition device.h:125
bool Drain(void)
Tells the device that the last data of the current stream has been delivered and no more will follow,...
Definition device.c:1530
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
Definition device.c:1208
virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly=false)
Plays the single PES packet in Data with the given Length.
Definition device.c:1567
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
Definition device.c:1084
void SetPowerSaveIfUnused(void)
Sets this device into a power save mode if it is not currently used and has implemented SetPowerSaveM...
Definition device.c:841
void DelLivePids(void)
Deletes the live viewing PIDs.
Definition device.c:683
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
Definition device.c:1756
cPatPmtParser patPmtParser
Definition device.h:662
bool AddPid(int Pid, ePidType PidType=ptOther, int StreamType=0)
Adds a PID to the set of PIDs this device shall receive.
Definition device.c:569
cMutex mutexCurrentSubtitleTrack
Definition device.h:560
std::atomic< int > volume
Definition device.h:630
int pre_1_3_19_PrivateStream
Definition device.h:564
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
Definition device.c:751
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
Definition device.c:724
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask)
Opens a file handle for the given filter data.
Definition device.c:719
cSdtFilter * sdtFilter
Definition device.h:445
static cDevice * device[MAXDEVICES]
Definition device.h:76
int occupiedPriority
Definition device.h:268
std::atomic< cCamSlot * > camSlot
Definition device.h:480
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
Definition device.c:1009
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
Definition device.c:1551
cMutex mutexPids
Definition device.h:408
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
Definition device.c:1218
void SetTempSubtitles(void)
Temporarily turn on subtitles after a fast rewind during reply.
Definition device.c:1289
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...
Definition device.c:773
virtual void SetDigitalAudioDevice(bool On)
Tells the output device that the current audio track is Dolby Digital.
Definition device.c:1072
static std::atomic< int > currentChannel
Definition device.h:270
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
Definition device.c:1399
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition device.c:1556
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
Definition device.c:1068
cListObject(const cListObject &ListObject)
Definition tools.h:553
Definition tools.h:650
A steerable satellite dish generally points to the south on the northern hemisphere,...
Definition positioner.h:31
Definition osd.h:354
static const cRect Null
Definition osd.h:359
cTSBuffer(int File, int Size, int DeviceNumber)
Definition device.c:2056
int delivered
Definition device.h:933
uchar * Get(int *Available=NULL, bool CheckAvailable=false)
Returns a pointer to the first TS packet in the buffer.
Definition device.c:2097
cRingBufferLinear * ringBuffer
Definition device.h:934
void Skip(int Count)
If after a call to Get() more or less than TS_SIZE of the available data has been processed,...
Definition device.c:2127
int deviceNumber
Definition device.h:932
int f
Definition device.h:931
virtual void Action(void) override
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
Definition device.c:2074
cThread(const char *Description=NULL, bool LowPriority=false)
Creates a new thread.
Definition thread.c:264
#define MINPRIORITY
Definition config.h:42
#define IDLEPRIORITY
Definition config.h:45
#define MAXPIDHANDLES
Definition device.h:31
eVideoDisplayFormat
Definition device.h:59
@ vdfLetterBox
Definition device.h:60
@ vdfCenterCutOut
Definition device.h:61
@ vdfPanAndScan
Definition device.h:59
ePlayMode
Definition device.h:40
@ pmAudioOnlyBlack
Definition device.h:43
@ pmNone
Definition device.h:40
@ pmVideoOnly
Definition device.h:44
@ pmAudioOnly
Definition device.h:42
@ pmAudioVideo
Definition device.h:41
@ pmExtern_THIS_SHOULD_BE_AVOIDED
Definition device.h:45
#define MAXDEVICES
Definition device.h:30
eTrackType
Definition device.h:64
@ ttSubtitle
Definition device.h:71
@ ttMaxTrackTypes
Definition device.h:74
@ ttDolbyLast
Definition device.h:70
@ ttAudioLast
Definition device.h:67
@ ttDolby
Definition device.h:68
@ ttAudioFirst
Definition device.h:66
@ ttSubtitleLast
Definition device.h:73
@ ttDolbyFirst
Definition device.h:69
@ ttSubtitleFirst
Definition device.h:72
@ ttAudio
Definition device.h:65
@ ttNone
Definition device.h:64
#define MAXRECEIVERS
Definition device.h:32
eSetChannelResult
Definition device.h:37
@ scrOk
Definition device.h:37
@ scrNotAvailable
Definition device.h:37
@ scrFailed
Definition device.h:37
@ scrNoTransfer
Definition device.h:37
@ taCenter
Definition osd.h:159
char language[MAXLANGCODE2]
Definition device.h:83
char description[32]
Definition device.h:84
uint16_t id
Definition device.h:82
unsigned char uchar
Definition tools.h:31