vdr  2.0.6
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 2.47.1.1 2013/08/22 12:01:48 kls Exp $
8  */
9 
10 #ifndef __DEVICE_H
11 #define __DEVICE_H
12 
13 #include "channels.h"
14 #include "ci.h"
15 #include "dvbsubtitle.h"
16 #include "eit.h"
17 #include "filter.h"
18 #include "nit.h"
19 #include "pat.h"
20 #include "remux.h"
21 #include "ringbuffer.h"
22 #include "sdt.h"
23 #include "sections.h"
24 #include "spu.h"
25 #include "thread.h"
26 #include "tools.h"
27 
28 #define MAXDEVICES 16 // the maximum number of devices in the system
29 #define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
30 #define MAXRECEIVERS 16 // the maximum number of receivers per device
31 #define MAXVOLUME 255
32 #define VOLUMEDELTA 5 // used to increase/decrease the volume
33 #define MAXOCCUPIEDTIMEOUT 99 // max. time (in seconds) a device may be occupied
34 
36 
37 enum ePlayMode { pmNone, // audio/video from decoder
38  pmAudioVideo, // audio/video from player
39  pmAudioOnly, // audio only from player, video from decoder
40  pmAudioOnlyBlack, // audio only from player, no video (black screen)
41  pmVideoOnly, // video only from player, audio from decoder
43  // external player (e.g. MPlayer), release the device
44  // WARNING: USE THIS MODE ONLY AS A LAST RESORT, IF YOU
45  // ABSOLUTELY, POSITIVELY CAN'T IMPLEMENT YOUR PLAYER
46  // THE WAY IT IS SUPPOSED TO WORK. FORCING THE DEVICE
47  // TO RELEASE ITS FILES HANDLES (OR WHATEVER RESOURCES
48  // IT MAY USE) TO ALLOW AN EXTERNAL PLAYER TO ACCESS
49  // THEM MEANS THAT SUCH A PLAYER WILL NEED TO HAVE
50  // DETAILED KNOWLEDGE ABOUT THE INTERNALS OF THE DEVICE
51  // IN USE. AS A CONSEQUENCE, YOUR PLAYER MAY NOT WORK
52  // IF A PARTICULAR VDR INSTALLATION USES A DEVICE NOT
53  // KNOWN TO YOUR PLAYER.
54  };
55 
58  };
59 
63  };
64 
68  ttAudioLast = ttAudioFirst + 31, // MAXAPIDS - 1
71  ttDolbyLast = ttDolbyFirst + 15, // MAXDPIDS - 1
74  ttSubtitleLast = ttSubtitleFirst + 31, // MAXSPIDS - 1
76  };
77 
78 #define IS_AUDIO_TRACK(t) (ttAudioFirst <= (t) && (t) <= ttAudioLast)
79 #define IS_DOLBY_TRACK(t) (ttDolbyFirst <= (t) && (t) <= ttDolbyLast)
80 #define IS_SUBTITLE_TRACK(t) (ttSubtitleFirst <= (t) && (t) <= ttSubtitleLast)
81 
82 struct tTrackId {
83  uint16_t id; // The PES packet id or the PID.
84  char language[MAXLANGCODE2]; // something like either "eng" or "deu+eng"
85  char description[32]; // something like "Dolby Digital 5.1"
86  };
87 
88 class cPlayer;
89 class cReceiver;
90 class cLiveSubtitle;
91 
92 class cDeviceHook : public cListObject {
93 public:
94  cDeviceHook(void);
98  virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const;
100  };
101 
103 
104 class cDevice : public cThread {
105  friend class cLiveSubtitle;
106  friend class cDeviceHook;
107 private:
108  static int numDevices;
109  static int useDevice;
112 public:
113  static int NumDevices(void) { return numDevices; }
115  static bool WaitForAllDevicesReady(int Timeout = 0);
121  static void SetUseDevice(int n);
125  static bool UseDevice(int n) { return useDevice == 0 || (useDevice & (1 << n)) != 0; }
128  static bool SetPrimaryDevice(int n);
132  static cDevice *PrimaryDevice(void) { return primaryDevice; }
134  static cDevice *ActualDevice(void);
137  static cDevice *GetDevice(int Index);
141  static cDevice *GetDevice(const cChannel *Channel, int Priority, bool LiveView, bool Query = false);
160  static cDevice *GetDeviceForTransponder(const cChannel *Channel, int Priority);
165  static void Shutdown(void);
168 private:
169  static int nextCardIndex;
171 protected:
172  virtual ~cDevice();
173  virtual bool Ready(void);
178  static int NextCardIndex(int n = 0);
190  virtual void MakePrimaryDevice(bool On);
197 public:
198  int DeviceNumber(void) const;
200  virtual cString DeviceType(void) const;
206  virtual cString DeviceName(void) const;
209  virtual bool HasDecoder(void) const;
211  virtual bool AvoidRecording(void) const { return false; }
214 
215 // Device hooks
216 
217 private:
219 protected:
220  bool DeviceHooksProvidesTransponder(const cChannel *Channel) const;
221 
222 // SPU facilities
223 
224 private:
227 public:
228  virtual cSpuDecoder *GetSpuDecoder(void);
231 
232 // Channel facilities
233 
234 private:
236 protected:
237  static int currentChannel;
238 public:
239  virtual bool ProvidesSource(int Source) const;
241  virtual bool ProvidesTransponder(const cChannel *Channel) const;
245  virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const;
248  virtual bool ProvidesChannel(const cChannel *Channel, int Priority = IDLEPRIORITY, bool *NeedsDetachReceivers = NULL) const;
262  virtual bool ProvidesEIT(void) const;
266  virtual int NumProvidedSystems(void) const;
272  virtual int SignalStrength(void) const;
277  virtual int SignalQuality(void) const;
282  virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
287  virtual bool IsTunedToTransponder(const cChannel *Channel) const;
290  virtual bool MaySwitchTransponder(const cChannel *Channel) const;
295  bool SwitchChannel(const cChannel *Channel, bool LiveView);
298  static bool SwitchChannel(int Direction);
302 private:
303  eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
305 protected:
306  virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
308 public:
309  static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; }
311  static void SetCurrentChannel(const cChannel *Channel) { currentChannel = Channel ? Channel->Number() : 0; }
315  void ForceTransferMode(void);
317  int Occupied(void) const;
319  void SetOccupied(int Seconds);
327  virtual bool HasLock(int TimeoutMs = 0) const;
333  virtual bool HasProgramme(void) const;
336 
337 // PID handle facilities
338 
339 private:
340  virtual void Action(void);
341 protected:
343  class cPidHandle {
344  public:
345  int pid;
347  int handle;
348  int used;
349  cPidHandle(void) { pid = streamType = used = 0; handle = -1; }
350  };
352  bool HasPid(int Pid) const;
354  bool AddPid(int Pid, ePidType PidType = ptOther, int StreamType = 0);
356  void DelPid(int Pid, ePidType PidType = ptOther);
358  virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
366 public:
367  void DelLivePids(void);
369 
370 // Section filter facilities
371 
372 private:
378 protected:
379  void StartSectionHandler(void);
383  void StopSectionHandler(void);
387 public:
388  virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
392  virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
396  virtual void CloseFilter(int Handle);
401  void AttachFilter(cFilter *Filter);
403  void Detach(cFilter *Filter);
405 
406 // Common Interface facilities:
407 
408 private:
411 public:
412  virtual bool HasCi(void);
414  virtual bool HasInternalCam(void) { return false; }
420  void SetCamSlot(cCamSlot *CamSlot);
422 
423 // Image Grab facilities
424 
425 public:
426  virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
438  bool GrabImageFile(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
443 
444 // Video format facilities
445 
446 public:
447  virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
451  virtual void SetVideoFormat(bool VideoFormat16_9);
454  virtual eVideoSystem GetVideoSystem(void);
457  virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
464  virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
475 
476 // Track facilities
477 
478 private:
488 protected:
489  virtual void SetAudioTrackDevice(eTrackType Type);
491  virtual void SetSubtitleTrackDevice(eTrackType Type);
493 public:
494  void ClrAvailableTracks(bool DescriptionsOnly = false, bool IdsOnly = false);
499  bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL);
506  const tTrackId *GetTrack(eTrackType Type);
509  int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const;
512  int NumAudioTracks(void) const;
516  int NumSubtitleTracks(void) const;
519  bool SetCurrentAudioTrack(eTrackType Type);
523  bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual = false);
529  void EnsureAudioTrack(bool Force = false);
533  void EnsureSubtitleTrack(void);
536  void SetKeepTracks(bool KeepTracks) { keepTracks = KeepTracks; }
540 
541 // Audio facilities
542 
543 private:
544  bool mute;
545  int volume;
546 protected:
547  virtual int GetAudioChannelDevice(void);
550  virtual void SetAudioChannelDevice(int AudioChannel);
552  virtual void SetVolumeDevice(int Volume);
554  virtual void SetDigitalAudioDevice(bool On);
557 public:
558  bool IsMute(void) const { return mute; }
559  bool ToggleMute(void);
561  int GetAudioChannel(void);
564  void SetAudioChannel(int AudioChannel);
567  void SetVolume(int Volume, bool Absolute = false);
570  static int CurrentVolume(void) { return primaryDevice ? primaryDevice->volume : 0; }//XXX???
571 
572 // Player facilities
573 
574 private:
581 protected:
582  virtual bool CanReplay(void) const;
584  virtual bool SetPlayMode(ePlayMode PlayMode);
587  virtual int PlayVideo(const uchar *Data, int Length);
594  virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
602  virtual int PlaySubtitle(const uchar *Data, int Length);
609  virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly = false);
614  virtual int PlayTsVideo(const uchar *Data, int Length);
622  virtual int PlayTsAudio(const uchar *Data, int Length);
630  virtual int PlayTsSubtitle(const uchar *Data, int Length);
638 public:
639  virtual int64_t GetSTC(void);
650  virtual bool IsPlayingVideo(void) const { return isPlayingVideo; }
653  virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter) { return cRect::Null; }
674  virtual void ScaleVideo(const cRect &Rect = cRect::Null) {}
682  virtual bool HasIBPTrickSpeed(void) { return false; }
685  virtual void TrickSpeed(int Speed);
695  virtual void Clear(void);
699  virtual void Play(void);
702  virtual void Freeze(void);
704  virtual void Mute(void);
708  virtual void StillPicture(const uchar *Data, int Length);
714  virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
719  virtual bool Flush(int TimeoutMs = 0);
725  virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly = false);
735  virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly = false);
751  bool Replaying(void) const;
753  bool Transferring(void) const;
755  void StopReplay(void);
757  bool AttachPlayer(cPlayer *Player);
759  void Detach(cPlayer *Player);
761 
762 // Receiver facilities
763 
764 private:
767 public:
768  int Priority(void) const;
771 protected:
772  virtual bool OpenDvr(void);
775  virtual void CloseDvr(void);
777  virtual bool GetTSPacket(uchar *&Data);
784 public:
785  bool Receiving(bool Dummy = false) const;
787  bool AttachReceiver(cReceiver *Receiver);
789  void Detach(cReceiver *Receiver);
791  void DetachAll(int Pid);
793  virtual void DetachAllReceivers(void);
795 
796 // --- dynamite subdevice patch start ---
797  friend class cDynamicDevice;
798 private:
802  bool isIdle;
803 protected:
806  cDevice(cDevice *ParentDevice = NULL);
807  const cPatPmtParser *PatPmtParser(void) const { if (parentDevice) return parentDevice->PatPmtParser(); return &patPmtParser; }
810 public:
811  bool IsPrimaryDevice(void) const { if (parentDevice) return parentDevice->IsPrimaryDevice(); return this == primaryDevice; }
812  int CardIndex(void) const { if (parentDevice) return parentDevice->cardIndex; return cardIndex; }
814  cCamSlot *CamSlot(void) const { if (parentDevice) return parentDevice->CamSlot(); return camSlot; }
817  bool IsSubDevice(void) const { return (parentDevice != NULL); }
818  bool HasSubDevice(void) const { return (subDevice != NULL); }
819  cDevice *SubDevice(void) const { return subDevice; }
820  bool IsIdle(void) const { if (parentDevice) return parentDevice->IsIdle(); return isIdle; }
821  bool SetIdle(bool Idle);
822  virtual bool SetIdleDevice(bool Idle, bool TestOnly) { return false; }
826  // --- dynamite subdevice patch end ---
827  };
828 
836 
837 class cTSBuffer : public cThread {
838 private:
839  int f;
841  bool delivered;
843  virtual void Action(void);
844 public:
845  cTSBuffer(int File, int Size, int CardIndex);
846  ~cTSBuffer();
847  uchar *Get(void);
848  };
849 
857 
858 #define __DYNAMIC_DEVICE_PROBE
859 
861 
863  friend class cDynamicDevice;
864 private:
866  public:
869  cDynamicDeviceProbeItem(eDynamicDeviceProbeCommand Cmd, cString *DevPath):cmd(Cmd),devpath(DevPath) {}
870  virtual ~cDynamicDeviceProbeItem() { if (devpath) delete devpath; }
871  };
876 public:
877  static void QueueDynamicDeviceCommand(eDynamicDeviceProbeCommand Cmd, const char *DevPath);
881  cDynamicDeviceProbe(void);
882  virtual ~cDynamicDeviceProbe();
883  virtual cDevice *Attach(cDevice *ParentDevice, const char *DevPath) = 0;
889  };
890 
892 
893 #endif //__DEVICE_H
cEitFilter * eitFilter
Definition: device.h:374
static int nextCardIndex
Definition: device.h:169
cPatPmtParser patPmtParser
Definition: device.h:576
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
Definition: device.c:728
int cardIndex
Definition: device.h:840
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:125
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:708
bool Replaying(void) const
Returns true if we are currently replaying.
Definition: device.c:1272
unsigned char uchar
Definition: tools.h:30
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices).
Definition: device.c:196
virtual eVideoSystem GetVideoSystem(void)
Returns the video system of the currently displayed material (default is PAL).
Definition: device.c:473
int Number(void) const
Definition: channels.h:175
cNitFilter * nitFilter
Definition: device.h:377
void SetOccupied(int Seconds)
Sets the occupied timeout for this device to the given number of Seconds, This can be used to tune a ...
Definition: device.c:898
Definition: device.h:66
cPlayer * player
Definition: device.h:575
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
Definition: device.c:948
eSetChannelResult
Definition: device.h:35
int Index(void) const
Definition: tools.c:1920
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
Definition: device.c:733
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:419
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:713
bool Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
Definition: device.c:1627
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
Definition: device.c:1047
cSdtFilter * sdtFilter
Definition: device.h:376
cRingBufferLinear * ringBuffer
Definition: device.h:842
virtual void TrickSpeed(int Speed)
Sets the device into a mode where replay is done slower.
Definition: device.c:1183
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
Definition: device.c:1781
Definition: eit.h:15
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask)
Opens a file handle for the given filter data.
Definition: device.c:646
static cList< cDynamicDeviceProbeItem > commandQueue
A list where all attach/detach commands are queued so they can be processed in the MainThreadHook of ...
Definition: device.h:872
bool isIdle
Definition: device.h:802
char description[32]
Definition: device.h:85
int f
Definition: device.h:839
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
Definition: device.c:1173
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
Definition: device.c:683
cReceiver * receiver[MAXRECEIVERS]
Definition: device.h:766
Definition: sdt.h:16
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:478
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
Definition: device.c:651
Definition: nit.h:19
void SetCamSlot(cCamSlot *CamSlot)
Sets the given CamSlot to be used with this device.
Definition: device.c:398
bool mute
Definition: device.h:544
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
Definition: device.c:217
#define MAXDEVICES
Definition: device.h:28
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:446
void Detach(cFilter *Filter)
Detaches the given filter from this device.
Definition: device.c:670
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
Definition: device.c:260
int cardIndex
Definition: device.h:170
cDevice(cDevice *ParentDevice=NULL)
Definition: device.c:74
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
Definition: device.c:568
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
Definition: device.c:1709
static int currentChannel
Definition: device.h:237
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:1013
int volume
Definition: device.h:545
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
Definition: device.c:1194
virtual cDevice * Attach(cDevice *ParentDevice, const char *DevPath)=0
Probes for a device at the given device-path like /dev/dvb/adapter0/frontend0 or /dev/video0 etc...
cList< cDynamicDeviceProbe > DynamicDeviceProbes
Definition: device.c:1872
bool autoSelectPreferredSubtitleLanguage
Definition: device.h:485
Definition: device.h:65
static int NumDevices(void)
Returns the total number of devices.
Definition: device.h:113
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
Definition: device.c:1642
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:485
eTrackType GetCurrentSubtitleTrack(void) const
Definition: device.h:522
virtual void Clear(void)
Clears all video and audio data from the device.
Definition: device.c:1187
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
Definition: device.c:1509
eTrackType
Definition: device.h:65
void DelLivePids(void)
Deletes the live viewing PIDs.
Definition: device.c:603
Definition: device.h:37
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
Definition: device.c:661
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
Definition: device.c:1057
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds. ...
Definition: device.h:682
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:469
cDynamicDeviceProbeItem(eDynamicDeviceProbeCommand Cmd, cString *DevPath)
Definition: device.h:869
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:1363
cTsToPes tsToPesSubtitle
Definition: device.h:579
eTrackType currentSubtitleTrack
Definition: device.h:481
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition: device.c:923
virtual void Mute(void)
Turns off audio while replaying.
Definition: device.c:1208
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:653
Definition: filter.h:41
cTSBuffer(int File, int Size, int CardIndex)
Definition: device.c:1804
Definition: osd.h:158
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
Definition: device.c:1067
static int NextCardIndex(int n=0)
Calculates the next card index.
Definition: device.c:184
static int CurrentVolume(void)
Definition: device.h:570
bool IsPrimaryDevice(void) const
Definition: device.h:811
virtual bool Ready(void)
Returns true if this device is ready.
Definition: device.c:1622
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
Definition: device.c:1146
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:814
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
Definition: device.c:1277
cDeviceHook(void)
Creates a new device hook object.
Definition: device.c:50
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
Definition: device.c:723
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:743
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
Definition: device.c:1201
int pre_1_3_19_PrivateStream
Definition: device.h:487
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
Definition: device.c:212
cPatFilter * patFilter
Definition: device.h:375
Definition: player.h:16
tTrackId availableTracks[ttMaxTrackTypes]
Definition: device.h:479
#define IDLEPRIORITY
Definition: config.h:47
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:55
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
Definition: device.h:309
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
Definition: device.c:718
bool isPlayingVideo
Definition: device.h:580
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
Definition: device.c:611
time_t startScrambleDetection
Definition: device.h:409
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
Definition: device.c:932
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
Definition: device.c:626
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:977
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:247
cMutex mutexCurrentSubtitleTrack
Definition: device.h:483
Definition: osd.h:348
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
Definition: device.c:748
virtual bool IsPlayingVideo(void) const
Returns true if the currently attached player has delivered any video packets.
Definition: device.h:650
virtual ~cDevice()
Definition: device.c:129
cTsToPes tsToPesVideo
Definition: device.h:577
virtual void CloseDvr(void)
Shuts down the DVR.
Definition: device.c:1700
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
Definition: device.c:913
cTsToPes tsToPesAudio
Definition: device.h:578
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
Definition: device.c:908
virtual bool SetIdleDevice(bool Idle, bool TestOnly)
Called by SetIdle if TestOnly, don't do anything, just return, if the device can be set to the new id...
Definition: device.h:822
cCamSlot * camSlot
Definition: device.h:410
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
Definition: device.c:990
eVideoDisplayFormat
Definition: device.h:60
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:918
bool delivered
Definition: device.h:841
bool HasSubDevice(void) const
Definition: device.h:818
Definition: ci.h:127
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:414
static cDevice * primaryDevice
Definition: device.h:111
friend class cDynamicDevice
Definition: device.h:797
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
Definition: device.c:1795
static int numDevices
Definition: device.h:108
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition: device.c:928
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
Definition: device.c:598
cSectionHandler * sectionHandler
Definition: device.h:373
int Occupied(void) const
Returns the number of seconds this device is still occupied for.
Definition: device.c:890
ePlayMode
Definition: device.h:37
eTrackType currentAudioTrack
Definition: device.h:480
Definition: thread.h:63
static bool WaitForAllDevicesReady(int Timeout=0)
Waits until all devices have become ready, or the given Timeout (seconds) has expired.
Definition: device.c:162
static const cRect Null
Definition: osd.h:353
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:1461
cDevice * parentDevice
Definition: device.h:804
eVideoSystem
Definition: device.h:56
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:674
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:694
static cDevice * nextParentDevice
Holds the parent device for the next subdevice so the dynamite-plugin can work with unpatched plugins...
Definition: device.h:799
#define MAXLANGCODE2
Definition: channels.h:40
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:211
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
Definition: device.c:1822
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
Definition: device.c:656
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:1695
virtual bool Flush(int TimeoutMs=0)
Returns true if the device's output buffers are empty, i.
Definition: device.c:1341
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:807
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
Definition: device.h:812
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
Definition: device.c:207
int Priority(void) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY), or IDLEPRIORITY if no receiver is currently active.
Definition: device.c:1607
cDevice * subDevice
Definition: device.h:805
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1490
Definition: device.h:69
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:373
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
Definition: device.c:1351
bool SetIdle(bool Idle)
Definition: device.c:141
cMutex mutexReceiver
Definition: device.h:765
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
Definition: device.c:1539
Definition: pat.h:19
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
Definition: device.c:944
virtual ~cDynamicDeviceProbe()
Definition: device.c:1887
static int useDevice
Definition: device.h:109
Definition: device.h:56
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
Definition: device.c:1113
static cDevice * PrimaryDevice(void)
Returns the primary device.
Definition: device.h:132
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:1704
cLiveSubtitle * liveSubtitle
Definition: device.h:225
friend class cDynamicDevice
Definition: device.h:863
~cTSBuffer()
Definition: device.c:1816
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
Definition: device.c:799
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
Definition: device.c:225
void StopReplay(void)
Stops the current replay session (if any).
Definition: device.c:1325
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:1042
bool IsSubDevice(void) const
Definition: device.h:817
unsigned char u_char
Definition: headers.h:24
int GetAudioChannel(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition: device.c:965
static cList< cDeviceHook > deviceHooks
Definition: device.h:218
static void SetCurrentChannel(const cChannel *Channel)
Sets the number of the current channel on the primary device, without actually switching to it...
Definition: device.h:311
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:1336
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles...
Definition: device.c:1178
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:699
int currentAudioTrackMissingCount
Definition: device.h:484
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
Definition: device.c:738
Definition: thread.h:77
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
Definition: device.c:1282
time_t occupiedTimeout
Definition: device.h:235
static void QueueDynamicDeviceCommand(eDynamicDeviceProbeCommand Cmd, const char *DevPath)
Plugins which support cDynamicDeviceProbe must use this function to queue the devices they normally c...
Definition: device.c:1876
static void Shutdown(void)
Closes down all devices.
Definition: device.c:405
cMutex mutexCurrentAudioTrack
Definition: device.h:482
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise...
Definition: device.c:252
uchar * Get(void)
Definition: device.c:1844
void SetKeepTracks(bool KeepTracks)
Controls whether the current audio and subtitle track settings shall be kept as they currently are...
Definition: device.h:536
eDynamicDeviceProbeCommand cmd
Definition: device.h:867
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
Definition: device.c:1168
char language[MAXLANGCODE2]
Definition: device.h:84
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
Definition: device.c:495
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
Definition: device.c:678
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
Definition: device.c:242
Definition: device.h:35
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1525
eDynamicDeviceProbeCommand
Definition: device.h:860
cDevice * SubDevice(void) const
Definition: device.h:819
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition: device.c:971
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1356
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
Definition: device.c:879
#define MAXPIDHANDLES
Definition: device.h:29
bool IsIdle(void) const
Definition: device.h:820
#define MAXRECEIVERS
Definition: device.h:30
bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual=false)
Sets the current subtitle track to the given Type.
Definition: device.c:1085
ePidType
Definition: device.h:342
bool keepTracks
Definition: device.h:486
Definition: tools.h:347
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets ...
Definition: device.h:837
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
Definition: device.c:1213
Definition: device.h:57
cDvbSubtitleConverter * dvbSubtitleConverter
Definition: device.h:226
eTrackType GetCurrentAudioTrack(void) const
Definition: device.h:518
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1346
cPidHandle pidHandles[MAXPIDHANDLES]
Definition: device.h:351
virtual void SetDigitalAudioDevice(bool On)
Tells the actual device that digital audio output shall be switched on or off.
Definition: device.c:936
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
Definition: device.c:1062
cDynamicDeviceProbe(void)
Definition: device.c:1882
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
Definition: device.c:178
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
Definition: device.c:393
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:504
The cDevice class is the base from which actual devices can be derived.
Definition: device.h:104
virtual bool HasInternalCam(void)
Returns true if this device handles encrypted channels itself without VDR assistance.
Definition: device.h:414
Definition: tools.h:166
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
Definition: device.c:940
bool IsMute(void) const
Definition: device.h:558
static cDevice * device[MAXDEVICES]
Definition: device.h:110
uint16_t id
Definition: device.h:83