28 #define MAXDEVICES 16 // the maximum number of devices in the system
29 #define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
30 #define MAXRECEIVERS 16 // the maximum number of receivers per device
32 #define VOLUMEDELTA 5 // used to increase/decrease the volume
33 #define MAXOCCUPIEDTIMEOUT 99 // max. time (in seconds) a device may be occupied
78 #define IS_AUDIO_TRACK(t) (ttAudioFirst <= (t) && (t) <= ttAudioLast)
79 #define IS_DOLBY_TRACK(t) (ttDolbyFirst <= (t) && (t) <= ttDolbyLast)
80 #define IS_SUBTITLE_TRACK(t) (ttSubtitleFirst <= (t) && (t) <= ttSubtitleLast)
125 static bool UseDevice(
int n) {
return useDevice == 0 || (useDevice & (1 << n)) != 0; }
173 virtual bool Ready(
void);
327 virtual bool HasLock(
int TimeoutMs = 0)
const;
340 virtual void Action(
void);
349 cPidHandle(
void) { pid = streamType = used = 0; handle = -1; }
352 bool HasPid(
int Pid)
const;
392 virtual int ReadFilter(
int Handle,
void *Buffer,
size_t Length);
412 virtual bool HasCi(
void);
426 virtual uchar *
GrabImage(
int &Size,
bool Jpeg =
true,
int Quality = -1,
int SizeX = -1,
int SizeY = -1);
438 bool GrabImageFile(
const char *FileName,
bool Jpeg =
true,
int Quality = -1,
int SizeX = -1,
int SizeY = -1);
457 virtual void GetVideoSize(
int &Width,
int &Height,
double &VideoAspect);
464 virtual void GetOsdSize(
int &Width,
int &Height,
double &PixelAspect);
567 void SetVolume(
int Volume,
bool Absolute =
false);
639 virtual int64_t
GetSTC(
void);
695 virtual void Clear(
void);
699 virtual void Play(
void);
702 virtual void Freeze(
void);
704 virtual void Mute(
void);
714 virtual bool Poll(
cPoller &Poller,
int TimeoutMs = 0);
719 virtual bool Flush(
int TimeoutMs = 0);
725 virtual int PlayPes(
const uchar *Data,
int Length,
bool VideoOnly =
false);
735 virtual int PlayTs(
const uchar *Data,
int Length,
bool VideoOnly =
false);
785 bool Receiving(
bool Dummy =
false)
const;
843 virtual void Action(
void);
845 cTSBuffer(
int File,
int Size,
int CardIndex);
858 #define __DYNAMIC_DEVICE_PROBE
cPatPmtParser patPmtParser
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
static bool UseDevice(int n)
Tells whether the device with the given card index shall be used in this instance of VDR...
virtual bool ProvidesChannel(const cChannel *Channel, int Priority=IDLEPRIORITY, bool *NeedsDetachReceivers=NULL) const
Returns true if this device can provide the given channel.
bool Replaying(void) const
Returns true if we are currently replaying.
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices).
virtual eVideoSystem GetVideoSystem(void)
Returns the video system of the currently displayed material (default is PAL).
void SetOccupied(int Seconds)
Sets the occupied timeout for this device to the given number of Seconds, This can be used to tune a ...
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
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.
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 Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
int NumTracks(eTrackType FirstTrack, eTrackType LastTrack) const
Returns the number of tracks in the given range that are currently available.
cRingBufferLinear * ringBuffer
virtual void TrickSpeed(int Speed)
Sets the device into a mode where replay is done slower.
void DetachAll(int Pid)
Detaches all receivers from this device for this pid.
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask)
Opens a file handle for the given filter data.
static cList< cDynamicDeviceProbeItem > commandQueue
A list where all attach/detach commands are queued so they can be processed in the MainThreadHook of ...
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
cReceiver * receiver[MAXRECEIVERS]
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect)
Returns the Width, Height and VideoAspect ratio of the currently displayed video material.
virtual int ReadFilter(int Handle, void *Buffer, size_t Length)
Reads data from a handle for the given filter.
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.
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
Sets the video display format to the given one (only useful if this device has an MPEG decoder)...
void Detach(cFilter *Filter)
Detaches the given filter from this device.
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
cDevice(cDevice *ParentDevice=NULL)
void DelPid(int Pid, ePidType PidType=ptOther)
Deletes a PID from the set of PIDs this device shall receive.
bool AttachReceiver(cReceiver *Receiver)
Attaches the given receiver to this device.
static int currentChannel
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 void Play(void)
Sets the device into play mode (after a previous trick mode).
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
bool autoSelectPreferredSubtitleLanguage
static int NumDevices(void)
Returns the total number of devices.
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
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 ...
eTrackType GetCurrentSubtitleTrack(void) const
virtual void Clear(void)
Clears all video and audio data from the device.
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
void DelLivePids(void)
Deletes the live viewing PIDs.
void AttachFilter(cFilter *Filter)
Attaches the given filter to this device.
int NumAudioTracks(void) const
Returns the number of audio tracks that are currently available.
virtual bool HasIBPTrickSpeed(void)
Returns true if this device can handle all frames in 'fast forward' trick speeds. ...
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)...
cDynamicDeviceProbeItem(eDynamicDeviceProbeCommand Cmd, cString *DevPath)
virtual int PlayPesPacket(const uchar *Data, int Length, bool VideoOnly=false)
Plays the single PES packet in Data with the given Length.
eTrackType currentSubtitleTrack
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
virtual void Mute(void)
Turns off audio while replaying.
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...
cTSBuffer(int File, int Size, int CardIndex)
bool SetCurrentAudioTrack(eTrackType Type)
Sets the current audio track to the given Type.
static int NextCardIndex(int n=0)
Calculates the next card index.
static int CurrentVolume(void)
bool IsPrimaryDevice(void) const
virtual bool Ready(void)
Returns true if this device is ready.
void EnsureSubtitleTrack(void)
Makes sure one of the preferred language subtitle tracks is selected.
cCamSlot * CamSlot(void) const
Returns the CAM slot that is currently used with this device, or NULL if no CAM slot is in use...
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
cDeviceHook(void)
Creates a new device hook object.
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
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...
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
int pre_1_3_19_PrivateStream
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
tTrackId availableTracks[ttMaxTrackTypes]
virtual bool DeviceProvidesTransponder(const cDevice *Device, const cChannel *Channel) const
Returns true if the given Device can provide the given Channel's transponder.
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
time_t startScrambleDetection
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
void SetVolume(int Volume, bool Absolute=false)
Sets the volume to the given value, either absolutely or relative to the current volume.
virtual cSpuDecoder * GetSpuDecoder(void)
Returns a pointer to the device's SPU decoder (or NULL, if this device doesn't have an SPU decoder)...
cMutex mutexCurrentSubtitleTrack
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
virtual bool IsPlayingVideo(void) const
Returns true if the currently attached player has delivered any video packets.
virtual void CloseDvr(void)
Shuts down the DVR.
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
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...
void ClrAvailableTracks(bool DescriptionsOnly=false, bool IdsOnly=false)
Clears the list of currently available tracks.
virtual bool HasProgramme(void) const
Returns true if the device is currently showing any programme to the user, either through replaying o...
bool HasSubDevice(void) const
virtual uchar * GrabImage(int &Size, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1)
Grabs the currently visible screen image.
static cDevice * primaryDevice
friend class cDynamicDevice
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
cSectionHandler * sectionHandler
int Occupied(void) const
Returns the number of seconds this device is still occupied for.
eTrackType currentAudioTrack
static bool WaitForAllDevicesReady(int Timeout=0)
Waits until all devices have become ready, or the given Timeout (seconds) has expired.
virtual int PlayPes(const uchar *Data, int Length, bool VideoOnly=false)
Plays all valid PES packets in Data with the given Length.
virtual void ScaleVideo(const cRect &Rect=cRect::Null)
Scales the currently shown video in such a way that it fits into the given Rect.
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...
static cDevice * nextParentDevice
Holds the parent device for the next subdevice so the dynamite-plugin can work with unpatched plugins...
virtual bool AvoidRecording(void) const
Returns true if this device should only be used for recording if no other device is available...
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
virtual bool OpenDvr(void)
Opens the DVR of this device and prepares it to deliver a Transport Stream for use in a cReceiver...
virtual bool Flush(int TimeoutMs=0)
Returns true if the device's output buffers are empty, i.
const cPatPmtParser * PatPmtParser(void) const
Returns a pointer to the patPmtParser, so that a derived device can use the stream information from i...
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
int Priority(void) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY), or IDLEPRIORITY if no receiver is currently active.
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
virtual ~cDynamicDeviceProbeItem()
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 int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
virtual int PlayTs(const uchar *Data, int Length, bool VideoOnly=false)
Plays the given TS packet.
virtual void SetSubtitleTrackDevice(eTrackType Type)
Sets the current subtitle track to the given value.
virtual ~cDynamicDeviceProbe()
void EnsureAudioTrack(bool Force=false)
Makes sure an audio track is selected that is actually available.
static cDevice * PrimaryDevice(void)
Returns the primary 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...
cLiveSubtitle * liveSubtitle
friend class cDynamicDevice
eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (general setup).
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
void StopReplay(void)
Stops the current replay session (if any).
const tTrackId * GetTrack(eTrackType Type)
Returns a pointer to the given track id, or NULL if Type is not less than ttMaxTrackTypes.
bool IsSubDevice(void) const
int GetAudioChannel(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
static cList< cDeviceHook > deviceHooks
static void SetCurrentChannel(const cChannel *Channel)
Sets the number of the current channel on the primary device, without actually switching to it...
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 int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles...
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...
int currentAudioTrackMissingCount
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
bool AttachPlayer(cPlayer *Player)
Attaches the given player to this device.
static void QueueDynamicDeviceCommand(eDynamicDeviceProbeCommand Cmd, const char *DevPath)
Plugins which support cDynamicDeviceProbe must use this function to queue the devices they normally c...
static void Shutdown(void)
Closes down all devices.
cMutex mutexCurrentAudioTrack
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise...
void SetKeepTracks(bool KeepTracks)
Controls whether the current audio and subtitle track settings shall be kept as they currently are...
eDynamicDeviceProbeCommand cmd
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
char language[MAXLANGCODE2]
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
virtual int PlayTsSubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
eDynamicDeviceProbeCommand
cDevice * SubDevice(void) const
void SetAudioChannel(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
virtual int PlaySubtitle(const uchar *Data, int Length)
Plays the given data block as a subtitle.
void ForceTransferMode(void)
Forces the device into transfermode for the current channel.
bool SetCurrentSubtitleTrack(eTrackType Type, bool Manual=false)
Sets the current subtitle track to the given Type.
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets ...
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
cDvbSubtitleConverter * dvbSubtitleConverter
eTrackType GetCurrentAudioTrack(void) const
virtual int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
cPidHandle pidHandles[MAXPIDHANDLES]
virtual void SetDigitalAudioDevice(bool On)
Tells the actual device that digital audio output shall be switched on or off.
int NumSubtitleTracks(void) const
Returns the number of subtitle tracks that are currently available.
cDynamicDeviceProbe(void)
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
bool AddPid(int Pid, ePidType PidType=ptOther, int StreamType=0)
Adds a PID to the set of PIDs this device shall receive.
The cDevice class is the base from which actual devices can be derived.
virtual bool HasInternalCam(void)
Returns true if this device handles encrypted channels itself without VDR assistance.
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
static cDevice * device[MAXDEVICES]