1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00
vdr/dvbdevice.h

169 lines
4.7 KiB
C
Raw Normal View History

/*
* dvbdevice.h: The DVB device interface
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.h 2.8 2009/06/06 11:16:47 kls Exp $
*/
#ifndef __DVBDEVICE_H
#define __DVBDEVICE_H
#include <sys/mman.h> // FIXME: workaround for broken linux-dvb header files
2002-08-10 14:58:25 +02:00
#include <linux/dvb/frontend.h>
#include <linux/dvb/version.h>
#include "device.h"
2002-09-08 14:17:51 +02:00
#include "dvbspu.h"
#if DVB_API_VERSION != 5 || DVB_API_VERSION_MINOR != 0
#error VDR requires Linux DVB driver API version 5.0!
#endif
#define MAXDVBDEVICES 8
class cDvbTuner;
/// The cDvbDevice implements a DVB device which can be accessed through the Linux DVB driver API.
class cDvbDevice : public cDevice {
private:
static bool Probe(const char *FileName);
///< Probes for existing DVB devices.
public:
static bool Initialize(void);
///< Initializes the DVB devices.
///< Must be called before accessing any DVB functions.
///< \return True if any devices are available.
private:
dvb_frontend_info frontendInfo;
2008-04-12 13:39:12 +02:00
int numProvidedSystems;
fe_delivery_system frontendType;
int fd_osd, fd_audio, fd_video, fd_dvr, fd_stc, fd_ca;
protected:
virtual void MakePrimaryDevice(bool On);
public:
cDvbDevice(int n);
virtual ~cDvbDevice();
virtual bool Ready(void);
virtual bool HasDecoder(void) const;
// Common Interface facilities:
private:
cCiAdapter *ciAdapter;
2004-05-16 10:35:36 +02:00
// SPU facilities
2002-09-08 14:17:51 +02:00
private:
cDvbSpuDecoder *spuDecoder;
public:
2002-09-08 14:17:51 +02:00
virtual cSpuDecoder *GetSpuDecoder(void);
// Channel facilities
private:
cDvbTuner *dvbTuner;
void TurnOffLiveMode(bool LiveView);
public:
virtual bool ProvidesSource(int Source) const;
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;
virtual bool IsTunedToTransponder(const cChannel *Channel);
protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
public:
virtual bool HasLock(int TimeoutMs = 0);
// PID handle facilities
private:
bool SetAudioBypass(bool On);
protected:
virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
// Section filter facilities
protected:
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask);
virtual void CloseFilter(int Handle);
// Common Interface facilities:
public:
virtual bool HasCi(void);
// Image Grab facilities
private:
static int devVideoOffset;
int devVideoIndex;
public:
virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
// Video format facilities
public:
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
virtual void SetVideoFormat(bool VideoFormat16_9);
virtual eVideoSystem GetVideoSystem(void);
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
// Track facilities
protected:
virtual void SetAudioTrackDevice(eTrackType Type);
// Audio facilities
private:
bool digitalAudio;
static int setTransferModeForDolbyDigital;
protected:
virtual int GetAudioChannelDevice(void);
virtual void SetAudioChannelDevice(int AudioChannel);
virtual void SetVolumeDevice(int Volume);
virtual void SetDigitalAudioDevice(bool On);
public:
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
// Player facilities
protected:
ePlayMode playMode;
virtual bool CanReplay(void) const;
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 PlayTsVideo(const uchar *Data, int Length);
virtual int PlayTsAudio(const uchar *Data, int Length);
public:
2003-11-07 14:16:25 +01:00
virtual int64_t GetSTC(void);
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);
// Receiver facilities
2002-09-08 09:03:10 +02:00
private:
cTSBuffer *tsBuffer;
protected:
virtual bool OpenDvr(void);
virtual void CloseDvr(void);
2002-09-08 09:03:10 +02:00
virtual bool GetTSPacket(uchar *&Data);
};
#endif //__DVBDEVICE_H