2002-08-04 14:57:29 +02:00
|
|
|
/*
|
|
|
|
* dvbdevice.h: The DVB device interface
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2008-04-12 13:39:12 +02:00
|
|
|
* $Id: dvbdevice.h 2.1 2008/04/12 11:20:48 kls Exp $
|
2002-08-04 14:57:29 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DVBDEVICE_H
|
|
|
|
#define __DVBDEVICE_H
|
|
|
|
|
2002-08-10 14:58:25 +02:00
|
|
|
#include <linux/dvb/frontend.h>
|
2002-11-03 12:31:51 +01:00
|
|
|
#include <linux/dvb/version.h>
|
2002-08-04 14:57:29 +02:00
|
|
|
#include "device.h"
|
2002-09-08 14:17:51 +02:00
|
|
|
#include "dvbspu.h"
|
2002-08-04 14:57:29 +02:00
|
|
|
|
2008-04-12 13:39:12 +02:00
|
|
|
#if DVB_API_VERSION != 3 || DVB_API_VERSION_MINOR != 3
|
|
|
|
#error VDR requires Linux DVB driver API version 3.3!
|
2002-11-03 12:31:51 +01:00
|
|
|
#endif
|
|
|
|
|
2007-02-25 12:25:57 +01:00
|
|
|
#define MAXDVBDEVICES 8
|
2002-09-04 17:26:02 +02:00
|
|
|
|
2002-12-08 09:55:26 +01:00
|
|
|
class cDvbTuner;
|
|
|
|
|
2002-12-15 15:36:02 +01:00
|
|
|
/// The cDvbDevice implements a DVB device which can be accessed through the Linux DVB driver API.
|
|
|
|
|
2002-08-04 14:57:29 +02:00
|
|
|
class cDvbDevice : public cDevice {
|
|
|
|
private:
|
|
|
|
static bool Probe(const char *FileName);
|
2002-12-15 15:36:02 +01:00
|
|
|
///< Probes for existing DVB devices.
|
2002-08-04 14:57:29 +02:00
|
|
|
public:
|
|
|
|
static bool Initialize(void);
|
2002-12-15 15:36:02 +01:00
|
|
|
///< Initializes the DVB devices.
|
|
|
|
///< Must be called before accessing any DVB functions.
|
|
|
|
///< \return True if any devices are available.
|
2002-08-04 14:57:29 +02:00
|
|
|
private:
|
2008-04-12 13:39:12 +02:00
|
|
|
dvbfe_delsys frontendType;
|
|
|
|
int numProvidedSystems;
|
2007-01-07 14:46:14 +01:00
|
|
|
int fd_osd, fd_audio, fd_video, fd_dvr, fd_stc, fd_ca;
|
2002-08-04 14:57:29 +02:00
|
|
|
protected:
|
|
|
|
virtual void MakePrimaryDevice(bool On);
|
|
|
|
public:
|
|
|
|
cDvbDevice(int n);
|
|
|
|
virtual ~cDvbDevice();
|
2005-08-21 08:56:49 +02:00
|
|
|
virtual bool Ready(void);
|
2002-08-04 14:57:29 +02:00
|
|
|
virtual bool HasDecoder(void) const;
|
|
|
|
|
2007-01-07 14:46:14 +01:00
|
|
|
// Common Interface facilities:
|
|
|
|
|
|
|
|
private:
|
|
|
|
cCiAdapter *ciAdapter;
|
|
|
|
|
2004-05-16 10:35:36 +02:00
|
|
|
// SPU facilities
|
2002-08-25 09:36:09 +02:00
|
|
|
|
2002-09-08 14:17:51 +02:00
|
|
|
private:
|
|
|
|
cDvbSpuDecoder *spuDecoder;
|
2002-08-25 09:36:09 +02:00
|
|
|
public:
|
2002-09-08 14:17:51 +02:00
|
|
|
virtual cSpuDecoder *GetSpuDecoder(void);
|
2002-08-25 09:36:09 +02:00
|
|
|
|
2002-08-04 14:57:29 +02:00
|
|
|
// Channel facilities
|
|
|
|
|
|
|
|
private:
|
2002-12-08 09:55:26 +01:00
|
|
|
cDvbTuner *dvbTuner;
|
2004-11-07 10:31:59 +01:00
|
|
|
void TurnOffLiveMode(bool LiveView);
|
2002-08-04 14:57:29 +02:00
|
|
|
public:
|
2002-10-06 10:25:42 +02:00
|
|
|
virtual bool ProvidesSource(int Source) const;
|
2004-01-04 12:30:00 +01:00
|
|
|
virtual bool ProvidesTransponder(const cChannel *Channel) const;
|
2002-09-29 13:40:45 +02:00
|
|
|
virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const;
|
2008-04-12 13:39:12 +02:00
|
|
|
virtual int NumProvidedSystems(void) const;
|
2006-04-09 09:12:47 +02:00
|
|
|
virtual bool IsTunedToTransponder(const cChannel *Channel);
|
2002-09-04 17:26:02 +02:00
|
|
|
protected:
|
|
|
|
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
|
2004-01-04 12:30:00 +01:00
|
|
|
public:
|
2004-10-30 15:10:50 +02:00
|
|
|
virtual bool HasLock(int TimeoutMs = 0);
|
2002-08-04 14:57:29 +02:00
|
|
|
|
|
|
|
// PID handle facilities
|
|
|
|
|
2005-11-11 16:13:19 +01:00
|
|
|
private:
|
|
|
|
bool SetAudioBypass(bool On);
|
2002-08-04 14:57:29 +02:00
|
|
|
protected:
|
|
|
|
virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
|
|
|
|
|
2003-12-22 13:29:24 +01:00
|
|
|
// Section filter facilities
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
|
2007-10-14 13:11:23 +02:00
|
|
|
virtual void CloseFilter(int Handle);
|
2007-01-13 12:14:51 +01:00
|
|
|
|
|
|
|
// Common Interface facilities:
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual bool HasCi(void);
|
2003-12-22 13:29:24 +01:00
|
|
|
|
2002-08-04 14:57:29 +02:00
|
|
|
// Image Grab facilities
|
|
|
|
|
2003-10-04 12:42:58 +02:00
|
|
|
private:
|
|
|
|
static int devVideoOffset;
|
|
|
|
int devVideoIndex;
|
2002-08-04 14:57:29 +02:00
|
|
|
public:
|
2005-12-29 14:51:59 +01:00
|
|
|
virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
|
2002-08-04 14:57:29 +02:00
|
|
|
|
|
|
|
// Video format facilities
|
|
|
|
|
|
|
|
public:
|
2005-02-20 12:01:05 +01:00
|
|
|
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
|
2002-08-04 14:57:29 +02:00
|
|
|
virtual void SetVideoFormat(bool VideoFormat16_9);
|
2003-08-15 13:05:50 +02:00
|
|
|
virtual eVideoSystem GetVideoSystem(void);
|
2002-08-04 14:57:29 +02:00
|
|
|
|
2004-12-17 14:55:49 +01:00
|
|
|
// Track facilities
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void SetAudioTrackDevice(eTrackType Type);
|
|
|
|
|
2002-10-12 14:29:46 +02:00
|
|
|
// Audio facilities
|
2002-08-04 14:57:29 +02:00
|
|
|
|
2002-10-12 14:29:46 +02:00
|
|
|
private:
|
2004-12-17 14:55:49 +01:00
|
|
|
bool digitalAudio;
|
2006-05-20 10:17:44 +02:00
|
|
|
static int setTransferModeForDolbyDigital;
|
2002-08-04 14:57:29 +02:00
|
|
|
protected:
|
2005-01-06 13:50:17 +01:00
|
|
|
virtual int GetAudioChannelDevice(void);
|
|
|
|
virtual void SetAudioChannelDevice(int AudioChannel);
|
2002-08-04 14:57:29 +02:00
|
|
|
virtual void SetVolumeDevice(int Volume);
|
2004-12-17 14:55:49 +01:00
|
|
|
virtual void SetDigitalAudioDevice(bool On);
|
2005-02-13 14:26:37 +01:00
|
|
|
public:
|
2006-05-20 10:17:44 +02:00
|
|
|
static void SetTransferModeForDolbyDigital(int Mode);
|
|
|
|
///< Controls how the DVB device handles Transfer Mode when replaying
|
|
|
|
///< Dolby Digital audio.
|
|
|
|
///< 0 = don't set "audio bypass" in driver/firmware, don't force Transfer Mode
|
|
|
|
///< 1 = set "audio bypass" in driver/firmware, force Transfer Mode (default)
|
|
|
|
///< 2 = don't set "audio bypass" in driver/firmware, force Transfer Mode
|
2002-08-04 14:57:29 +02:00
|
|
|
|
|
|
|
// Player facilities
|
|
|
|
|
|
|
|
protected:
|
2002-08-15 11:16:34 +02:00
|
|
|
ePlayMode playMode;
|
2002-10-26 11:51:37 +02:00
|
|
|
virtual bool CanReplay(void) const;
|
2002-08-15 11:16:34 +02:00
|
|
|
virtual bool SetPlayMode(ePlayMode PlayMode);
|
2004-12-17 14:55:49 +01:00
|
|
|
virtual int PlayVideo(const uchar *Data, int Length);
|
2006-02-04 10:24:43 +01:00
|
|
|
virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
|
2002-08-04 14:57:29 +02:00
|
|
|
public:
|
2003-11-07 14:16:25 +01:00
|
|
|
virtual int64_t GetSTC(void);
|
2002-08-04 14:57:29 +02:00
|
|
|
virtual void TrickSpeed(int Speed);
|
|
|
|
virtual void Clear(void);
|
|
|
|
virtual void Play(void);
|
|
|
|
virtual void Freeze(void);
|
|
|
|
virtual void Mute(void);
|
|
|
|
virtual void StillPicture(const uchar *Data, int Length);
|
2002-08-16 09:22:29 +02:00
|
|
|
virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
|
2004-06-19 08:58:14 +02:00
|
|
|
virtual bool Flush(int TimeoutMs = 0);
|
2002-08-04 14:57:29 +02:00
|
|
|
|
|
|
|
// Receiver facilities
|
|
|
|
|
2002-09-08 09:03:10 +02:00
|
|
|
private:
|
|
|
|
cTSBuffer *tsBuffer;
|
2002-08-04 14:57:29 +02:00
|
|
|
protected:
|
|
|
|
virtual bool OpenDvr(void);
|
|
|
|
virtual void CloseDvr(void);
|
2002-09-08 09:03:10 +02:00
|
|
|
virtual bool GetTSPacket(uchar *&Data);
|
2002-08-04 14:57:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__DVBDEVICE_H
|