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  cDevice(void);
178  virtual ~cDevice();
179  virtual bool Ready(void);
184  static int NextCardIndex(int n = 0);
196  virtual void MakePrimaryDevice(bool On);
203 public:
204  bool IsPrimaryDevice(void) const { return this == primaryDevice && HasDecoder(); }
205  int CardIndex(void) const { return cardIndex; }
207  int DeviceNumber(void) const;
209  virtual cString DeviceType(void) const;
215  virtual cString DeviceName(void) const;
218  virtual bool HasDecoder(void) const;
220  virtual bool AvoidRecording(void) const { return false; }
223 
224 // Device hooks
225 
226 private:
228 protected:
229  bool DeviceHooksProvidesTransponder(const cChannel *Channel) const;
230 
231 // SPU facilities
232 
233 private:
236 public:
237  virtual cSpuDecoder *GetSpuDecoder(void);
240 
241 // Channel facilities
242 
243 private:
245 protected:
246  static int currentChannel;
247 public:
248  virtual bool ProvidesSource(int Source) const;
250  virtual bool ProvidesTransponder(const cChannel *Channel) const;
254  virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const;
257  virtual bool ProvidesChannel(const cChannel *Channel, int Priority = IDLEPRIORITY, bool *NeedsDetachReceivers = NULL) const;
271  virtual bool ProvidesEIT(void) const;
275  virtual int NumProvidedSystems(void) const;
281  virtual const cPositioner *Positioner(void) const;
286  virtual int SignalStrength(void) const;
291  virtual int SignalQuality(void) const;
296  virtual const cChannel *GetCurrentlyTunedTransponder(void) const;
301  virtual bool IsTunedToTransponder(const cChannel *Channel) const;
304  virtual bool MaySwitchTransponder(const cChannel *Channel) const;
309  bool SwitchChannel(const cChannel *Channel, bool LiveView);
312  static bool SwitchChannel(int Direction);
316 private:
317  eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView);
319 protected:
320  virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
322 public:
323  static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; }
325  static void SetCurrentChannel(const cChannel *Channel) { currentChannel = Channel ? Channel->Number() : 0; }
329  void ForceTransferMode(void);
331  int Occupied(void) const;
333  void SetOccupied(int Seconds);
341  virtual bool HasLock(int TimeoutMs = 0) const;
347  virtual bool HasProgramme(void) const;
350 
351 // PID handle facilities
352 
353 private:
354  virtual void Action(void);
355 protected:
357  class cPidHandle {
358  public:
359  int pid;
361  int handle;
362  int used;
363  cPidHandle(void) { pid = streamType = used = 0; handle = -1; }
364  };
366  bool HasPid(int Pid) const;
368  bool AddPid(int Pid, ePidType PidType = ptOther, int StreamType = 0);
370  void DelPid(int Pid, ePidType PidType = ptOther);
372  virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
380 public:
381  void DelLivePids(void);
383 
384 // Section filter facilities
385 
386 private:
392 protected:
393  void StartSectionHandler(void);
397  void StopSectionHandler(void);
401 public:
402  virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
406  virtual int ReadFilter(int Handle, void *Buffer, size_t Length);
410  virtual void CloseFilter(int Handle);
415  void AttachFilter(cFilter *Filter);
417  void Detach(cFilter *Filter);
419 
420 // Common Interface facilities:
421 
422 private:
425 public:
426  virtual bool HasCi(void);
428  virtual bool HasInternalCam(void) { return false; }
434  void SetCamSlot(cCamSlot *CamSlot);
436  cCamSlot *CamSlot(void) const { return camSlot; }
439 
440 // Image Grab facilities
441 
442 public:
443  virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
455  bool GrabImageFile(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
460 
461 // Video format facilities
462 
463 public:
464  virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
470  virtual void SetVideoFormat(bool VideoFormat16_9);
475 #ifdef DEPRECATED_VIDEOSYSTEM
476  virtual eVideoSystem GetVideoSystem(void) { return vsPAL; }
480 #endif
481  virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
488  virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
499 
500 // Track facilities
501 
502 private:
512 protected:
513  virtual void SetAudioTrackDevice(eTrackType Type);
515  virtual void SetSubtitleTrackDevice(eTrackType Type);
517 public:
518  void ClrAvailableTracks(bool DescriptionsOnly = false, bool IdsOnly = false);
523  bool SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language = NULL, const char *Description = NULL);
530  const tTrackId *GetTrack(eTrackType Type);
533  int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const;
536  int NumAudioTracks(void) const;
540  int NumSubtitleTracks(void) const;
543  bool SetCurrentAudioTrack(eTrackType Type);
547  bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual = false);
553  void EnsureAudioTrack(bool Force = false);
557  void EnsureSubtitleTrack(void);
560  void SetKeepTracks(bool KeepTracks) { keepTracks = KeepTracks; }
564 
565 // Audio facilities
566 
567 private:
568  bool mute;
569  int volume;
570 protected:
571  virtual int GetAudioChannelDevice(void);
574  virtual void SetAudioChannelDevice(int AudioChannel);
576  virtual void SetVolumeDevice(int Volume);
578  virtual void SetDigitalAudioDevice(bool On);
582 public:
583  bool IsMute(void) const { return mute; }
584  bool ToggleMute(void);
586  int GetAudioChannel(void);
589  void SetAudioChannel(int AudioChannel);
592  void SetVolume(int Volume, bool Absolute = false);
595  static int CurrentVolume(void) { return primaryDevice ? primaryDevice->volume : 0; }//XXX???
596 
597 // Player facilities
598 
599 private:
607 protected:
608  const cPatPmtParser *PatPmtParser(void) const { return &patPmtParser; }
611  virtual bool CanReplay(void) const;
613  virtual bool SetPlayMode(ePlayMode PlayMode);
616  virtual int PlayVideo(const uchar *Data, int Length);
623  virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
631  virtual int PlaySubtitle(const uchar *Data, int Length);
638  virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly = false);
643  virtual int PlayTsVideo(const uchar *Data, int Length);
651  virtual int PlayTsAudio(const uchar *Data, int Length);
659  virtual int PlayTsSubtitle(const uchar *Data, int Length);
667 public:
668  virtual int64_t GetSTC(void);
679  virtual bool IsPlayingVideo(void) const { return isPlayingVideo; }
682  virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter) { return cRect::Null; }
703  virtual void ScaleVideo(const cRect &Rect = cRect::Null) {}
711  virtual bool HasIBPTrickSpeed(void) { return false; }
714  virtual void TrickSpeed(int Speed, bool Forward);
725  virtual void Clear(void);
729  virtual void Play(void);
732  virtual void Freeze(void);
734  virtual void Mute(void);
738  virtual void StillPicture(const uchar *Data, int Length);
744  virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
749  virtual bool Flush(int TimeoutMs = 0);
755  virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly = false);
765  virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly = false);
781  bool Replaying(void) const;
783  bool Transferring(void) const;
785  void StopReplay(void);
787  bool AttachPlayer(cPlayer *Player);
789  void Detach(cPlayer *Player);
791 
792 // Receiver facilities
793 
794 private:
797 public:
798  int Priority(void) const;
801 protected:
802  virtual bool OpenDvr(void);
805  virtual void CloseDvr(void);
807  virtual bool GetTSPacket(uchar *&Data);
814 public:
815  bool Receiving(bool Dummy = false) const;
817  bool AttachReceiver(cReceiver *Receiver);
819  void Detach(cReceiver *Receiver);
821  void DetachAll(int Pid);
823  virtual void DetachAllReceivers(void);
825  };
826 
834 
835 class cTSBuffer : public cThread {
836 private:
837  int f;
839  bool delivered;
841  virtual void Action(void);
842 public:
843  cTSBuffer(int File, int Size, int CardIndex);
844  virtual ~cTSBuffer();
845  uchar *Get(int *Available = NULL);
852  void Skip(int Count);
859  };
860 
861 #endif //__DEVICE_H
cEitFilter * eitFilter
Definition: device.h:388
static int nextCardIndex
Definition: device.h:174
cPatPmtParser patPmtParser
Definition: device.h:601
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
Definition: device.c:677
virtual eVideoSystem GetVideoSystem(void)
Returns the video system of the currently displayed material (default is PAL).
Definition: device.h:476
int cardIndex
Definition: device.h:838
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:652
bool Replaying(void) const
Returns true if we are currently replaying.
Definition: device.c:1217
unsigned char uchar
Definition: tools.h:30
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices - 1).
Definition: device.c:161
uchar * Get(int *Available=NULL)
Returns a pointer to the first TS packet in the buffer.
Definition: device.c:1796
cTsToPes tsToPesTeletext
Definition: device.h:605
int Number(void) const
Definition: channels.h:197
cNitFilter * nitFilter
Definition: device.h:391
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:845
Definition: device.h:71
cPlayer * player
Definition: device.h:600
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
Definition: device.c:891
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:682
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:381
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:657
bool Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
Definition: device.c:1582
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
Definition: device.c:992
cSdtFilter * sdtFilter
Definition: device.h:390
cRingBufferLinear * ringBuffer
Definition: device.h:840
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
Definition: device.c:1735
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:595
char description[32]
Definition: device.h:90
int f
Definition: device.h:837
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
Definition: device.c:1118
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
Definition: device.c:627
cReceiver * receiver[MAXRECEIVERS]
Definition: device.h:796
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:435
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
Definition: device.c:600
Definition: nit.h:19
void SetCamSlot(cCamSlot *CamSlot)
Sets the given CamSlot to be used with this device.
Definition: device.c:361
bool mute
Definition: device.h:568
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
Definition: device.c:180
#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:408
void Detach(cFilter *Filter)
Detaches the given filter from this device.
Definition: device.c:616
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
Definition: device.c:223
int cardIndex
Definition: device.h:175
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
Definition: device.c:525
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
Definition: device.c:1663
static int currentChannel
Definition: device.h:246
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:958
int volume
Definition: device.h:569
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
Definition: device.c:1139
bool autoSelectPreferredSubtitleLanguage
Definition: device.h:509
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:1595
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:442
eTrackType GetCurrentSubtitleTrack(void) const
Definition: device.h:546
virtual void Clear(void)
Clears all video and audio data from the device.
Definition: device.c:1132
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
Definition: device.c:1454
eTrackType
Definition: device.h:70
void DelLivePids(void)
Deletes the live viewing PIDs.
Definition: device.c:560
Definition: device.h:39
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
Definition: device.c:610
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
Definition: device.c:1002
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds. ...
Definition: device.h:711
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:431
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:1301
cTsToPes tsToPesSubtitle
Definition: device.h:604
eTrackType currentSubtitleTrack
Definition: device.h:505
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Definition: device.c:866
virtual void Mute(void)
Turns off audio while replaying.
Definition: device.c:1153
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:682
Definition: filter.h:41
cTSBuffer(int File, int Size, int CardIndex)
Definition: device.c:1756
Definition: osd.h:158
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
Definition: device.c:1012
static int NextCardIndex(int n=0)
Calculates the next card index.
Definition: device.c:149
static int CurrentVolume(void)
Definition: device.h:595
bool IsPrimaryDevice(void) const
Definition: device.h:204
virtual bool Ready(void)
Returns true if this device is ready.
Definition: device.c:1577
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:1091
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:436
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
Definition: device.c:1222
cDeviceHook(void)
Creates a new device hook object.
Definition: device.c:52
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
Definition: device.c:672
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:692
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
Definition: device.c:1146
int pre_1_3_19_PrivateStream
Definition: device.h:511
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
Definition: device.c:175
cPatFilter * patFilter
Definition: device.h:389
Definition: player.h:16
tTrackId availableTracks[ttMaxTrackTypes]
Definition: device.h:503
#define IDLEPRIORITY
Definition: config.h:43
virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const
Returns true if the given Device can provide the given Channel's transponder.
Definition: device.c:57
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
Definition: device.h:323
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
Definition: device.c:662
bool isPlayingVideo
Definition: device.h:606
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
Definition: device.c:568
time_t startScrambleDetection
Definition: device.h:423
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
Definition: device.c:875
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
Definition: device.c:579
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:920
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:507
Definition: osd.h:352
cDevice(void)
Definition: device.c:75
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
Definition: device.c:697
virtual bool IsPlayingVideo(void) const
Returns true if the currently attached player has delivered any video packets.
Definition: device.h:679
virtual ~cDevice()
Definition: device.c:117
cTsToPes tsToPesVideo
Definition: device.h:602
virtual void CloseDvr(void)
Shuts down the DVR.
Definition: device.c:1654
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
Definition: device.c:856
cTsToPes tsToPesAudio
Definition: device.h:603
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
Definition: device.c:851
cCamSlot * camSlot
Definition: device.h:424
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
Definition: device.c:935
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:861
bool delivered
Definition: device.h:839
Definition: ci.h:128
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:376
static cDevice * primaryDevice
Definition: device.h:116
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
Definition: device.c:1747
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:871
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
Definition: device.c:555
cSectionHandler * sectionHandler
Definition: device.h:387
int Occupied(void) const
Returns the number of seconds this device is still occupied for.
Definition: device.c:839
ePlayMode
Definition: device.h:39
eTrackType currentAudioTrack
Definition: device.h:504
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:127
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:1406
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:1824
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:703
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:638
#define MAXLANGCODE2
Definition: channels.h:42
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:220
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:1774
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
Definition: device.c:605
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:1649
virtual bool Flush(int TimeoutMs=0)
Returns true if the device's output buffers are empty, i.
Definition: device.c:1279
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:608
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
Definition: device.h:205
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
Definition: device.c:170
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:1564
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1435
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:336
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
Definition: device.c:1289
cMutex mutexReceiver
Definition: device.h:795
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
Definition: device.c:1484
Definition: pat.h:19
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
Definition: device.c:887
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:1058
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:1658
cLiveSubtitle * liveSubtitle
Definition: device.h:234
virtual ~cTSBuffer()
Definition: device.c:1768
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
Definition: device.c:748
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
Definition: device.c:188
void StopReplay(void)
Stops the current replay session (if any).
Definition: device.c:1265
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:987
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:908
static cList< cDeviceHook > deviceHooks
Definition: device.h:227
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:325
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:1274
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles...
Definition: device.c:1123
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:643
int currentAudioTrackMissingCount
Definition: device.h:508
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
Definition: device.c:687
Definition: thread.h:77
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
Definition: device.c:1227
time_t occupiedTimeout
Definition: device.h:244
static void Shutdown(void)
Closes down all devices.
Definition: device.c:367
cMutex mutexCurrentAudioTrack
Definition: device.h:506
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:560
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
Definition: device.c:1113
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:1128
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
Definition: device.c:452
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
Definition: device.c:622
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
Definition: device.c:205
Definition: device.h:36
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1470
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Definition: device.c:914
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
Definition: device.c:1294
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
Definition: device.c:830
#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:1030
ePidType
Definition: device.h:356
bool keepTracks
Definition: device.h:510
Definition: tools.h:357
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets ...
Definition: device.h:835
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
Definition: device.c:1158
Definition: device.h:61
cDvbSubtitleConverter * dvbSubtitleConverter
Definition: device.h:235
eTrackType GetCurrentAudioTrack(void) const
Definition: device.h:542
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
Definition: device.c:1284
cPidHandle pidHandles[MAXPIDHANDLES]
Definition: device.h:365
virtual void SetDigitalAudioDevice(bool On)
Tells the output device that the current audio track is Dolby Digital.
Definition: device.c:879
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
Definition: device.c:1007
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
Definition: device.c:143
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
Definition: device.c:356
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:461
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:667
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:428
Definition: tools.h:168
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
Definition: device.c:883
bool IsMute(void) const
Definition: device.h:583
static cDevice * device[MAXDEVICES]
Definition: device.h:115
uint16_t id
Definition: device.h:88