|
SASC-NG
DVBSoftCAM
|
The cDevice class is the base from which actual devices can be derived. More...
#include <device.h>
Inheritance diagram for cDevice:Classes | |
| class | cPidHandle |
Public Types | |
| enum | ePidType { ptAudio, ptVideo, ptPcr, ptTeletext, ptDolby, ptOther } |
Public Member Functions | |
| bool | IsPrimaryDevice (void) const |
| int | CardIndex (void) const |
| Returns the card index of this device (0 ... MAXDEVICES - 1). | |
| int | DeviceNumber (void) const |
| Returns the number of this device (0 ... numDevices). | |
| virtual bool | HasDecoder (void) const |
| Tells whether this device has an MPEG decoder. | |
| virtual cSpuDecoder * | GetSpuDecoder (void) |
| virtual bool | ProvidesSource (int Source) const |
| Returns true if this device can provide the given source. | |
| virtual bool | ProvidesTransponder (const cChannel *Channel) const |
| virtual bool | ProvidesTransponderExclusively (const cChannel *Channel) const |
| virtual bool | ProvidesChannel (const cChannel *Channel, int Priority=-1, bool *NeedsDetachReceivers=NULL) const |
| virtual bool | IsTunedToTransponder (const cChannel *Channel) |
| virtual bool | MaySwitchTransponder (void) |
| bool | SwitchChannel (const cChannel *Channel, bool LiveView) |
| void | ForceTransferMode (void) |
| Forces the device into transfermode for the current channel. | |
| virtual bool | HasLock (int TimeoutMs=0) |
| virtual bool | HasProgramme (void) |
| bool | AddPid (int Pid, ePidType PidType=ptOther) |
| Adds a PID to the set of PIDs this device shall receive. | |
| virtual int | OpenFilter (u_short Pid, u_char Tid, u_char Mask) |
| virtual void | CloseFilter (int Handle) |
| void | AttachFilter (cFilter *Filter) |
| Attaches the given filter to this device. | |
| void | Detach (cFilter *Filter) |
| Detaches the given filter from this device. | |
| virtual bool | HasCi (void) |
| Returns true if this device has a Common Interface. | |
| void | SetCamSlot (cCamSlot *CamSlot) |
| Sets the given CamSlot to be used with this device. | |
| cCamSlot * | CamSlot (void) const |
| virtual uchar * | GrabImage (int &Size, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1) |
| bool | GrabImageFile (const char *FileName, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1) |
| virtual void | SetVideoDisplayFormat (eVideoDisplayFormat VideoDisplayFormat) |
| virtual void | SetVideoFormat (bool VideoFormat16_9) |
| virtual eVideoSystem | GetVideoSystem (void) |
| void | ClrAvailableTracks (bool DescriptionsOnly=false, bool IdsOnly=false) |
| bool | SetAvailableTrack (eTrackType Type, int Index, uint16_t Id, const char *Language=NULL, const char *Description=NULL) |
| const tTrackId * | GetTrack (eTrackType Type) |
| int | NumAudioTracks (void) const |
| eTrackType | GetCurrentAudioTrack (void) |
| bool | SetCurrentAudioTrack (eTrackType Type) |
| void | EnsureAudioTrack (bool Force=false) |
| bool | IsMute (void) const |
| bool | ToggleMute (void) |
| Turns the volume off or on and returns the new mute state. | |
| int | GetAudioChannel (void) |
| void | SetAudioChannel (int AudioChannel) |
| void | SetVolume (int Volume, bool Absolute=false) |
| virtual int64_t | GetSTC (void) |
| virtual void | TrickSpeed (int Speed) |
| virtual void | Clear (void) |
| virtual void | Play (void) |
| virtual void | Freeze (void) |
| Puts the device into "freeze frame" mode. | |
| virtual void | Mute (void) |
| virtual void | StillPicture (const uchar *Data, int Length) |
| Displays the given I-frame as a still picture. | |
| virtual bool | Poll (cPoller &Poller, int TimeoutMs=0) |
| virtual bool | Flush (int TimeoutMs=0) |
| virtual int | PlayPes (const uchar *Data, int Length, bool VideoOnly=false) |
| bool | Replaying (void) const |
| Returns true if we are currently replaying. | |
| bool | Transferring (void) const |
| Returns true if we are currently in Transfer Mode. | |
| void | StopReplay (void) |
| Stops the current replay session (if any). | |
| bool | AttachPlayer (cPlayer *Player) |
| Attaches the given player to this device. | |
| void | Detach (cPlayer *Player) |
| Detaches the given player from this device. | |
| int | Priority (void) const |
| bool | Receiving (bool CheckAny=false) const |
| Returns true if we are currently receiving. | |
| bool | AttachReceiver (cReceiver *Receiver) |
| Attaches the given receiver to this device. | |
| void | Detach (cReceiver *Receiver) |
| Detaches the given receiver from this device. | |
| void | DetachAll (int Pid) |
| Detaches all receivers from this device for this pid. | |
| void | DetachAllReceivers (void) |
| Detaches all receivers from this device. | |
Static Public Member Functions | |
| static int | NumDevices (void) |
| Returns the total number of devices. | |
| static bool | WaitForAllDevicesReady (int Timeout=0) |
| static void | SetUseDevice (int n) |
| static bool | UseDevice (int n) |
| static bool | SetPrimaryDevice (int n) |
| static cDevice * | PrimaryDevice (void) |
| Returns the primary device. | |
| static cDevice * | ActualDevice (void) |
| static cDevice * | GetDevice (int Index) |
| static cDevice * | GetDevice (const cChannel *Channel, int Priority, bool LiveView) |
| static void | Shutdown (void) |
| static bool | SwitchChannel (int Direction) |
| static int | CurrentChannel (void) |
| Returns the number of the current channel on the primary device. | |
| static void | SetCurrentChannel (const cChannel *Channel) |
| static int | CurrentVolume (void) |
Protected Member Functions | |
| cDevice (void) | |
| virtual | ~cDevice () |
| virtual bool | Ready (void) |
| virtual void | MakePrimaryDevice (bool On) |
| virtual bool | SetChannelDevice (const cChannel *Channel, bool LiveView) |
| Sets the device to the given channel (actual physical setup). | |
| bool | HasPid (int Pid) const |
| Returns true if this device is currently receiving the given PID. | |
| void | DelPid (int Pid, ePidType PidType=ptOther) |
| Deletes a PID from the set of PIDs this device shall receive. | |
| virtual bool | SetPid (cPidHandle *Handle, int Type, bool On) |
| void | StartSectionHandler (void) |
| virtual void | SetAudioTrackDevice (eTrackType Type) |
| Sets the current audio track to the given value. | |
| virtual int | GetAudioChannelDevice (void) |
| virtual void | SetAudioChannelDevice (int AudioChannel) |
| Sets the audio channel to stereo (0), mono left (1) or mono right (2). | |
| virtual void | SetVolumeDevice (int Volume) |
| Sets the audio volume on this device (Volume = 0...255). | |
| virtual void | SetDigitalAudioDevice (bool On) |
| virtual bool | CanReplay (void) const |
| Returns true if this device can currently start a replay session. | |
| virtual bool | SetPlayMode (ePlayMode PlayMode) |
| virtual int | PlayVideo (const uchar *Data, int Length) |
| virtual int | PlayAudio (const uchar *Data, int Length, uchar Id) |
| virtual int | PlayPesPacket (const uchar *Data, int Length, bool VideoOnly=false) |
| virtual bool | OpenDvr (void) |
| virtual void | CloseDvr (void) |
| Shuts down the DVR. | |
| virtual bool | GetTSPacket (uchar *&Data) |
Static Protected Member Functions | |
| static int | NextCardIndex (int n=0) |
Protected Attributes | |
| int | cardIndex |
| cPidHandle | pidHandles [MAXPIDHANDLES] |
Static Protected Attributes | |
| static int | currentChannel = 1 |
The cDevice class is the base from which actual devices can be derived.
| enum cDevice::ePidType |
| cDevice::cDevice | ( | void | ) | [protected] |
Definition at line 29 of file device.cpp.
References CardIndex(), cardIndex, esyslog, i, MAXDEVICES, MAXRECEIVERS, NULL, and cThread::SetDescription().
{
cardIndex = nextCardIndex++;
SetDescription("receiver on device %d", CardIndex() + 1);
mute = false;
sectionHandler = NULL;
eitFilter = NULL;
patFilter = NULL;
sdtFilter = NULL;
nitFilter = NULL;
player = NULL;
for (int i = 0; i < MAXRECEIVERS; i++)
receiver[i] = NULL;
if (numDevices < MAXDEVICES)
device[numDevices++] = this;
else
esyslog("ERROR: too many devices!");
}
| cDevice::~cDevice | ( | ) | [protected, virtual] |
Definition at line 54 of file device.cpp.
{
}
| cDevice * cDevice::ActualDevice | ( | void | ) | [static] |
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise.
Definition at line 114 of file device.cpp.
References NULL.
{
return NULL;
}
| bool cDevice::AddPid | ( | int | Pid, |
| ePidType | PidType = ptOther |
||
| ) |
Adds a PID to the set of PIDs this device shall receive.
Definition at line 175 of file device.cpp.
References esyslog, i, MAXPIDHANDLES, cDevice::cPidHandle::pid, pidHandles, PRINTPIDS, ptOther, ptPcr, ptTeletext, SetPid(), and cDevice::cPidHandle::used.
{
if (Pid || PidType == ptPcr) {
int n = -1;
int a = -1;
if (PidType != ptPcr) { // PPID always has to be explicit
for (int i = 0; i < MAXPIDHANDLES; i++) {
if (i != ptPcr) {
if (pidHandles[i].pid == Pid)
n = i;
else if (a < 0 && i >= ptOther && !pidHandles[i].used)
a = i;
}
}
}
if (n >= 0) {
// The Pid is already in use
if (++pidHandles[n].used == 2 && n <= ptTeletext) {
// It's a special PID that may have to be switched into "tap" mode
PRINTPIDS("A");
return SetPid(&pidHandles[n], n, true);
}
PRINTPIDS("a");
return true;
}
else if (PidType < ptOther) {
// The Pid is not yet in use and it is a special one
n = PidType;
}
else if (a >= 0) {
// The Pid is not yet in use and we have a free slot
n = a;
}
else
esyslog("ERROR: no free slot for PID %d", Pid);
if (n >= 0) {
pidHandles[n].pid = Pid;
pidHandles[n].used = 1;
PRINTPIDS("C");
return SetPid(&pidHandles[n], n, true);
}
}
return true;
}
| void cDevice::AttachFilter | ( | cFilter * | Filter | ) |
| bool cDevice::AttachPlayer | ( | cPlayer * | Player | ) |
Attaches the given player to this device.
Definition at line 419 of file device.cpp.
{
return false;
}
| bool cDevice::AttachReceiver | ( | cReceiver * | Receiver | ) |
Attaches the given receiver to this device.
Definition at line 495 of file device.cpp.
{
return false;
}
| cCamSlot* cDevice::CamSlot | ( | void | ) | const [inline] |
| bool cDevice::CanReplay | ( | void | ) | const [protected, virtual] |
Returns true if this device can currently start a replay session.
Reimplemented in cDvbDevice.
Definition at line 375 of file device.cpp.
References HasDecoder().
{
return HasDecoder();
}
| int cDevice::CardIndex | ( | void | ) | const [inline] |
Returns the card index of this device (0 ... MAXDEVICES - 1).
Definition at line 179 of file device.h.
References cardIndex.
Referenced by cDevice(), GetDevice(), cCam::ModuleStatus(), and cDvbDevice::OpenFilter().
| void cDevice::Clear | ( | void | ) | [virtual] |
Clears all video and audio data from the device. A derived class must call the base class function to make sure all registered cAudio objects are notified.
Reimplemented in cDvbDevice.
Definition at line 394 of file device.cpp.
Referenced by cPlayer::DeviceClear().
{
}
| void cDevice::CloseDvr | ( | void | ) | [protected, virtual] |
| void cDevice::CloseFilter | ( | int | Handle | ) | [virtual] |
Closes a file handle that has previously been opened by OpenFilter(). If this is as simple as calling close(Handle), a derived class need not implement this function, because this is done by the default implementation.
Reimplemented in cDvbDevice.
Definition at line 262 of file device.cpp.
Referenced by cPidFilter::Stop().
{
close(Handle);
}
| void cDevice::ClrAvailableTracks | ( | bool | DescriptionsOnly = false, |
| bool | IdsOnly = false |
||
| ) |
Clears the list of currently availabe tracks. If DescriptionsOnly is true, only the track descriptions will be cleared. With IdsOnly set to true only the ids will be cleared. IdsOnly is only taken into account if DescriptionsOnly is false.
Referenced by cPlayer::DeviceClrAvailableTracks().
| static int cDevice::CurrentChannel | ( | void | ) | [inline, static] |
Returns the number of the current channel on the primary device.
Definition at line 242 of file device.h.
References currentChannel.
| static int cDevice::CurrentVolume | ( | void | ) | [inline, static] |
| void cDevice::DelPid | ( | int | Pid, |
| ePidType | PidType = ptOther |
||
| ) | [protected] |
Deletes a PID from the set of PIDs this device shall receive.
Definition at line 220 of file device.cpp.
References cDevice::cPidHandle::handle, i, MAXPIDHANDLES, cDevice::cPidHandle::pid, pidHandles, PRINTPIDS, ptPcr, and SetPid().
{
if (Pid || PidType == ptPcr) {
int n = -1;
if (PidType == ptPcr)
n = PidType; // PPID always has to be explicit
else {
for (int i = 0; i < MAXPIDHANDLES; i++) {
if (pidHandles[i].pid == Pid) {
n = i;
break;
}
}
}
if (n >= 0 && pidHandles[n].used) {
PRINTPIDS("D");
if (--pidHandles[n].used < 2) {
SetPid(&pidHandles[n], n, false);
if (pidHandles[n].used == 0) {
pidHandles[n].handle = -1;
pidHandles[n].pid = 0;
}
}
PRINTPIDS("E");
}
}
}
| void cDevice::Detach | ( | cFilter * | Filter | ) |
| void cDevice::Detach | ( | cPlayer * | Player | ) |
| void cDevice::Detach | ( | cReceiver * | Receiver | ) |
| void cDevice::DetachAll | ( | int | Pid | ) |
Detaches all receivers from this device for this pid.
| void cDevice::DetachAllReceivers | ( | void | ) |
| int cDevice::DeviceNumber | ( | void | ) | const |
| void cDevice::EnsureAudioTrack | ( | bool | Force = false | ) |
Makes sure an audio track is selected that is actually available. If Force is true, the language and Dolby Digital settings will be verified even if the current audio track is available.
| bool cDevice::Flush | ( | int | TimeoutMs = 0 | ) | [virtual] |
Returns true if the device's output buffers are empty, i. e. any data which was bufferd so far has been processed. If TimeoutMs is not zero, the device will wait up to the given number of milliseconds before returning in case there is still data in the buffers..
Reimplemented in cDvbDevice.
Definition at line 437 of file device.cpp.
Referenced by cPlayer::DeviceFlush().
{
return true;
}
| void cDevice::ForceTransferMode | ( | void | ) |
Forces the device into transfermode for the current channel.
| void cDevice::Freeze | ( | void | ) | [virtual] |
Puts the device into "freeze frame" mode.
Reimplemented in cDvbDevice.
Definition at line 402 of file device.cpp.
Referenced by cPlayer::DeviceFreeze().
{
}
| int cDevice::GetAudioChannel | ( | void | ) |
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
| int cDevice::GetAudioChannelDevice | ( | void | ) | [protected, virtual] |
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
Reimplemented in cDvbDevice.
Definition at line 339 of file device.cpp.
{
return 0;
}
| eTrackType cDevice::GetCurrentAudioTrack | ( | void | ) | [inline] |
| cDevice * cDevice::GetDevice | ( | int | Index | ) | [static] |
Gets the device with the given Index.
| Index | must be in the range 0..numDevices-1. |
Definition at line 119 of file device.cpp.
References CardIndex(), i, and NULL.
Referenced by cScDevices::Shutdown(), and cScDevices::Startup().
Returns a device that is able to receive the given Channel at the given Priority, with the least impact on active recordings and live viewing. The LiveView parameter tells whether the device will be used for live viewing or a recording. If the Channel is encrypted, a CAM slot that claims to be able to decrypt the channel is automatically selected and assigned to the returned device. Whether or not this combination of device and CAM slot is actually able to decrypt the channel can only be determined by checking the "scrambling control" bits of the received TS packets. The Action() function automatically does this and takes care that after detaching any receivers because the channel can't be decrypted, this device/CAM combination will be skipped in the next call to GetDevice(). See also ProvidesChannel().
Definition at line 128 of file device.cpp.
References NULL.
{
return NULL;
}
| cSpuDecoder * cDevice::GetSpuDecoder | ( | void | ) | [virtual] |
Returns a pointer to the device's SPU decoder (or NULL, if this device doesn't have an SPU decoder).
Reimplemented in cDvbDevice.
Definition at line 109 of file device.cpp.
References NULL.
{
return NULL;
}
| int64_t cDevice::GetSTC | ( | void | ) | [virtual] |
Gets the current System Time Counter, which can be used to synchronize audio and video. If this device is unable to provide the STC, -1 will be returned.
Reimplemented in cDvbDevice.
Definition at line 385 of file device.cpp.
{
return -1;
}
| const tTrackId* cDevice::GetTrack | ( | eTrackType | Type | ) |
Returns a pointer to the given track id, or NULL if Type is not less than ttMaxTrackTypes.
| bool cDevice::GetTSPacket | ( | uchar *& | Data | ) | [protected, virtual] |
Gets exactly one TS packet from the DVR of this device and returns a pointer to it in Data. Only the first 188 bytes (TS_SIZE) Data points to are valid and may be accessed. If there is currently no new data available, Data will be set to NULL. The function returns false in case of a non recoverable error, otherwise it returns true, even if Data is NULL.
Reimplemented in cDvbDevice.
Definition at line 490 of file device.cpp.
{
return false;
}
| eVideoSystem cDevice::GetVideoSystem | ( | void | ) | [virtual] |
Returns the video system of the currently displayed material (default is PAL).
Reimplemented in cDvbDevice.
Definition at line 159 of file device.cpp.
References vsNTSC.
{
return vsNTSC;
}
| uchar * cDevice::GrabImage | ( | int & | Size, |
| bool | Jpeg = true, |
||
| int | Quality = -1, |
||
| int | SizeX = -1, |
||
| int | SizeY = -1 |
||
| ) | [virtual] |
Grabs the currently visible screen image.
| Size | The size of the returned data block. |
| Jpeg | If true will write a JPEG file. Otherwise a PNM file will be written. |
| Quality | The compression factor for JPEG. 1 will create a very blocky and small image, 70..80 will yield reasonable quality images while keeping the image file size around 50 KB for a full frame. The default will create a big but very high quality image. |
| SizeX | The number of horizontal pixels in the frame (default is the current screen width). |
| SizeY | The number of vertical pixels in the frame (default is the current screen height). |
Reimplemented in cDvbDevice.
Definition at line 146 of file device.cpp.
{
return false;
}
| bool cDevice::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.
| bool cDevice::HasCi | ( | void | ) | [virtual] |
Returns true if this device has a Common Interface.
Reimplemented in cDvbDevice.
Definition at line 133 of file device.cpp.
{
return false;
}
| bool cDevice::HasDecoder | ( | void | ) | const [virtual] |
Tells whether this device has an MPEG decoder.
Reimplemented in cDvbDevice.
Definition at line 104 of file device.cpp.
Referenced by CanReplay().
{
return false;
}
| bool cDevice::HasLock | ( | int | TimeoutMs = 0 | ) | [virtual] |
Returns true if the device has a lock on the requested transponder. Default is true, a specific device implementation may return false to indicate that it is not ready yet. If TimeoutMs is not zero, waits for the given number of milliseconds before returning false.
Reimplemented in cDvbDevice.
Definition at line 329 of file device.cpp.
{
return true;
}
| bool cDevice::HasPid | ( | int | Pid | ) | const [protected] |
Returns true if this device is currently receiving the given PID.
Definition at line 166 of file device.cpp.
References i, MAXPIDHANDLES, and pidHandles.
{
for (int i = 0; i < MAXPIDHANDLES; i++) {
if (pidHandles[i].pid == Pid)
return true;
}
return false;
}
| bool cDevice::HasProgramme | ( | void | ) | [virtual] |
Returns true if the device is currently showing any programme to the user, either through replaying or live.
Definition at line 334 of file device.cpp.
{
return false;
}
| bool cDevice::IsMute | ( | void | ) | const [inline] |
| bool cDevice::IsPrimaryDevice | ( | void | ) | const [inline] |
| bool cDevice::IsTunedToTransponder | ( | const cChannel * | Channel | ) | [virtual] |
Returns true if this device is currently tuned to the given Channel's transponder.
Reimplemented in cDvbDevice.
Definition at line 299 of file device.cpp.
{
return false;
}
| void cDevice::MakePrimaryDevice | ( | bool | On | ) | [protected, virtual] |
Informs a device that it will be the primary device. If there is anything the device needs to set up when it becomes the primary device (On = true) or to shut down when it no longer is the primary device (On = false), it should do so in this function.
Reimplemented in cDvbDevice.
Definition at line 85 of file device.cpp.
Referenced by SetPrimaryDevice().
{
}
| bool cDevice::MaySwitchTransponder | ( | void | ) | [virtual] |
Returns true if it is ok to switch the transponder on this device, without disturbing any other activities.
Definition at line 304 of file device.cpp.
References cDevice::cPidHandle::pid, pidHandles, ptAudio, ptDolby, ptVideo, and Receiving().
{
return !Receiving(true) && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid);
}
| void cDevice::Mute | ( | void | ) | [virtual] |
Turns off audio while replaying. A derived class must call the base class function to make sure all registered cAudio objects are notified.
Reimplemented in cDvbDevice.
Definition at line 406 of file device.cpp.
Referenced by cPlayer::DeviceMute().
{
}
| int cDevice::NextCardIndex | ( | int | n = 0 | ) | [static, protected] |
Calculates the next card index. Each device in a given machine must have a unique card index, which will be used to identify the device for assigning Ca parameters and deciding whether to actually use that device in this particular instance of VDR. Every time a new cDevice is created, it will be given the current nextCardIndex, and then nextCardIndex will be automatically incremented by 1. A derived class can determine whether a given device shall be used by checking UseDevice(NextCardIndex()). If a device is skipped, or if there are possible device indexes left after a derived class has set up all its devices, NextCardIndex(n) must be called, where n is the number of card indexes to skip.
Definition at line 64 of file device.cpp.
References esyslog, and MAXDEVICES.
Referenced by cScDevices::Initialize().
{
if (n > 0) {
nextCardIndex += n;
if (nextCardIndex >= MAXDEVICES)
esyslog("ERROR: nextCardIndex too big (%d)", nextCardIndex);
}
else if (n < 0)
esyslog("ERROR: illegal value in IncCardIndex(%d)", n);
return nextCardIndex;
}
| int cDevice::NumAudioTracks | ( | void | ) | const |
Returns the number of audio tracks that are currently available. This is just for information, to quickly find out whether there is more than one audio track.
Definition at line 369 of file device.cpp.
{
return 0;
}
| static int cDevice::NumDevices | ( | void | ) | [inline, static] |
Returns the total number of devices.
Definition at line 103 of file device.h.
Referenced by cScDevices::Initialize(), cScDevices::Shutdown(), and cScDevices::Startup().
| bool cDevice::OpenDvr | ( | void | ) | [protected, virtual] |
Opens the DVR of this device and prepares it to deliver a Transport Stream for use in a cReceiver.
Reimplemented in cDvbDevice.
Definition at line 481 of file device.cpp.
{
return false;
}
| int cDevice::OpenFilter | ( | u_short | Pid, |
| u_char | Tid, | ||
| u_char | Mask | ||
| ) | [virtual] |
Opens a file handle for the given filter data. A derived device that provides section data must implement this function.
Reimplemented in cDvbDevice.
Definition at line 257 of file device.cpp.
Referenced by cPidFilter::Start().
{
return -1;
}
| void cDevice::Play | ( | void | ) | [virtual] |
Sets the device into play mode (after a previous trick mode).
Reimplemented in cDvbDevice.
Definition at line 398 of file device.cpp.
Referenced by cPlayer::DevicePlay().
{
}
Plays the given data block as audio. Data points to exactly one complete PES packet of the given Length. Id indicates the type of audio data this packet holds. PlayAudio() shall process the packet either as a whole (returning Length) or not at all (returning 0 or -1 and setting 'errno' to EAGAIN).
Reimplemented in cDvbDevice.
Definition at line 447 of file device.cpp.
{
return -1;
}
| int cDevice::PlayPes | ( | const uchar * | Data, |
| int | Length, | ||
| bool | VideoOnly = false |
||
| ) | [virtual] |
Plays all valid PES packets in Data with the given Length. If Data is NULL any leftover data from a previous call will be discarded. If VideoOnly is true, only the video will be displayed, which is necessary for trick modes like 'fast forward'. Data should point to a sequence of complete PES packets. If the last packet in Data is not complete, it will be copied and combined to a complete packet with data from the next call to PlayPes(). That way any functions called from within PlayPes() will be guaranteed to always receive complete PES packets.
Definition at line 457 of file device.cpp.
{
return Length;
}
| int cDevice::PlayPesPacket | ( | const uchar * | Data, |
| int | Length, | ||
| bool | VideoOnly = false |
||
| ) | [protected, virtual] |
Plays the single PES packet in Data with the given Length. If VideoOnly is true, only the video will be displayed, which is necessary for trick modes like 'fast forward'. Data must point to one single, complete PES packet.
Definition at line 452 of file device.cpp.
{
return Length;
}
| int cDevice::PlayVideo | ( | const uchar * | Data, |
| int | Length | ||
| ) | [protected, virtual] |
Plays the given data block as video. Data points to exactly one complete PES packet of the given Length. PlayVideo() shall process the packet either as a whole (returning Length) or not at all (returning 0 or -1 and setting 'errno' to EAGAIN).
Reimplemented in cDvbDevice.
Definition at line 442 of file device.cpp.
{
return -1;
}
| bool cDevice::Poll | ( | cPoller & | Poller, |
| int | TimeoutMs = 0 |
||
| ) | [virtual] |
Returns true if the device itself or any of the file handles in Poller is ready for further action. If TimeoutMs is not zero, the device will wait up to the given number of milleseconds before returning in case it can't accept any data.
Reimplemented in cDvbDevice.
Definition at line 432 of file device.cpp.
Referenced by cPlayer::DevicePoll().
{
return false;
}
| static cDevice* cDevice::PrimaryDevice | ( | void | ) | [inline, static] |
| int cDevice::Priority | ( | void | ) | const |
Returns the priority of the current receiving session (0..MAXPRIORITY), or -1 if no receiver is currently active. The primary device will always return at least Setup.PrimaryLimit-1.
Definition at line 462 of file device.cpp.
{
return 0;
}
| bool cDevice::ProvidesChannel | ( | const cChannel * | Channel, |
| int | Priority = -1, |
||
| bool * | NeedsDetachReceivers = NULL |
||
| ) | const [virtual] |
Returns true if this device can provide the given channel. In case the device has cReceivers attached to it or it is the primary device, Priority is used to decide whether the caller's request can be honored. The special Priority value -1 will tell the caller whether this device is principally able to provide the given Channel, regardless of any attached cReceivers. If NeedsDetachReceivers is given, the resulting value in it will tell the caller whether or not it will have to detach any currently attached receivers from this device before calling SwitchChannel. Note that the return value in NeedsDetachReceivers is only meaningful if the function itself actually returns true. The default implementation always returns false, so a derived cDevice class that can provide channels must implement this function.
Reimplemented in cDvbDevice.
Definition at line 294 of file device.cpp.
{
return false;
}
| bool cDevice::ProvidesSource | ( | int | Source | ) | const [virtual] |
Returns true if this device can provide the given source.
Reimplemented in cDvbDevice.
Definition at line 275 of file device.cpp.
{
return false;
}
| bool cDevice::ProvidesTransponder | ( | const cChannel * | Channel | ) | const [virtual] |
Returns true if this device can provide the transponder of the given Channel (which implies that it can provide the Channel's source).
Reimplemented in cDvbDevice.
Definition at line 280 of file device.cpp.
Referenced by ProvidesTransponderExclusively().
{
return false;
}
| bool cDevice::ProvidesTransponderExclusively | ( | const cChannel * | Channel | ) | const [virtual] |
Returns true if this is the only device that is able to provide the given channel's transponder.
Definition at line 285 of file device.cpp.
References i, and ProvidesTransponder().
| bool cDevice::Ready | ( | void | ) | [protected, virtual] |
Returns true if this device is ready. Devices with conditional access hardware may need some time until they are up and running. This function is called in a loop at startup until all devices are ready (see WaitForAllDevicesReady()).
Reimplemented in cDvbDevice.
Definition at line 467 of file device.cpp.
{
return true;
}
| bool cDevice::Receiving | ( | bool | CheckAny = false | ) | const |
Returns true if we are currently receiving.
Definition at line 472 of file device.cpp.
Referenced by MaySwitchTransponder().
{
return false;
}
| bool cDevice::Replaying | ( | void | ) | const |
Returns true if we are currently replaying.
Definition at line 414 of file device.cpp.
References NULL.
{
return player != NULL;
}
| void cDevice::SetAudioChannel | ( | int | AudioChannel | ) |
Sets the audio channel to stereo (0), mono left (1) or mono right (2). Any other values will be silently ignored.
| void cDevice::SetAudioChannelDevice | ( | int | AudioChannel | ) | [protected, virtual] |
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
Reimplemented in cDvbDevice.
Definition at line 344 of file device.cpp.
{
}
| void cDevice::SetAudioTrackDevice | ( | eTrackType | Type | ) | [protected, virtual] |
Sets the current audio track to the given value.
Reimplemented in cDvbDevice.
Definition at line 356 of file device.cpp.
{
}
| bool cDevice::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. Type must be one of the basic eTrackType values, like ttAudio or ttDolby. Index tells which track of the given basic type is meant. If Id is 0 any existing id will be left untouched and only the given Language and Description will be set.
Referenced by cPlayer::DeviceSetAvailableTrack().
| void cDevice::SetCamSlot | ( | cCamSlot * | CamSlot | ) |
| bool cDevice::SetChannelDevice | ( | const cChannel * | Channel, |
| bool | LiveView | ||
| ) | [protected, virtual] |
Sets the device to the given channel (actual physical setup).
Reimplemented in cDvbDevice.
Definition at line 324 of file device.cpp.
{
return false;
}
| bool cDevice::SetCurrentAudioTrack | ( | eTrackType | Type | ) |
Sets the current audio track to the given Type.
Referenced by cPlayer::DeviceSetCurrentAudioTrack().
| static void cDevice::SetCurrentChannel | ( | const cChannel * | Channel | ) | [inline, static] |
Sets the number of the current channel on the primary device, without actually switching to it. This can be used to correct the current channel number while replaying.
Definition at line 244 of file device.h.
References currentChannel, and cChannel::Number().
| void cDevice::SetDigitalAudioDevice | ( | bool | On | ) | [protected, virtual] |
Tells the actual device that digital audio output shall be switched on or off.
Reimplemented in cDvbDevice.
Definition at line 352 of file device.cpp.
{
}
| bool cDevice::SetPid | ( | cPidHandle * | Handle, |
| int | Type, | ||
| bool | On | ||
| ) | [protected, virtual] |
Does the actual PID setting on this device. On indicates whether the PID shall be added or deleted. Handle->handle can be used by the device to store information it needs to receive this PID (for instance a file handle). Handle->used indicates how many receivers are using this PID. Type indicates some special types of PIDs, which the device may need to set in a specific way.
Reimplemented in cDvbDevice.
Definition at line 248 of file device.cpp.
Referenced by AddPid(), and DelPid().
{
return false;
}
| bool cDevice::SetPlayMode | ( | ePlayMode | PlayMode | ) | [protected, virtual] |
Sets the device into the given play mode.
Reimplemented in cDvbDevice.
Definition at line 380 of file device.cpp.
{
return false;
}
| bool cDevice::SetPrimaryDevice | ( | int | n | ) | [static] |
Sets the primary device to 'n'.
| n | must be in the range 1...numDevices. |
Definition at line 89 of file device.cpp.
References esyslog, isyslog, and MakePrimaryDevice().
{
n--;
if (0 <= n && n < numDevices && device[n]) {
isyslog("setting primary device to %d", n + 1);
if (primaryDevice)
primaryDevice->MakePrimaryDevice(false);
primaryDevice = device[n];
primaryDevice->MakePrimaryDevice(true);
return true;
}
esyslog("ERROR: invalid primary device number: %d", n + 1);
return false;
}
| void cDevice::SetUseDevice | ( | int | n | ) | [static] |
Sets the 'useDevice' flag of the given device. If this function is not called before initializing, all devices will be used.
Definition at line 58 of file device.cpp.
References MAXDEVICES.
{
if (n < MAXDEVICES)
useDevice |= (1 << n);
}
| void cDevice::SetVideoDisplayFormat | ( | eVideoDisplayFormat | VideoDisplayFormat | ) | [virtual] |
Sets the video display format to the given one (only useful if this device has an MPEG decoder). A derived class must first call the base class function!
Reimplemented in cDvbDevice.
Definition at line 151 of file device.cpp.
Referenced by cPlayer::DeviceSetVideoDisplayFormat().
{
}
| void cDevice::SetVideoFormat | ( | bool | VideoFormat16_9 | ) | [virtual] |
Sets the output video format to either 16:9 or 4:3 (only useful if this device has an MPEG decoder).
Reimplemented in cDvbDevice.
Definition at line 155 of file device.cpp.
{
}
| void cDevice::SetVolume | ( | int | Volume, |
| bool | Absolute = false |
||
| ) |
Sets the volume to the given value, either absolutely or relative to the current volume.
Definition at line 365 of file device.cpp.
{
}
| void cDevice::SetVolumeDevice | ( | int | Volume | ) | [protected, virtual] |
Sets the audio volume on this device (Volume = 0...255).
Reimplemented in cDvbDevice.
Definition at line 348 of file device.cpp.
{
}
| void cDevice::Shutdown | ( | void | ) | [static] |
Closes down all devices. Must be called at the end of the program.
Reimplemented in cScDevices.
Definition at line 142 of file device.cpp.
{
}
| void cDevice::StartSectionHandler | ( | void | ) | [protected] |
A derived device that provides section data must call this function to actually set up the section handler.
Definition at line 253 of file device.cpp.
{
}
| void cDevice::StillPicture | ( | const uchar * | Data, |
| int | Length | ||
| ) | [virtual] |
Displays the given I-frame as a still picture.
Reimplemented in cDvbDevice.
Definition at line 410 of file device.cpp.
Referenced by cPlayer::DeviceStillPicture().
{
}
| void cDevice::StopReplay | ( | void | ) |
| bool cDevice::SwitchChannel | ( | const cChannel * | Channel, |
| bool | LiveView | ||
| ) |
Switches the device to the given Channel, initiating transfer mode if necessary.
Definition at line 309 of file device.cpp.
{
return false;
}
| bool cDevice::SwitchChannel | ( | int | Direction | ) | [static] |
Switches the primary device to the next available channel in the given Direction (only the sign of Direction is evaluated, positive values switch to higher channel numbers).
Definition at line 314 of file device.cpp.
{
return false;
}
| bool cDevice::ToggleMute | ( | void | ) |
Turns the volume off or on and returns the new mute state.
Definition at line 360 of file device.cpp.
{
return true;
}
| bool cDevice::Transferring | ( | void | ) | const |
Returns true if we are currently in Transfer Mode.
| void cDevice::TrickSpeed | ( | int | Speed | ) | [virtual] |
Sets the device into a mode where replay is done slower. Every single frame shall then be displayed the given number of times.
Reimplemented in cDvbDevice.
Definition at line 390 of file device.cpp.
Referenced by cPlayer::DeviceTrickSpeed().
{
}
| static bool cDevice::UseDevice | ( | int | n | ) | [inline, static] |
Tells whether the device with the given card index shall be used in this instance of VDR.
Definition at line 115 of file device.h.
Referenced by cScDevices::Initialize().
| static bool cDevice::WaitForAllDevicesReady | ( | int | Timeout = 0 | ) | [static] |
Waits until all devices have become ready, or the given Timeout (seconds) has expired. While waiting, the Ready() function of each device is called in turn, until they all return true.
int cDevice::cardIndex [protected] |
Definition at line 152 of file device.h.
Referenced by CardIndex(), cDevice(), and cDvbDevice::cDvbDevice().
int cDevice::currentChannel = 1 [static, protected] |
Definition at line 196 of file device.h.
Referenced by CurrentChannel(), and SetCurrentChannel().
cPidHandle cDevice::pidHandles[MAXPIDHANDLES] [protected] |