Go to the documentation of this file.
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
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
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)
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
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
188 virtual bool Ready(
void);
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;
352 #ifndef DEPRECATED_SETCURRENTCHANNEL
353 #define DEPRECATED_SETCURRENTCHANNEL 1
355 #if DEPRECATED_SETCURRENTCHANNEL
374 virtual bool HasLock(
int TimeoutMs = 0)
const;
388 virtual void Action(
void);
400 bool HasPid(
int Pid)
const;
440 virtual int ReadFilter(
int Handle,
void *Buffer,
size_t Length);
459 virtual bool HasCi(
void);
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);
508 virtual void GetVideoSize(
int &Width,
int &Height,
double &VideoAspect);
515 virtual void GetOsdSize(
int &Width,
int &Height,
double &PixelAspect);
619 void SetVolume(
int Volume,
bool Absolute =
false);
694 virtual int64_t
GetSTC(
void);
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);
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);
841 bool Receiving(
bool Dummy =
false)
const;
867 virtual void Action(
void);
869 cTSBuffer(
int File,
int Size,
int DeviceNumber);
871 uchar *
Get(
int *Available = NULL,
bool CheckAvailable =
false);
882 void Skip(
int Count);
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
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...
bool Replaying(void) const
Returns true if we are currently replaying.
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
virtual bool HasInternalCam(void)
Returns true if this device handles encrypted channels itself without VDR assistance.
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
virtual void CloseDvr(void)
Shuts down the DVR.
cSectionHandler * sectionHandler
cTSBuffer(int File, int Size, int DeviceNumber)
virtual void ScaleVideo(const cRect &Rect=cRect::Null)
Scales the currently shown video in such a way that it fits into the given Rect.
static bool WaitForAllDevicesReady(int Timeout=0)
Waits until all devices have become ready, or the given Timeout (seconds) has expired.
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
void SetKeepTracks(bool KeepTracks)
Controls whether the current audio and subtitle track settings shall be kept as they currently are,...
int currentAudioTrackMissingCount
virtual bool HasProgramme(void) const
Returns true if the device is currently showing any programme to the user, either through replaying o...
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
virtual bool GetTSPacket(uchar *&Data)
Gets exactly one TS packet from the DVR of this device and returns a pointer to it in Data.
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
@ pmExtern_THIS_SHOULD_BE_AVOIDED
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
virtual void SetDigitalAudioDevice(bool On)
Tells the output device that the current audio track is Dolby Digital.
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
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...
virtual bool OpenDvr(void)
Opens the DVR of this device and prepares it to deliver a Transport Stream for use in a cReceiver.
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
char language[MAXLANGCODE2]
cLiveSubtitle * liveSubtitle
int Priority(void) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY),...
eTrackType GetCurrentAudioTrack(void) const
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...
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
const cPatPmtParser * PatPmtParser(void) const
Returns a pointer to the patPmtParser, so that a derived device can use the stream information from i...
bool AddPid(int Pid, ePidType PidType=ptOther, int StreamType=0)
Adds a PID to the set of PIDs this device shall receive.
bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual=false)
Sets the current subtitle track to the given Type.
cDeviceHook(void)
Creates a new device hook object.
bool Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
cMutex mutexCurrentAudioTrack
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
static int NextCardIndex(int n=0)
Calculates the next card index.
virtual bool Flush(int TimeoutMs=0)
Returns true if the device's output buffers are empty, i.
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
eTrackType GetCurrentSubtitleTrack(void) const
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
static int CurrentVolume(void)
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
static cDevice * PrimaryDevice(void)
Returns the primary device.
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
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...
virtual void TrickSpeed(int Speed, bool Forward)
Sets the device into a mode where replay is done slower.
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
Sets the video display format to the given one (only useful if this device has an MPEG decoder).
void StopReplay(void)
Stops the current replay session (if any).
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
static void SetCurrentChannel(const cChannel *Channel)
uchar * Get(int *Available=NULL, bool CheckAvailable=false)
Returns a pointer to the first TS packet in the buffer.
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
cDvbSubtitleConverter * dvbSubtitleConverter
cRingBufferLinear * ringBuffer
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
void SetCamSlot(cCamSlot *CamSlot)
Sets the given CamSlot to be used with this device.
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
void Detach(cFilter *Filter)
Detaches the given filter from this device.
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
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.
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).
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
bool IsPrimaryDevice(void) const
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
eTrackType currentAudioTrack
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
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.
void Skip(int Count)
If after a call to Get() more or less than TS_SIZE of the available data has been processed,...
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
static bool UseDevice(int n)
Tells whether the device with the given card index shall be used in this instance of VDR.
virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const
Returns true if the given Device can provide the given Channel's transponder.
static void Shutdown(void)
Closes down all devices.
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect)
Returns the Width, Height and VideoAspect ratio of the currently displayed video material.
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
A steerable satellite dish generally points to the south on the northern hemisphere,...
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
void SetVolume(int Volume, bool Absolute=false)
Sets the volume to the given value, either absolutely or relative to the current volume.
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.
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
cCamSlot * CamSlot(void) const
Returns the CAM slot that is currently used with this device, or NULL if no CAM slot is in use.
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
cPidHandle pidHandles[MAXPIDHANDLES]
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
virtual bool IsPlayingVideo(void) const
Returns true if the currently attached player has delivered any video packets.
void DelLivePids(void)
Deletes the live viewing PIDs.
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...
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
void SetOccupied(int Seconds)
Sets the occupied timeout for this device to the given number of Seconds, This can be used to tune a ...
cMutex mutexCurrentSubtitleTrack
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
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 ...
const tTrackId * GetTrack(eTrackType Type)
Returns a pointer to the given track id, or NULL if Type is not less than ttMaxTrackTypes.
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
virtual void Mute(void)
Turns off audio while replaying.
static cDevice * primaryDevice
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
static int NumDevices(void)
Returns the total number of devices.
int GetAudioChannel(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
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.
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
cReceiver * receiver[MAXRECEIVERS]
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise.
virtual bool AvoidRecording(void) const
Returns true if this device should only be used for recording if no other device is available.
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets ...
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly=false)
Plays the single PES packet in Data with the given Length.
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
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...
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
virtual void Clear(void)
Clears all video and audio data from the device.
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
bool autoSelectPreferredSubtitleLanguage
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices - 1).
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
int Occupied(void) const
Returns the number of seconds this device is still occupied for.
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
virtual cSpuDecoder * GetSpuDecoder(void)
Returns a pointer to the device's SPU decoder (or NULL, if this device doesn't have an SPU decoder).
int pre_1_3_19_PrivateStream
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
virtual uchar * GrabImage(int &Size, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1)
Grabs the currently visible screen image.
virtual bool ProvidesChannel(const cChannel *Channel, int Priority=IDLEPRIORITY, bool *NeedsDetachReceivers=NULL) const
Returns true if this device can provide the given channel.
tTrackId availableTracks[ttMaxTrackTypes]
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask)
Opens a file handle for the given filter data.
static int currentChannel
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds.
static cList< cDeviceHook > deviceHooks
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
static cDevice * device[MAXDEVICES]
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly=false)
Plays all valid PES packets in Data with the given Length.
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
static void SetCurrentChannel(int ChannelNumber)
Sets the number of the current channel on the primary device, without actually switching to it.
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).
cPatPmtParser patPmtParser
eTrackType currentSubtitleTrack
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
virtual bool Ready(void)
Returns true if this device is ready.