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