vdr  2.4.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 4.12 2017/11/02 14:47:33 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 
61  };
62 
66  ttAudioLast = ttAudioFirst + 31, // MAXAPIDS - 1
69  ttDolbyLast = ttDolbyFirst + 15, // MAXDPIDS - 1
72  ttSubtitleLast = ttSubtitleFirst + 31, // MAXSPIDS - 1
74  };
75 
76 #define IS_AUDIO_TRACK(t) (ttAudioFirst <= (t) && (t) <= ttAudioLast)
77 #define IS_DOLBY_TRACK(t) (ttDolbyFirst <= (t) && (t) <= ttDolbyLast)
78 #define IS_SUBTITLE_TRACK(t) (ttSubtitleFirst <= (t) && (t) <= ttSubtitleLast)
79 
80 struct tTrackId {
81  uint16_t id; // The PES packet id or the PID.
82  char language[MAXLANGCODE2]; // something like either "eng" or "deu+eng"
83  char description[32]; // something like "Dolby Digital 5.1"
84  };
85 
86 class cPlayer;
87 class cReceiver;
88 class cLiveSubtitle;
89 
90 class cDeviceHook : public cListObject {
91 public:
92  cDeviceHook(void);
96  virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const;
98  };
99 
101 
102 #define DTV_STAT_VALID_NONE 0x0000
103 #define DTV_STAT_VALID_STRENGTH 0x0001
104 #define DTV_STAT_VALID_CNR 0x0002
105 #define DTV_STAT_VALID_BERPRE 0x0004
106 #define DTV_STAT_VALID_BERPOST 0x0008
107 #define DTV_STAT_VALID_PER 0x0010
108 #define DTV_STAT_VALID_STATUS 0x0020
109 
110 #define DTV_STAT_HAS_NONE 0x0000
111 #define DTV_STAT_HAS_SIGNAL 0x0001
112 #define DTV_STAT_HAS_CARRIER 0x0002
113 #define DTV_STAT_HAS_VITERBI 0x0004
114 #define DTV_STAT_HAS_SYNC 0x0008
115 #define DTV_STAT_HAS_LOCK 0x0010
116 
117 class cDevice : public cThread {
118  friend class cLiveSubtitle;
119  friend class cDeviceHook;
120  friend class cReceiver;
121 private:
122  static int numDevices;
123  static int useDevice;
126 public:
127  static int NumDevices(void) { return numDevices; }
129  static bool WaitForAllDevicesReady(int Timeout = 0);
135  static void SetUseDevice(int n);
139  static bool UseDevice(int n) { return useDevice == 0 || (useDevice & (1 << n)) != 0; }
142  static bool SetPrimaryDevice(int n);
146  static cDevice *PrimaryDevice(void) { return primaryDevice; }
148  static cDevice *ActualDevice(void);
151  static cDevice *GetDevice(int Index);
155  static cDevice *GetDevice(const cChannel *Channel, int Priority, bool LiveView, bool Query = false);
174  static cDevice *GetDeviceForTransponder(const cChannel *Channel, int Priority);
179  static void Shutdown(void);
182 private:
183  static int nextCardIndex;
185 protected:
186  cDevice(void);
187  virtual ~cDevice();
188  virtual bool Ready(void);
193  static int NextCardIndex(int n = 0);
205  virtual void MakePrimaryDevice(bool On);
212 public:
213  bool IsPrimaryDevice(void) const { return this == primaryDevice && HasDecoder(); }
214  int CardIndex(void) const { return cardIndex; }
216  int DeviceNumber(void) const;
218  virtual cString DeviceType(void) const;
224  virtual cString DeviceName(void) const;
227  virtual bool HasDecoder(void) const;
229  virtual bool AvoidRecording(void) const { return false; }
232 
233 // Device hooks
234 
235 private:
237 protected:
238  bool DeviceHooksProvidesTransponder(const cChannel *Channel) const;
239 
240 // SPU facilities
241 
242 private:
245 public:
246  virtual cSpuDecoder *GetSpuDecoder(void);
249 
250 // Channel facilities
251 
252 private:
255 protected:
256  static int currentChannel;
257 public:
258  virtual bool ProvidesSource(int Source) const;
260  virtual bool ProvidesTransponder(const cChannel *Channel) const;
264  virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const;
267  virtual bool ProvidesChannel(const cChannel *Channel, int Priority = IDLEPRIORITY, bool *NeedsDetachReceivers = NULL) const;
281  virtual bool ProvidesEIT(void) const;
285  virtual int NumProvidedSystems(void) const;
291  virtual const cPositioner *Positioner(void) const;
296  virtual bool SignalStats(int &Valid, double *Strength = NULL, double *Cnr = NULL, double *BerPre = NULL, double *BerPost = NULL, double *Per = NULL, int *Status = NULL) const;
313  virtual int SignalStrength(void) const;
318  virtual int SignalQuality(void) const;
323  virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
328  virtual bool IsTunedToTransponder(const cChannel *Channel) const;
331  virtual bool MaySwitchTransponder(const cChannel *Channel) const;
336  bool SwitchChannel(const cChannel *Channel, bool LiveView);
339  static bool SwitchChannel(int Direction);
343 private:
344  eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
346 protected:
347  virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
349 public:
350  static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; }
352 #ifndef DEPRECATED_SETCURRENTCHANNEL
353 #define DEPRECATED_SETCURRENTCHANNEL 1
354 #endif
355 #if DEPRECATED_SETCURRENTCHANNEL
356  static void SetCurrentChannel(const cChannel *Channel) { currentChannel = Channel ? Channel->Number() : 0; }
357 #endif
358  static void SetCurrentChannel(int ChannelNumber) { currentChannel = ChannelNumber; }
362  void ForceTransferMode(void);
364  int Occupied(void) const;
366  void SetOccupied(int Seconds);
374  virtual bool HasLock(int TimeoutMs = 0) const;
380  virtual bool HasProgramme(void) const;
383 
384 // PID handle facilities
385 
386 private:
387  mutable cMutex mutexPids;
388  virtual void Action(void);
389 protected:
391  class cPidHandle {
392  public:
393  int pid;
395  int handle;
396  int used;
397  cPidHandle(void) { pid = streamType = used = 0; handle = -1; }
398  };
400  bool HasPid(int Pid) const;
402  bool AddPid(int Pid, ePidType PidType = ptOther, int StreamType = 0);
404  void DelPid(int Pid, ePidType PidType = ptOther);
406  virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
414 public:
415  void DelLivePids(void);
417 
418 // Section filter facilities
419 
420 private:
426 protected:
427  void StartSectionHandler(void);
431  void StopSectionHandler(void);
435 public:
436  virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
440  virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
444  virtual void CloseFilter(int Handle);
449  void AttachFilter(cFilter *Filter);
451  void Detach(cFilter *Filter);
453 
454 // Common Interface facilities:
455 
456 private:
458 public:
459  virtual bool HasCi(void);
461  virtual bool HasInternalCam(void) { return false; }
467  void SetCamSlot(cCamSlot *CamSlot);
469  cCamSlot *CamSlot(void) const { return camSlot; }
472 
473 // Image Grab facilities
474 
475 public:
476  virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
488  bool GrabImageFile(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
493 
494 // Video format facilities
495 
496 public:
497  virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
503  virtual void SetVideoFormat(bool VideoFormat16_9);
508  virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
515  virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
526 
527 // Track facilities
528 
529 private:
539 protected:
540  virtual void SetAudioTrackDevice(eTrackType Type);
542  virtual void SetSubtitleTrackDevice(eTrackType Type);
544 public:
545  void ClrAvailableTracks(bool DescriptionsOnly = false, bool IdsOnly = false);
550  bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL);
557  const tTrackId *GetTrack(eTrackType Type);
560  int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const;
563  int NumAudioTracks(void) const;
567  int NumSubtitleTracks(void) const;
570  bool SetCurrentAudioTrack(eTrackType Type);
574  bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual = false);
580  void EnsureAudioTrack(bool Force = false);
584  void EnsureSubtitleTrack(void);
587  void SetKeepTracks(bool KeepTracks) { keepTracks = KeepTracks; }
591 
592 // Audio facilities
593 
594 private:
595  bool mute;
596  int volume;
597 protected:
598  virtual int GetAudioChannelDevice(void);
601  virtual void SetAudioChannelDevice(int AudioChannel);
603  virtual void SetVolumeDevice(int Volume);
605  virtual void SetDigitalAudioDevice(bool On);
609 public:
610  bool IsMute(void) const { return mute; }
611  bool ToggleMute(void);
613  int GetAudioChannel(void);
616  void SetAudioChannel(int AudioChannel);
619  void SetVolume(int Volume, bool Absolute = false);
622  static int CurrentVolume(void) { return primaryDevice ? primaryDevice->volume : 0; }//XXX???
623 
624 // Player facilities
625 
626 private:
633 protected:
634  const cPatPmtParser *PatPmtParser(void) const { return &patPmtParser; }
637  virtual bool CanReplay(void) const;
639  virtual bool SetPlayMode(ePlayMode PlayMode);
642  virtual int PlayVideo(const uchar *Data, int Length);
649  virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
657  virtual int PlaySubtitle(const uchar *Data, int Length);
664  virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly = false);
669  virtual int PlayTsVideo(const uchar *Data, int Length);
677  virtual int PlayTsAudio(const uchar *Data, int Length);
685  virtual int PlayTsSubtitle(const uchar *Data, int Length);
693 public:
694  virtual int64_t GetSTC(void);
705  virtual bool IsPlayingVideo(void) const { return isPlayingVideo; }
708  virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter) { return cRect::Null; }
729  virtual void ScaleVideo(const cRect &Rect = cRect::Null) {}
737  virtual bool HasIBPTrickSpeed(void) { return false; }
740  virtual void TrickSpeed(int Speed, bool Forward);
751  virtual void Clear(void);
755  virtual void Play(void);
758  virtual void Freeze(void);
760  virtual void Mute(void);
764  virtual void StillPicture(const uchar *Data, int Length);
770  virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
775  virtual bool Flush(int TimeoutMs = 0);
781  virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly = false);
791  virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly = false);
807  bool Replaying(void) const;
809  bool Transferring(void) const;
811  void StopReplay(void);
813  bool AttachPlayer(cPlayer *Player);
815  void Detach(cPlayer *Player);
817 
818 // Receiver facilities
819 
820 private:
823 public:
824  int Priority(void) const;
827 protected:
828  virtual bool OpenDvr(void);
831  virtual void CloseDvr(void);
833  virtual bool GetTSPacket(uchar *&Data);
840 public:
841  bool Receiving(bool Dummy = false) const;
843  bool AttachReceiver(cReceiver *Receiver);
845  void Detach(cReceiver *Receiver);
847  void DetachAll(int Pid);
849  virtual void DetachAllReceivers(void);
851  };
852 
860 
861 class cTSBuffer : public cThread {
862 private:
863  int f;
867  virtual void Action(void);
868 public:
869  cTSBuffer(int File, int Size, int CardIndex);
870  virtual ~cTSBuffer();
871  uchar *Get(int *Available = NULL, bool CheckAvailable = false);
882  void Skip(int Count);
889  };
890 
891 #endif //__DEVICE_H
cEitFilter * eitFilter
Definition: device.h:422
static int nextCardIndex
Definition: device.h:183
cPatPmtParser patPmtParser
Definition: device.h:628
int cardIndex
Definition: device.h:864
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:139
unsigned char uchar
Definition: tools.h:31
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
Definition: device.c:1082
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
Definition: device.c:945
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:780
cNitFilter * nitFilter
Definition: device.h:425
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:934
Definition: device.h:64
cPlayer * player
Definition: device.h:627
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
Definition: device.c:981
eSetChannelResult
Definition: device.h:36
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:469
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:460
cSdtFilter * sdtFilter
Definition: device.h:424
cRingBufferLinear * ringBuffer
Definition: device.h:866
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
Definition: device.c:1829
Definition: eit.h:23
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask)
Opens a file handle for the given filter data.
Definition: device.c:678
char description[32]
Definition: device.h:83
int f
Definition: device.h:863
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
Definition: device.c:1208
bool IsPrimaryDevice(void) const
Definition: device.h:213
cReceiver * receiver[MAXRECEIVERS]
Definition: device.h:822
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:514
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:950
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
Definition: device.c:683
Definition: nit.h:16
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:229
void SetCamSlot(cCamSlot *CamSlot)
Sets the given CamSlot to be used with this device.
Definition: device.c:440
bool mute
Definition: device.h:595
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
Definition: device.c:179
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:735
#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:487
void Detach(cFilter *Filter)
Detaches the given filter from this device.
Definition: device.c:699
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
Definition: device.c:223
int cardIndex
Definition: device.h:184
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
Definition: device.c:606
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
Definition: device.c:1748
static int currentChannel
Definition: device.h:256
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:1048
int volume
Definition: device.h:596
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
Definition: device.c:1229
bool autoSelectPreferredSubtitleLanguage
Definition: device.h:536
Definition: device.h:63
static int NumDevices(void)
Returns the total number of devices.
Definition: device.h:127
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:1662
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:521
virtual void Clear(void)
Clears all video and audio data from the device.
Definition: device.c:1222
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
Definition: device.c:1537
eTrackType
Definition: device.h:63
void DelLivePids(void)
Deletes the live viewing PIDs.
Definition: device.c:642
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:755
Definition: device.h:39
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
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
Definition: device.c:693
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds.
Definition: device.h:737
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:510
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
Definition: device.c:1097
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:1391
cTsToPes tsToPesSubtitle
Definition: device.h:631
eTrackType currentSubtitleTrack
Definition: device.h:532
eTrackType GetCurrentAudioTrack(void) const
Definition: device.h:569
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
Definition: device.c:705
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition: device.c:956
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
Definition: device.c:745
virtual void Mute(void)
Turns off audio while replaying.
Definition: device.c:1243
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:708
Definition: filter.h:49
cTSBuffer(int File, int Size, int CardIndex)
Definition: device.c:1850
Definition: osd.h:158
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
Definition: device.c:1102
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:740
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
Definition: device.c:174
static int NextCardIndex(int n=0)
Calculates the next card index.
Definition: device.c:148
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
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:1648
static int CurrentVolume(void)
Definition: device.h:622
virtual bool Ready(void)
Returns true if this device is ready.
Definition: device.c:1643
A steerable satellite dish generally points to the south on the northern hemisphere,...
Definition: positioner.h:31
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
Definition: device.c:1181
cDeviceHook(void)
Creates a new device hook object.
Definition: device.c:51
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
Definition: device.c:1236
int pre_1_3_19_PrivateStream
Definition: device.h:538
cPatFilter * patFilter
Definition: device.h:423
Definition: player.h:16
tTrackId availableTracks[ttMaxTrackTypes]
Definition: device.h:530
#define IDLEPRIORITY
Definition: config.h:43
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
Definition: device.h:350
bool isPlayingVideo
Definition: device.h:632
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
Definition: device.c:651
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
Definition: device.c:965
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
Definition: device.c:662
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:1010
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:210
cMutex mutexCurrentSubtitleTrack
Definition: device.h:534
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
Definition: device.c:770
Definition: osd.h:352
cDevice(void)
Definition: device.c:74
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
Definition: device.c:785
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
Definition: device.c:760
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
Definition: device.c:765
virtual ~cDevice()
Definition: device.c:115
cTsToPes tsToPesVideo
Definition: device.h:629
virtual void CloseDvr(void)
Shuts down the DVR.
Definition: device.c:1739
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
Definition: device.c:1203
int delivered
Definition: device.h:865
cTsToPes tsToPesAudio
Definition: device.h:630
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
Definition: device.c:940
cCamSlot * camSlot
Definition: device.h:457
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
Definition: device.c:1025
eVideoDisplayFormat
Definition: device.h:58
cMutex mutexPids
Definition: device.h:387
cMutex mutexChannel
Definition: device.h:253
int Occupied(void) const
Returns the number of seconds this device is still occupied for.
Definition: device.c:928
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:726
Definition: ci.h:232
static void SetCurrentChannel(int ChannelNumber)
Sets the number of the current channel on the primary device, without actually switching to it.
Definition: device.h:358
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:455
static cDevice * primaryDevice
Definition: device.h:125
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
Definition: device.c:1841
static int numDevices
Definition: device.h:122
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition: device.c:961
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
Definition: device.c:637
cSectionHandler * sectionHandler
Definition: device.h:421
ePlayMode
Definition: device.h:39
eTrackType currentAudioTrack
Definition: device.h:531
Definition: thread.h:67
static bool WaitForAllDevicesReady(int Timeout=0)
Waits until all devices have become ready, or the given Timeout (seconds) has expired.
Definition: device.c:126
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:1489
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:1921
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
Definition: device.h:214
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:729
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
Definition: device.c:205
#define MAXLANGCODE2
Definition: channels.h:37
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:1868
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
Definition: device.c:688
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:1734
virtual bool Flush(int TimeoutMs=0)
Returns true if the device's output buffers are empty, i.
Definition: device.c:1369
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1518
Definition: device.h:67
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:415
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
Definition: device.c:1379
cMutex mutexReceiver
Definition: device.h:821
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
Definition: device.c:169
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
Definition: device.c:1567
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:634
uchar * Get(int *Available=NULL, bool CheckAvailable=false)
Returns a pointer to the first TS packet in the buffer.
Definition: device.c:1891
Definition: pat.h:19
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
Definition: device.c:977
static int useDevice
Definition: device.h:123
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices - 1).
Definition: device.c:160
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
Definition: device.c:1148
static cDevice * PrimaryDevice(void)
Returns the primary device.
Definition: device.h:146
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:1743
bool IsMute(void) const
Definition: device.h:610
cLiveSubtitle * liveSubtitle
Definition: device.h:243
virtual ~cTSBuffer()
Definition: device.c:1862
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
Definition: device.c:837
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
Definition: device.c:187
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:750
void StopReplay(void)
Stops the current replay session (if any).
Definition: device.c:1355
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:1077
unsigned char u_char
Definition: headers.h:24
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
Definition: device.c:531
int GetAudioChannel(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition: device.c:998
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
Definition: device.c:1312
static cList< cDeviceHook > deviceHooks
Definition: device.h:236
static void SetCurrentChannel(const cChannel *Channel)
Definition: device.h:356
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:1364
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
Definition: device.c:1213
int currentAudioTrackMissingCount
Definition: device.h:535
Definition: thread.h:79
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
Definition: device.c:1317
time_t occupiedTimeout
Definition: device.h:254
static void Shutdown(void)
Closes down all devices.
Definition: device.c:446
cMutex mutexCurrentAudioTrack
Definition: device.h:533
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise.
Definition: device.c:215
void SetKeepTracks(bool KeepTracks)
Controls whether the current audio and subtitle track settings shall be kept as they currently are,...
Definition: device.h:587
virtual bool IsPlayingVideo(void) const
Returns true if the currently attached player has delivered any video packets.
Definition: device.h:705
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
Definition: device.c:775
char language[MAXLANGCODE2]
Definition: device.h:82
virtual void TrickSpeed(int Speed, bool Forward)
Sets the device into a mode where replay is done slower.
Definition: device.c:1218
Definition: device.h:36
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1553
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition: device.c:1004
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1384
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
Definition: device.c:919
#define MAXPIDHANDLES
Definition: device.h:30
#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:1120
ePidType
Definition: device.h:390
bool keepTracks
Definition: device.h:537
Definition: tools.h:393
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets ...
Definition: device.h:861
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
Definition: device.c:1248
cDvbSubtitleConverter * dvbSubtitleConverter
Definition: device.h:244
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1374
cPidHandle pidHandles[MAXPIDHANDLES]
Definition: device.h:399
virtual void SetDigitalAudioDevice(bool On)
Tells the output device that the current audio track is Dolby Digital.
Definition: device.c:969
bool Replaying(void) const
Returns true if we are currently replaying.
Definition: device.c:1307
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
Definition: device.c:1092
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
Definition: device.c:142
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
Definition: device.c:435
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:541
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:721
int Priority(void) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY),...
Definition: device.c:1630
virtual bool HasInternalCam(void)
Returns true if this device handles encrypted channels itself without VDR assistance.
Definition: device.h:461
Definition: tools.h:176
int Number(void) const
Definition: channels.h:179
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
Definition: device.c:973
static cDevice * device[MAXDEVICES]
Definition: device.h:124
uint16_t id
Definition: device.h:81
eTrackType GetCurrentSubtitleTrack(void) const
Definition: device.h:573