vdr  2.2.0
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 3.10 2015/01/12 14:39:09 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 "positioner.h"
21 #include "remux.h"
22 #include "ringbuffer.h"
23 #include "sdt.h"
24 #include "sections.h"
25 #include "spu.h"
26 #include "thread.h"
27 #include "tools.h"
28 
29 #define MAXDEVICES 16 // the maximum number of devices in the system
30 #define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
31 #define MAXRECEIVERS 16 // the maximum number of receivers per device
32 #define MAXVOLUME 255
33 #define VOLUMEDELTA (MAXVOLUME / Setup.VolumeSteps) // used to increase/decrease the volume
34 #define MAXOCCUPIEDTIMEOUT 99 // max. time (in seconds) a device may be occupied
35 
37 
38 // Note that VDR itself always uses pmAudioVideo when replaying a recording!
39 enum ePlayMode { pmNone, // audio/video from decoder
40  pmAudioVideo, // audio/video from player
41  pmAudioOnly, // audio only from player, video from decoder
42  pmAudioOnlyBlack, // audio only from player, no video (black screen)
43  pmVideoOnly, // video only from player, audio from decoder
45  // external player (e.g. MPlayer), release the device
46  // WARNING: USE THIS MODE ONLY AS A LAST RESORT, IF YOU
47  // ABSOLUTELY, POSITIVELY CAN'T IMPLEMENT YOUR PLAYER
48  // THE WAY IT IS SUPPOSED TO WORK. FORCING THE DEVICE
49  // TO RELEASE ITS FILES HANDLES (OR WHATEVER RESOURCES
50  // IT MAY USE) TO ALLOW AN EXTERNAL PLAYER TO ACCESS
51  // THEM MEANS THAT SUCH A PLAYER WILL NEED TO HAVE
52  // DETAILED KNOWLEDGE ABOUT THE INTERNALS OF THE DEVICE
53  // IN USE. AS A CONSEQUENCE, YOUR PLAYER MAY NOT WORK
54  // IF A PARTICULAR VDR INSTALLATION USES A DEVICE NOT
55  // KNOWN TO YOUR PLAYER.
56  };
57 
58 #define DEPRECATED_VIDEOSYSTEM
59 #ifdef DEPRECATED_VIDEOSYSTEM
62  };
63 #endif
64 
68  };
69 
73  ttAudioLast = ttAudioFirst + 31, // MAXAPIDS - 1
76  ttDolbyLast = ttDolbyFirst + 15, // MAXDPIDS - 1
79  ttSubtitleLast = ttSubtitleFirst + 31, // MAXSPIDS - 1
81  };
82 
83 #define IS_AUDIO_TRACK(t) (ttAudioFirst <= (t) && (t) <= ttAudioLast)
84 #define IS_DOLBY_TRACK(t) (ttDolbyFirst <= (t) && (t) <= ttDolbyLast)
85 #define IS_SUBTITLE_TRACK(t) (ttSubtitleFirst <= (t) && (t) <= ttSubtitleLast)
86 
87 struct tTrackId {
88  uint16_t id; // The PES packet id or the PID.
89  char language[MAXLANGCODE2]; // something like either "eng" or "deu+eng"
90  char description[32]; // something like "Dolby Digital 5.1"
91  };
92 
93 class cPlayer;
94 class cReceiver;
95 class cLiveSubtitle;
96 
97 class cDeviceHook : public cListObject {
98 public:
99  cDeviceHook(void);
103  virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const;
105  };
106 
108 
109 class cDevice : public cThread {
110  friend class cLiveSubtitle;
111  friend class cDeviceHook;
112 private:
113  static int numDevices;
114  static int useDevice;
117 public:
118  static int NumDevices(void) { return numDevices; }
120  static bool WaitForAllDevicesReady(int Timeout = 0);
126  static void SetUseDevice(int n);
130  static bool UseDevice(int n) { return useDevice == 0 || (useDevice & (1 << n)) != 0; }
133  static bool SetPrimaryDevice(int n);
137  static cDevice *PrimaryDevice(void) { return primaryDevice; }
139  static cDevice *ActualDevice(void);
142  static cDevice *GetDevice(int Index);
146  static cDevice *GetDevice(const cChannel *Channel, int Priority, bool LiveView, bool Query = false);
165  static cDevice *GetDeviceForTransponder(const cChannel *Channel, int Priority);
170  static void Shutdown(void);
173 private:
174  static int nextCardIndex;
176 protected:
177  virtual ~cDevice();
178  virtual bool Ready(void);
183  static int NextCardIndex(int n = 0);
195  virtual void MakePrimaryDevice(bool On);
202 public:
203  int DeviceNumber(void) const;
205  virtual cString DeviceType(void) const;
211  virtual cString DeviceName(void) const;
214  virtual bool HasDecoder(void) const;
216  virtual bool AvoidRecording(void) const { return false; }
219 
220 // Device hooks
221 
222 private:
224 protected:
225  bool DeviceHooksProvidesTransponder(const cChannel *Channel) const;
226 
227 // SPU facilities
228 
229 private:
232 public:
233  virtual cSpuDecoder *GetSpuDecoder(void);
236 
237 // Channel facilities
238 
239 private:
241 protected:
242  static int currentChannel;
243 public:
244  virtual bool ProvidesSource(int Source) const;
246  virtual bool ProvidesTransponder(const cChannel *Channel) const;
250  virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const;
253  virtual bool ProvidesChannel(const cChannel *Channel, int Priority = IDLEPRIORITY, bool *NeedsDetachReceivers = NULL) const;
267  virtual bool ProvidesEIT(void) const;
271  virtual int NumProvidedSystems(void) const;
277  virtual const cPositioner *Positioner(void) const;
282  virtual int SignalStrength(void) const;
287  virtual int SignalQuality(void) const;
292  virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
297  virtual bool IsTunedToTransponder(const cChannel *Channel) const;
300  virtual bool MaySwitchTransponder(const cChannel *Channel) const;
305  bool SwitchChannel(const cChannel *Channel, bool LiveView);
308  static bool SwitchChannel(int Direction);
312 private:
313  eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
315 protected:
316  virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
318 public:
319  static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; }
321  static void SetCurrentChannel(const cChannel *Channel) { currentChannel = Channel ? Channel->Number() : 0; }
325  void ForceTransferMode(void);
327  int Occupied(void) const;
329  void SetOccupied(int Seconds);
337  virtual bool HasLock(int TimeoutMs = 0) const;
343  virtual bool HasProgramme(void) const;
346 
347 // PID handle facilities
348 
349 private:
350  virtual void Action(void);
351 protected:
353  class cPidHandle {
354  public:
355  int pid;
357  int handle;
358  int used;
359  cPidHandle(void) { pid = streamType = used = 0; handle = -1; }
360  };
362  bool HasPid(int Pid) const;
364  bool AddPid(int Pid, ePidType PidType = ptOther, int StreamType = 0);
366  void DelPid(int Pid, ePidType PidType = ptOther);
368  virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
376 public:
377  void DelLivePids(void);
379 
380 // Section filter facilities
381 
382 private:
388 protected:
389  void StartSectionHandler(void);
393  void StopSectionHandler(void);
397 public:
398  virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
402  virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
406  virtual void CloseFilter(int Handle);
411  void AttachFilter(cFilter *Filter);
413  void Detach(cFilter *Filter);
415 
416 // Common Interface facilities:
417 
418 private:
421 public:
422  virtual bool HasCi(void);
424  virtual bool HasInternalCam(void) { return false; }
430  void SetCamSlot(cCamSlot *CamSlot);
432 
433 // Image Grab facilities
434 
435 public:
436  virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
448  bool GrabImageFile(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
453 
454 // Video format facilities
455 
456 public:
457  virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
463  virtual void SetVideoFormat(bool VideoFormat16_9);
468 #ifdef DEPRECATED_VIDEOSYSTEM
469  virtual eVideoSystem GetVideoSystem(void) { return vsPAL; }
473 #endif
474  virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
481  virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
492 
493 // Track facilities
494 
495 private:
505 protected:
506  virtual void SetAudioTrackDevice(eTrackType Type);
508  virtual void SetSubtitleTrackDevice(eTrackType Type);
510 public:
511  void ClrAvailableTracks(bool DescriptionsOnly = false, bool IdsOnly = false);
516  bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL);
523  const tTrackId *GetTrack(eTrackType Type);
526  int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const;
529  int NumAudioTracks(void) const;
533  int NumSubtitleTracks(void) const;
536  bool SetCurrentAudioTrack(eTrackType Type);
540  bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual = false);
546  void EnsureAudioTrack(bool Force = false);
550  void EnsureSubtitleTrack(void);
553  void SetKeepTracks(bool KeepTracks) { keepTracks = KeepTracks; }
557 
558 // Audio facilities
559 
560 private:
561  bool mute;
562  int volume;
563 protected:
564  virtual int GetAudioChannelDevice(void);
567  virtual void SetAudioChannelDevice(int AudioChannel);
569  virtual void SetVolumeDevice(int Volume);
571  virtual void SetDigitalAudioDevice(bool On);
575 public:
576  bool IsMute(void) const { return mute; }
577  bool ToggleMute(void);
579  int GetAudioChannel(void);
582  void SetAudioChannel(int AudioChannel);
585  void SetVolume(int Volume, bool Absolute = false);
588  static int CurrentVolume(void) { return primaryDevice ? primaryDevice->volume : 0; }//XXX???
589 
590 // Player facilities
591 
592 private:
599 protected:
600  virtual bool CanReplay(void) const;
602  virtual bool SetPlayMode(ePlayMode PlayMode);
605  virtual int PlayVideo(const uchar *Data, int Length);
612  virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
620  virtual int PlaySubtitle(const uchar *Data, int Length);
627  virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly = false);
632  virtual int PlayTsVideo(const uchar *Data, int Length);
640  virtual int PlayTsAudio(const uchar *Data, int Length);
648  virtual int PlayTsSubtitle(const uchar *Data, int Length);
656 public:
657  virtual int64_t GetSTC(void);
668  virtual bool IsPlayingVideo(void) const { return isPlayingVideo; }
671  virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter) { return cRect::Null; }
692  virtual void ScaleVideo(const cRect &Rect = cRect::Null) {}
700  virtual bool HasIBPTrickSpeed(void) { return false; }
703  virtual void TrickSpeed(int Speed, bool Forward);
714  virtual void Clear(void);
718  virtual void Play(void);
721  virtual void Freeze(void);
723  virtual void Mute(void);
727  virtual void StillPicture(const uchar *Data, int Length);
733  virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
738  virtual bool Flush(int TimeoutMs = 0);
744  virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly = false);
754  virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly = false);
770  bool Replaying(void) const;
772  bool Transferring(void) const;
774  void StopReplay(void);
776  bool AttachPlayer(cPlayer *Player);
778  void Detach(cPlayer *Player);
780 
781 // Receiver facilities
782 
783 private:
786 public:
787  int Priority(void) const;
790 protected:
791  virtual bool OpenDvr(void);
794  virtual void CloseDvr(void);
796  virtual bool GetTSPacket(uchar *&Data);
803 public:
804  bool Receiving(bool Dummy = false) const;
806  bool AttachReceiver(cReceiver *Receiver);
808  void Detach(cReceiver *Receiver);
810  void DetachAll(int Pid);
812  virtual void DetachAllReceivers(void);
814 
815 // --- dynamite subdevice patch start ---
816  friend class cDynamicDevice;
817 private:
821  bool isIdle;
822 protected:
825  cDevice(cDevice *ParentDevice = NULL);
826  const cPatPmtParser *PatPmtParser(void) const { if (parentDevice) return parentDevice->PatPmtParser(); return &patPmtParser; }
829 public:
830  bool IsPrimaryDevice(void) const { if (parentDevice) return parentDevice->IsPrimaryDevice(); return this == primaryDevice && HasDecoder(); }
831  int CardIndex(void) const { if (parentDevice) return parentDevice->cardIndex; return cardIndex; }
833  cCamSlot *CamSlot(void) const { if (parentDevice) return parentDevice->CamSlot(); return camSlot; }
836  bool IsSubDevice(void) const { return (parentDevice != NULL); }
837  bool HasSubDevice(void) const { return (subDevice != NULL); }
838  cDevice *SubDevice(void) const { return subDevice; }
839  bool IsIdle(void) const { if (parentDevice) return parentDevice->IsIdle(); return isIdle; }
840  bool SetIdle(bool Idle);
841  virtual bool SetIdleDevice(bool Idle, bool TestOnly) { return false; }
845  // --- dynamite subdevice patch end ---
846  };
847 
855 
856 class cTSBuffer : public cThread {
857 private:
858  int f;
860  bool delivered;
862  virtual void Action(void);
863 public:
864  cTSBuffer(int File, int Size, int CardIndex);
865  virtual ~cTSBuffer();
866  uchar *Get(int *Available = NULL);
873  void Skip(int Count);
880  };
881 
889 
890 #define __DYNAMIC_DEVICE_PROBE
891 
893 
895  friend class cDynamicDevice;
896 private:
898  public:
901  cDynamicDeviceProbeItem(eDynamicDeviceProbeCommand Cmd, cString *DevPath):cmd(Cmd),devpath(DevPath) {}
902  virtual ~cDynamicDeviceProbeItem() { if (devpath) delete devpath; }
903  };
908 public:
909  static void QueueDynamicDeviceCommand(eDynamicDeviceProbeCommand Cmd, const char *DevPath);
913  cDynamicDeviceProbe(void);
914  virtual ~cDynamicDeviceProbe();
915  virtual cDevice *Attach(cDevice *ParentDevice, const char *DevPath) = 0;
921  };
922 
924 
925 #endif //__DEVICE_H
cEitFilter * eitFilter
Definition: device.h:384
static int nextCardIndex
Definition: device.h:174
cPatPmtParser patPmtParser
Definition: device.h:594
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
Definition: device.c:730
virtual eVideoSystem GetVideoSystem(void)
Returns the video system of the currently displayed material (default is PAL).
Definition: device.h:469
int cardIndex
Definition: device.h:859
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:130
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:705
bool Replaying(void) const
Returns true if we are currently replaying.
Definition: device.c:1279
unsigned char uchar
Definition: tools.h:30
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices - 1).
Definition: device.c:197
uchar * Get(int *Available=NULL)
Returns a pointer to the first TS packet in the buffer.
Definition: device.c:1857
int Number(void) const
Definition: channels.h:179
cNitFilter * nitFilter
Definition: device.h:387
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:903
Definition: device.h:71
cPlayer * player
Definition: device.h:593
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
Definition: device.c:953
eSetChannelResult
Definition: device.h:36
int Index(void) const
Definition: tools.c:1989
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
Definition: device.c:735
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:421
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:710
bool Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
Definition: device.c:1634
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
Definition: device.c:1054
cSdtFilter * sdtFilter
Definition: device.h:386
cRingBufferLinear * ringBuffer
Definition: device.h:861
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
Definition: device.c:1794
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:643
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:904
bool isIdle
Definition: device.h:821
char description[32]
Definition: device.h:90
int f
Definition: device.h:858
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
Definition: device.c:1180
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
Definition: device.c:680
cReceiver * receiver[MAXRECEIVERS]
Definition: device.h:785
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:475
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
Definition: device.c:648
Definition: nit.h:19
void SetCamSlot(cCamSlot *CamSlot)
Sets the given CamSlot to be used with this device.
Definition: device.c:399
bool mute
Definition: device.h:561
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
Definition: device.c:218
#define MAXDEVICES
Definition: device.h:29
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:448
void Detach(cFilter *Filter)
Detaches the given filter from this device.
Definition: device.c:667
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
Definition: device.c:261
int cardIndex
Definition: device.h:175
cDevice(cDevice *ParentDevice=NULL)
Definition: device.c:75
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
Definition: device.c:565
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
Definition: device.c:1717
static int currentChannel
Definition: device.h:242
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:1020
int volume
Definition: device.h:562
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
Definition: device.c:1201
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:1893
bool autoSelectPreferredSubtitleLanguage
Definition: device.h:502
Definition: device.h:70
static int NumDevices(void)
Returns the total number of devices.
Definition: device.h:118
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:1649
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:482
eTrackType GetCurrentSubtitleTrack(void) const
Definition: device.h:539
virtual void Clear(void)
Clears all video and audio data from the device.
Definition: device.c:1194
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
Definition: device.c:1516
eTrackType
Definition: device.h:70
void DelLivePids(void)
Deletes the live viewing PIDs.
Definition: device.c:600
Definition: device.h:39
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
Definition: device.c:658
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
Definition: device.c:1064
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds. ...
Definition: device.h:700
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:471
cDynamicDeviceProbeItem(eDynamicDeviceProbeCommand Cmd, cString *DevPath)
Definition: device.h:901
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:1370
cTsToPes tsToPesSubtitle
Definition: device.h:597
eTrackType currentSubtitleTrack
Definition: device.h:498
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition: device.c:928
virtual void Mute(void)
Turns off audio while replaying.
Definition: device.c:1215
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:671
Definition: filter.h:41
cTSBuffer(int File, int Size, int CardIndex)
Definition: device.c:1817
Definition: osd.h:158
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
Definition: device.c:1074
static int NextCardIndex(int n=0)
Calculates the next card index.
Definition: device.c:185
static int CurrentVolume(void)
Definition: device.h:588
bool IsPrimaryDevice(void) const
Definition: device.h:830
virtual bool Ready(void)
Returns true if this device is ready.
Definition: device.c:1629
A steerable satellite dish generally points to the south on the northern hemisphere, and to the north on the southern hemisphere (unless you're located directly on the equator, in which case the general direction is "up").
Definition: positioner.h:31
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
Definition: device.c:1153
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:833
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
Definition: device.c:1284
cDeviceHook(void)
Creates a new device hook object.
Definition: device.c:51
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
Definition: device.c:725
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:745
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
Definition: device.c:1208
int pre_1_3_19_PrivateStream
Definition: device.h:504
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
Definition: device.c:213
cPatFilter * patFilter
Definition: device.h:385
Definition: player.h:16
tTrackId availableTracks[ttMaxTrackTypes]
Definition: device.h:496
#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:56
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
Definition: device.h:319
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
Definition: device.c:715
bool isPlayingVideo
Definition: device.h:598
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
Definition: device.c:608
time_t startScrambleDetection
Definition: device.h:419
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
Definition: device.c:937
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
Definition: device.c:623
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:982
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:248
cMutex mutexCurrentSubtitleTrack
Definition: device.h:500
Definition: osd.h:352
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
Definition: device.c:750
virtual bool IsPlayingVideo(void) const
Returns true if the currently attached player has delivered any video packets.
Definition: device.h:668
virtual ~cDevice()
Definition: device.c:130
cTsToPes tsToPesVideo
Definition: device.h:595
virtual void CloseDvr(void)
Shuts down the DVR.
Definition: device.c:1708
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
Definition: device.c:918
cTsToPes tsToPesAudio
Definition: device.h:596
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
Definition: device.c:913
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:841
cCamSlot * camSlot
Definition: device.h:420
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
Definition: device.c:997
eVideoDisplayFormat
Definition: device.h:65
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:923
bool delivered
Definition: device.h:860
bool HasSubDevice(void) const
Definition: device.h:837
Definition: ci.h:130
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:416
static cDevice * primaryDevice
Definition: device.h:116
friend class cDynamicDevice
Definition: device.h:816
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
Definition: device.c:1808
static int numDevices
Definition: device.h:113
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition: device.c:933
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
Definition: device.c:595
cSectionHandler * sectionHandler
Definition: device.h:383
int Occupied(void) const
Returns the number of seconds this device is still occupied for.
Definition: device.c:895
ePlayMode
Definition: device.h:39
eTrackType currentAudioTrack
Definition: device.h:497
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:163
static const cRect Null
Definition: osd.h:357
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:1468
cDevice * parentDevice
Definition: device.h:823
eVideoSystem
Definition: device.h:60
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:1885
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:692
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:691
static cDevice * nextParentDevice
Holds the parent device for the next subdevice so the dynamite-plugin can work with unpatched plugins...
Definition: device.h:818
#define MAXLANGCODE2
Definition: channels.h:41
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:216
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:1835
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
Definition: device.c:653
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:1703
virtual bool Flush(int TimeoutMs=0)
Returns true if the device's output buffers are empty, i.
Definition: device.c:1348
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:826
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
Definition: device.h:831
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
Definition: device.c:208
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:1614
cDevice * subDevice
Definition: device.h:824
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1497
Definition: device.h:74
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:374
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
Definition: device.c:1358
bool SetIdle(bool Idle)
Definition: device.c:142
cMutex mutexReceiver
Definition: device.h:784
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
Definition: device.c:1546
Definition: pat.h:19
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
Definition: device.c:949
virtual ~cDynamicDeviceProbe()
Definition: device.c:1908
static int useDevice
Definition: device.h:114
Definition: device.h:60
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
Definition: device.c:1120
static cDevice * PrimaryDevice(void)
Returns the primary device.
Definition: device.h:137
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:1712
cLiveSubtitle * liveSubtitle
Definition: device.h:230
friend class cDynamicDevice
Definition: device.h:895
virtual ~cTSBuffer()
Definition: device.c:1829
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
Definition: device.c:801
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
Definition: device.c:226
void StopReplay(void)
Stops the current replay session (if any).
Definition: device.c:1332
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:1049
bool IsSubDevice(void) const
Definition: device.h:836
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:970
static cList< cDeviceHook > deviceHooks
Definition: device.h:223
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:321
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:1343
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles...
Definition: device.c:1185
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:696
int currentAudioTrackMissingCount
Definition: device.h:501
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
Definition: device.c:740
Definition: thread.h:77
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
Definition: device.c:1289
time_t occupiedTimeout
Definition: device.h:240
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:1897
static void Shutdown(void)
Closes down all devices.
Definition: device.c:407
cMutex mutexCurrentAudioTrack
Definition: device.h:499
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise...
Definition: device.c:253
void SetKeepTracks(bool KeepTracks)
Controls whether the current audio and subtitle track settings shall be kept as they currently are...
Definition: device.h:553
eDynamicDeviceProbeCommand cmd
Definition: device.h:899
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
Definition: device.c:1175
char language[MAXLANGCODE2]
Definition: device.h:89
virtual void TrickSpeed(int Speed, bool Forward)
Sets the device into a mode where replay is done slower.
Definition: device.c:1190
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
Definition: device.c:492
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
Definition: device.c:675
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
Definition: device.c:243
Definition: device.h:36
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1532
eDynamicDeviceProbeCommand
Definition: device.h:892
cDevice * SubDevice(void) const
Definition: device.h:838
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition: device.c:976
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1363
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
Definition: device.c:884
#define MAXPIDHANDLES
Definition: device.h:30
bool IsIdle(void) const
Definition: device.h:839
#define MAXRECEIVERS
Definition: device.h:31
bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual=false)
Sets the current subtitle track to the given Type.
Definition: device.c:1092
ePidType
Definition: device.h:352
bool keepTracks
Definition: device.h:503
Definition: tools.h:357
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets ...
Definition: device.h:856
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
Definition: device.c:1220
Definition: device.h:61
cDvbSubtitleConverter * dvbSubtitleConverter
Definition: device.h:231
eTrackType GetCurrentAudioTrack(void) const
Definition: device.h:535
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1353
cPidHandle pidHandles[MAXPIDHANDLES]
Definition: device.h:361
virtual void SetDigitalAudioDevice(bool On)
Tells the output device that the current audio track is Dolby Digital.
Definition: device.c:941
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
Definition: device.c:1069
cDynamicDeviceProbe(void)
Definition: device.c:1903
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
Definition: device.c:179
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
Definition: device.c:394
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:501
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:720
The cDevice class is the base from which actual devices can be derived.
Definition: device.h:109
virtual bool HasInternalCam(void)
Returns true if this device handles encrypted channels itself without VDR assistance.
Definition: device.h:424
Definition: tools.h:168
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
Definition: device.c:945
bool IsMute(void) const
Definition: device.h:576
static cDevice * device[MAXDEVICES]
Definition: device.h:115
uint16_t id
Definition: device.h:88