vdr  2.4.0
dvbhdffdevice.h
Go to the documentation of this file.
1 /*
2  * dvbhdffdevice.h: The DVB HD Full Featured device interface
3  *
4  * See the README file for copyright information and how to reach the author.
5  */
6 
7 #ifndef __DVBHDFFDEVICE_H
8 #define __DVBHDFFDEVICE_H
9 
10 #include "hdffcmd.h"
11 #include <vdr/dvbdevice.h>
12 #include <vdr/dvbspu.h>
13 
15 
16 class cDvbHdFfDevice : public cDvbDevice {
17 private:
19  bool outputOnly;
20 protected:
21  virtual void MakePrimaryDevice(bool On);
22 public:
23  static bool Probe(int Adapter, int Frontend);
24  cDvbHdFfDevice(int Adapter, int Frontend, bool OutputOnly);
25  virtual ~cDvbHdFfDevice();
26  virtual bool HasDecoder(void) const;
27 
28 // SPU facilities
29 
30 private:
32 public:
33  virtual cSpuDecoder *GetSpuDecoder(void);
34 
35 // Channel facilities
36 
37 public:
38  virtual bool ProvidesSource(int Source) const;
39  virtual int NumProvidedSystems(void) const;
40 private:
41  void TurnOffLiveMode(bool LiveView);
42 protected:
43  virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
44 
45 // PID handle facilities
46 
47 protected:
48  virtual bool SetPid(cPidHandle *Handle, int Type, bool On);
49 
50 // Image Grab facilities
51 
52 public:
53  virtual uchar *GrabImage(int &Size, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
54 
55 // Video format facilities
56 
57 public:
58  virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
59  virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect);
60  virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect);
61 
62 // Track facilities
63 
64 protected:
65  virtual void SetAudioTrackDevice(eTrackType Type);
66 
67 // Audio facilities
68 
69 private:
71 protected:
72  virtual int GetAudioChannelDevice(void);
73  virtual void SetAudioChannelDevice(int AudioChannel);
74  virtual void SetVolumeDevice(int Volume);
75 
76 // Player facilities
77 
78 private:
82  bool freezed;
83  bool trickMode;
87 
88  // Pes2Ts conversion stuff
89  uint8_t videoCounter;
90  uint8_t audioCounter;
91  void BuildTsPacket(uint8_t * TsBuffer, bool PusiSet, uint16_t Pid, uint8_t Counter, const uint8_t * Data, uint32_t Length);
92  uint32_t PesToTs(uint8_t * TsBuffer, uint16_t Pid, uint8_t & Counter, const uint8_t * Data, uint32_t Length);
93 
94 protected:
96  virtual bool CanReplay(void) const;
97  virtual bool SetPlayMode(ePlayMode PlayMode);
98  virtual int PlayVideo(const uchar *Data, int Length);
99  virtual int PlayAudio(const uchar *Data, int Length, uchar Id);
100  virtual int PlayTsVideo(const uchar *Data, int Length);
101  virtual int PlayTsAudio(const uchar *Data, int Length);
102 public:
103  virtual int64_t GetSTC(void);
104  virtual cRect CanScaleVideo(const cRect &Rect, int Alignment = taCenter);
105  virtual void ScaleVideo(const cRect &Rect = cRect::Null);
106 #if (APIVERSNUM >= 20103)
107  virtual void TrickSpeed(int Speed, bool Forward);
108 #else
109  virtual void TrickSpeed(int Speed);
110 #endif
111  virtual void Clear(void);
112  virtual void Play(void);
113  virtual void Freeze(void);
114  virtual void Mute(void);
115  virtual void StillPicture(const uchar *Data, int Length);
116  virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
117  virtual bool Flush(int TimeoutMs = 0);
118 
119 // HDFF specific things
120 
121 public:
122  static HDFF::cHdffCmdIf *GetHdffCmdHandler(void);
123 private:
124  static int devHdffOffset;//TODO
125  bool isHdffPrimary;//TODO implicit!
127 };
128 
130 private:
132 public:
133  cDvbHdFfDeviceProbe(void);
134  virtual bool Probe(int Adapter, int Frontend);
135  void SetOutputOnly(bool On) { outputOnly = On; }
136  };
137 
138 #endif //__DVBHDFFDEVICE_H
virtual void MakePrimaryDevice(bool On)
Informs a device that it will be the primary device.
unsigned char uchar
Definition: tools.h:31
virtual int PlayTsVideo(const uchar *Data, int Length)
Plays the given data block as video.
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...
uint8_t videoCounter
Definition: dvbhdffdevice.h:89
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles...
virtual void StillPicture(const uchar *Data, int Length)
Displays the given I-frame as a still picture.
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
virtual void TrickSpeed(int Speed)
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 ...
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
virtual int GetAudioChannelDevice(void)
Gets the current audio channel, which is stereo (0), mono left (1) or mono right (2).
ePlayMode playMode
Definition: dvbhdffdevice.h:95
virtual void Clear(void)
Clears all video and audio data from the device.
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 int PlayVideo(const uchar *Data, int Length)
Plays the given data block as video.
eTrackType
Definition: device.h:63
int Adapter(void) const
Definition: dvbdevice.h:201
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
virtual void Play(void)
Sets the device into play mode (after a previous trick mode).
cDvbHdFfDevice(int Adapter, int Frontend, bool OutputOnly)
Definition: dvbhdffdevice.c:32
Definition: osd.h:158
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
Sets the video display format to the given one (only useful if this device has an MPEG decoder)...
uint32_t PesToTs(uint8_t *TsBuffer, uint16_t Pid, uint8_t &Counter, const uint8_t *Data, uint32_t Length)
HDFF::cHdffCmdIf * mHdffCmdIf
Definition: osd.h:352
void SetOutputOnly(bool On)
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
void BuildTsPacket(uint8_t *TsBuffer, bool PusiSet, uint16_t Pid, uint8_t Counter, const uint8_t *Data, uint32_t Length)
virtual ~cDvbHdFfDevice()
virtual bool SetPlayMode(ePlayMode PlayMode)
Sets the device into the given play mode.
eVideoDisplayFormat
Definition: device.h:58
virtual int PlayTsAudio(const uchar *Data, int Length)
Plays the given data block as audio.
virtual int PlayAudio(const uchar *Data, int Length, uchar Id)
Plays the given data block as audio.
ePlayMode
Definition: device.h:39
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect)
Returns the Width, Height and VideoAspect ratio of the currently displayed video material.
static const cRect Null
Definition: osd.h:357
virtual bool Flush(int TimeoutMs=0)
Returns true if the device&#39;s output buffers are empty, i.
bool supportsPcrInTransferMode
Definition: dvbhdffdevice.h:86
cDvbSpuDecoder * spuDecoder
Definition: dvbhdffdevice.h:31
virtual void SetAudioChannelDevice(int AudioChannel)
Sets the audio channel to stereo (0), mono left (1) or mono right (2).
The cDvbHdFfDevice implements a DVB device which can be accessed through the Linux DVB driver API...
Definition: dvbhdffdevice.h:16
int Frontend(void) const
Definition: dvbdevice.h:202
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
virtual uchar * GrabImage(int &Size, bool Jpeg=true, int Quality=-1, int SizeX=-1, int SizeY=-1)
Grabs the currently visible screen image.
The cDvbDevice implements a DVB device which can be accessed through the Linux DVB driver API...
Definition: dvbdevice.h:170
void TurnOffLiveMode(bool LiveView)
virtual void SetAudioTrackDevice(eTrackType Type)
Sets the current audio track to the given value.
virtual bool Probe(int Adapter, int Frontend)
Probes for a DVB device at the given Adapter and creates the appropriate object derived from cDvbDevi...
static HDFF::cHdffCmdIf * GetHdffCmdHandler(void)
static bool Probe(int Adapter, int Frontend)
virtual void SetVolumeDevice(int Volume)
Sets the audio volume on this device (Volume = 0...255).
static int devHdffOffset
virtual cSpuDecoder * GetSpuDecoder(void)
Returns a pointer to the device&#39;s SPU decoder (or NULL, if this device doesn&#39;t have an SPU decoder)...
Definition: tools.h:393
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
uint8_t audioCounter
Definition: dvbhdffdevice.h:90
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 void Mute(void)
Turns off audio while replaying.