vdr-plugin-softhddevice-drm-gles 1.6.2
cSoftHdDevice Class Reference

Output Device Implementation. More...

#include <softhddevice.h>

Public Member Functions

 cSoftHdDevice (cSoftHdConfig *)
 Create the device.
 
virtual ~cSoftHdDevice (void)
 Destroy the device.
 
virtual cString DeviceName (void) const
 
virtual bool HasDecoder (void) const
 Tells whether this device has an MPEG decoder.
 
virtual cSpuDecoderGetSpuDecoder (void)
 Get the device SPU decoder.
 
virtual bool CanReplay (void) const
 Return true if this device can currently start a replay session.
 
virtual bool SetPlayMode (ePlayMode)
 Sets the device into the given play mode.
 
virtual int PlayVideo (const uchar *, int)
 Play a video packet of the main videostream.
 
virtual int PlayAudio (const uchar *, int, uchar)
 Play an audio packet.
 
virtual int64_t GetSTC (void)
 Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
 
virtual cRect CanScaleVideo (const cRect &, int taCenter)
 Ask the output, if it can scale video.
 
virtual void ScaleVideo (const cRect &=cRect::Null)
 Scale the currently shown video.
 
virtual void TrickSpeed (int, bool)
 Sets the device into a mode where replay is done slower.
 
virtual void Clear (void)
 Clears all video and audio data from the device.
 
virtual void Play (void)
 Sets the device into play mode (after a previous trick mode, or pause)
 
virtual void Freeze (void)
 Puts the device into "freeze frame" mode.
 
virtual void StillPicture (const uchar *, int)
 Display the given I-frame as a still picture.
 
virtual bool Poll (cPoller &, int=0)
 Return true if the device itself or any of the file handles in poller is ready for further action.
 
virtual bool Flush (int=0)
 Flush the device output buffers.
 
virtual ucharGrabImage (int &, bool, int, int, int)
 Grabs the currently visible screen image.
 
virtual void SetVideoDisplayFormat (eVideoDisplayFormat)
 Sets the video display format.
 
virtual void SetVideoFormat (bool)
 Set the video format.
 
virtual void GetVideoSize (int &, int &, double &)
 Get the video size.
 
virtual void GetOsdSize (int &, int &, double &)
 Returns the width, height and aspect ratio the OSD.
 
virtual void SetAudioTrackDevice (eTrackType)
 
virtual int GetAudioChannelDevice (void)
 
virtual void SetAudioChannelDevice (int)
 
virtual void SetVolumeDevice (int)
 Sets the audio volume on this device (Volume = 0...255).
 
virtual void SetDigitalAudioDevice (bool)
 
const charCommandLineHelp (void)
 Return command line help string.
 
int ProcessArgs (int, char *[])
 Process the command line arguments.
 
int Start (void)
 Called by VDR when the plugin is started.
 
void Stop (void)
 Called by VDR when the plugin is stopped.
 
cSoftHdConfigConfig (void)
 
cVideoStreamVideoStream (void)
 
cVideoRenderRender (void)
 
cSoftHdAudioAudio (void)
 
void SetDisableDeint (void)
 Disables deinterlacer (called from setup menu or conf)
 
void SetDecoderNeedsIFrame (void)
 Forces the h264 decoder to wait for an I-Frame to start.
 
void SetParseH264Dimensions (void)
 Parse the h264 stream width and height before starting the decoder.
 
void SetDecoderFallbackToSw (bool)
 Force the decoder to fallback to software if the hardware decoder fails after the configured amount of packets were sent and no frame was received.
 
void SetEnableHdr (bool)
 Enable HDR display mode.
 
int MaxSizeGPUImageCache (void)
 Get the maximum GPU image cache size.
 
int OglOsdIsDisabled (void)
 Is the OpenGL/ES osd disabled?
 
void SetDisableOglOsd (void)
 Disables OpenGL/ES Osd (called from setup menu or conf)
 
void SetEnableOglOsd (void)
 Enables OpenGL/ES Osd.
 
void OsdClose (void)
 Close the OSD.
 
void OsdDrawARGB (int, int, int, int, int, const uint8_t *, int, int)
 Draw an OSD pixmap.
 
void SetScreenSize (int, int, double)
 Set the screen size.
 
int GetVideoAudioDelayMs (void)
 
int GetMinBufferFillLevelThresholdMs (void)
 
void SetPassthroughMask (int)
 Set the passthrough mask (called from setup menu or conf)
 
void ResetChannelId (void)
 Reset the channel ID (restarts audio)
 
void GetStats (int *, int *, int *)
 Get statistics from the renderer.
 
std::chrono::steady_clock::time_point GetChannelSwitchStartTime (void)
 
std::chrono::steady_clock::time_point GetChannelSwitchFirstPacketTime (void)
 
void SetAudioCodec (enum AVCodecID, AVCodecParameters *, AVRational)
 Open an audio codec.
 
void SetVideoCodec (enum AVCodecID, AVCodecParameters *, AVRational)
 Open a video codec.
 
int PlayAudioPkts (AVPacket *)
 Play an audio packet.
 
int PlayVideoPkts (AVPacket *)
 Play a video packet.
 
void Detach (void)
 Detach the device.
 
void Attach (void)
 Attach the device again.
 
bool IsDetached (void) const
 Returns true, if the device is detached.
 
void ResetOsdProvider (void)
 
bool IsOsdProviderSet (void) const
 
bool IsBufferingThresholdReached (void)
 Check if the buffering threshold has been reached.
 
bool IsVideoOnlyPlayback (void)
 
bool PipIsEnabled (void)
 Returns true, if pip is currently enabled.
 
void PipEnable (void)
 
void PipDisable (void)
 
void PipToggle (void)
 
void PipChannelChange (int)
 
void PipChannelSwap (bool)
 
void PipSwapPosition (void)
 
void PipSetSize (void)
 
void SetRenderPipSize (void)
 Wrapper functions for cVideoRender and cPipHandler.
 
void SetRenderPipActive (bool)
 
int PlayPipVideo (const uchar *, int)
 Play a video packet of the pip videostream.
 
void SetDrmCanDisplayPip (bool canDisplay)
 
bool UsePip (void)
 
void ResetPipStream (void)
 Resets pip stream and render pipeline.
 
void ToggleRenderPipPosition (void)
 

Protected Member Functions

virtual void MakePrimaryDevice (bool)
 Informs a device that it will be the primary device.
 
virtual void ChannelSwitch (const cDevice *, int, bool)
 Monitor a channel switch triggered by VDR (cStatus::ChannelSwitch())
 

Private Member Functions

int PlayVideoInternal (cVideoStream *, cReassemblyBufferVideo *, const uchar *, int, bool)
 Play a video packet.
 
void FlushAudio (void)
 Clear all audio data from the decoder and ringbuffer.
 
void OnEventReceived (const Event &)
 Event handler for playback state transitions.
 
void HandleStillPicture (const uchar *data, int size)
 The still picture data received from VDR can contain multiple PES packets.
 
int64_t GetFirstAudioPtsMsToPlay ()
 Calculate the first audio PTS that should be played during synchronized playback.
 
int64_t GetFirstVideoPtsMsToPlay ()
 
int GetBufferFillLevelThresholdMs ()
 Returns the buffer fill level threshold in milliseconds.
 
void SetState (State)
 Sets the device into the given state.
 
void OnEnteringState (State)
 Actions to be performed when entering a state.
 
void OnLeavingState (State)
 Actions to be performed when leaving a state.
 

Private Attributes

std::atomic< Statem_state = DETACHED
 current plugin state, normal plugin start sets detached state
 
std::mutex m_eventMutex
 mutex to protect event queue
 
bool m_needsMakePrimary = false
 
cDvbSpuDecoderm_pSpuDecoder
 pointer to spu decoder
 
cSoftHdConfigm_pConfig
 pointer to cSoftHdConfig object
 
cVideoRenderm_pRender
 pointer to cVideoRender object
 
cVideoStreamm_pVideoStream
 pointer to main video stream
 
cSoftHdAudiom_pAudio
 pointer to cSoftHdAudio object
 
cAudioDecoderm_pAudioDecoder = nullptr
 pointer to cAudioDecoder object
 
cSoftOsdProviderm_pOsdProvider = nullptr
 pointer to cSoftOsdProvider object
 
cReassemblyBufferVideo m_videoReassemblyBuffer
 video pes reassembly buffer
 
cReassemblyBufferAudio m_audioReassemblyBuffer
 audio pes reassembly buffer
 
cJitterTracker m_audioJitterTracker {"audio"}
 audio jitter tracker
 
cJitterTracker m_videoJitterTracker {"video"}
 video jitter tracker
 
std::chrono::steady_clock::time_point m_channelSwitchStartTime
 timestamp, when VDR triggered a channel switch
 
std::chrono::steady_clock::time_point m_dataReceivedTime
 timestamp, when the first audio or video data after a channel switch arrives in Play*()
 
std::atomic< PlaybackModem_playbackMode = NONE
 current playback mode
 
int m_audioChannelID = -1
 current audio channel ID
 
cSoftHdGrabm_pGrab
 pointer to grabber object
 
cVideoStreamm_pPipStream
 pointer to pip video stream
 
cReassemblyBufferVideo m_pipReassemblyBuffer
 pip pes reassembly buffer
 
cPipHandlerm_pPipHandler = nullptr
 pointer to pip handler
 
std::mutex m_mutex
 mutex to lock the state machine
 
std::mutex m_sizeMutex
 mutex to lock screen size (which is accessed by different threads)
 
std::atomic< boolm_receivedAudio = false
 flag if audio packets have been received
 
std::atomic< boolm_receivedVideo = false
 flag if video packets have been received
 
bool m_pipUseAlt
 use alternative pip position
 
bool m_drmCanDisplayPip = true
 true, if the drm device is able to display a pip video
 
bool m_disablePip = false
 true, if pip was disabled by the user
 
int m_volume = 0
 track the volume in the device (for attach)
 
int m_screenWidth
 
int m_screenHeight
 
double m_screenRefreshRateHz
 
bool m_forceDetached = false
 start the plugin in detached state
 

Static Private Attributes

static constexpr int MIN_BUFFER_FILL_LEVEL_THRESHOLD_MS = 450
 min buffering threshold in ms
 

Detailed Description

Output Device Implementation.

Definition at line 106 of file softhddevice.h.

Member Function Documentation

◆ Audio()

cSoftHdAudio * cSoftHdDevice::Audio ( void  )
inline

Definition at line 173 of file softhddevice.h.

References m_pAudio.

◆ Config()

cSoftHdConfig * cSoftHdDevice::Config ( void  )
inline

Definition at line 170 of file softhddevice.h.

References m_pConfig.

◆ DeviceName()

virtual cString cSoftHdDevice::DeviceName ( void  ) const
inlinevirtual

Definition at line 119 of file softhddevice.h.

◆ GetChannelSwitchFirstPacketTime()

std::chrono::steady_clock::time_point cSoftHdDevice::GetChannelSwitchFirstPacketTime ( void  )
inline

Definition at line 201 of file softhddevice.h.

References m_dataReceivedTime.

Referenced by cVideoRender::DisplayFrame().

◆ GetChannelSwitchStartTime()

std::chrono::steady_clock::time_point cSoftHdDevice::GetChannelSwitchStartTime ( void  )
inline

Definition at line 200 of file softhddevice.h.

References m_channelSwitchStartTime.

Referenced by cVideoRender::DisplayFrame().

◆ GetMinBufferFillLevelThresholdMs()

int cSoftHdDevice::GetMinBufferFillLevelThresholdMs ( void  )
inline

Definition at line 194 of file softhddevice.h.

References MIN_BUFFER_FILL_LEVEL_THRESHOLD_MS.

Referenced by cMenuSetupSoft::Create().

◆ GetVideoAudioDelayMs()

int cSoftHdDevice::GetVideoAudioDelayMs ( void  )
inline

◆ IsOsdProviderSet()

bool cSoftHdDevice::IsOsdProviderSet ( void  ) const
inline

Definition at line 214 of file softhddevice.h.

References m_pOsdProvider.

Referenced by cSoftOsdProvider::~cSoftOsdProvider().

◆ IsVideoOnlyPlayback()

bool cSoftHdDevice::IsVideoOnlyPlayback ( void  )
inline

Definition at line 217 of file softhddevice.h.

References m_playbackMode, and VIDEO_ONLY.

Referenced by cVideoRender::DisplayFrame().

◆ Render()

cVideoRender * cSoftHdDevice::Render ( void  )
inline

Definition at line 172 of file softhddevice.h.

References m_pRender.

◆ ResetOsdProvider()

void cSoftHdDevice::ResetOsdProvider ( void  )
inline

Definition at line 213 of file softhddevice.h.

References m_pOsdProvider.

Referenced by cSoftOsdProvider::~cSoftOsdProvider().

◆ SetDrmCanDisplayPip()

void cSoftHdDevice::SetDrmCanDisplayPip ( bool  canDisplay)
inline

Definition at line 233 of file softhddevice.h.

References m_drmCanDisplayPip.

Referenced by cVideoRender::Init().

◆ ToggleRenderPipPosition()

void cSoftHdDevice::ToggleRenderPipPosition ( void  )
inline

Definition at line 236 of file softhddevice.h.

References m_pipUseAlt.

Referenced by cPipHandler::HandleEvent().

◆ UsePip()

◆ VideoStream()

cVideoStream * cSoftHdDevice::VideoStream ( void  )
inline

Definition at line 171 of file softhddevice.h.

References m_pVideoStream.

Referenced by cVideoRender::DisplayFrame(), and cVideoRender::LogDroppedDuped().

Member Data Documentation

◆ m_audioChannelID

int cSoftHdDevice::m_audioChannelID = -1
private

current audio channel ID

Definition at line 259 of file softhddevice.h.

Referenced by PlayAudio(), and ResetChannelId().

◆ m_audioJitterTracker

cJitterTracker cSoftHdDevice::m_audioJitterTracker {"audio"}
private

audio jitter tracker

Definition at line 253 of file softhddevice.h.

Referenced by OnEnteringState(), and PlayAudio().

◆ m_audioReassemblyBuffer

cReassemblyBufferAudio cSoftHdDevice::m_audioReassemblyBuffer
private

audio pes reassembly buffer

Definition at line 252 of file softhddevice.h.

Referenced by FlushAudio(), and PlayAudio().

◆ m_channelSwitchStartTime

std::chrono::steady_clock::time_point cSoftHdDevice::m_channelSwitchStartTime
private

timestamp, when VDR triggered a channel switch

Definition at line 255 of file softhddevice.h.

Referenced by ChannelSwitch(), cSoftHdDevice(), GetChannelSwitchStartTime(), PlayAudio(), and PlayVideo().

◆ m_dataReceivedTime

std::chrono::steady_clock::time_point cSoftHdDevice::m_dataReceivedTime
private

timestamp, when the first audio or video data after a channel switch arrives in Play*()

Definition at line 256 of file softhddevice.h.

Referenced by cSoftHdDevice(), GetChannelSwitchFirstPacketTime(), PlayAudio(), and PlayVideo().

◆ m_disablePip

bool cSoftHdDevice::m_disablePip = false
private

true, if pip was disabled by the user

Definition at line 271 of file softhddevice.h.

Referenced by ProcessArgs(), and UsePip().

◆ m_drmCanDisplayPip

bool cSoftHdDevice::m_drmCanDisplayPip = true
private

true, if the drm device is able to display a pip video

Definition at line 270 of file softhddevice.h.

Referenced by SetDrmCanDisplayPip(), and UsePip().

◆ m_eventMutex

std::mutex cSoftHdDevice::m_eventMutex
private

mutex to protect event queue

Definition at line 242 of file softhddevice.h.

◆ m_forceDetached

bool cSoftHdDevice::m_forceDetached = false
private

start the plugin in detached state

Definition at line 278 of file softhddevice.h.

Referenced by Attach(), OnEventReceived(), and ProcessArgs().

◆ m_mutex

std::mutex cSoftHdDevice::m_mutex
mutableprivate

mutex to lock the state machine

Definition at line 265 of file softhddevice.h.

Referenced by IsDetached(), OnEventReceived(), and PipIsEnabled().

◆ m_needsMakePrimary

bool cSoftHdDevice::m_needsMakePrimary = false
private

Definition at line 243 of file softhddevice.h.

Referenced by Attach(), and Detach().

◆ m_pAudio

◆ m_pAudioDecoder

cAudioDecoder* cSoftHdDevice::m_pAudioDecoder = nullptr
private

◆ m_pConfig

◆ m_pGrab

cSoftHdGrab* cSoftHdDevice::m_pGrab
private

pointer to grabber object

Definition at line 260 of file softhddevice.h.

Referenced by GrabImage(), OnEnteringState(), and OnLeavingState().

◆ m_pipReassemblyBuffer

cReassemblyBufferVideo cSoftHdDevice::m_pipReassemblyBuffer
private

pip pes reassembly buffer

Definition at line 263 of file softhddevice.h.

Referenced by PlayPipVideo(), and ResetPipStream().

◆ m_pipUseAlt

bool cSoftHdDevice::m_pipUseAlt
private

use alternative pip position

Definition at line 269 of file softhddevice.h.

Referenced by SetRenderPipSize(), and ToggleRenderPipPosition().

◆ m_playbackMode

std::atomic<PlaybackMode> cSoftHdDevice::m_playbackMode = NONE
private

current playback mode

Definition at line 258 of file softhddevice.h.

Referenced by Clear(), GetSTC(), IsVideoOnlyPlayback(), OnEnteringState(), and OnEventReceived().

◆ m_pOsdProvider

cSoftOsdProvider* cSoftHdDevice::m_pOsdProvider = nullptr
private

◆ m_pPipHandler

cPipHandler* cSoftHdDevice::m_pPipHandler = nullptr
private

◆ m_pPipStream

cVideoStream* cSoftHdDevice::m_pPipStream
private

pointer to pip video stream

Definition at line 262 of file softhddevice.h.

Referenced by OnEnteringState(), OnLeavingState(), PlayPipVideo(), and ResetPipStream().

◆ m_pRender

◆ m_pSpuDecoder

cDvbSpuDecoder* cSoftHdDevice::m_pSpuDecoder
private

pointer to spu decoder

Definition at line 244 of file softhddevice.h.

Referenced by GetSpuDecoder(), and ~cSoftHdDevice().

◆ m_pVideoStream

◆ m_receivedAudio

std::atomic<bool> cSoftHdDevice::m_receivedAudio = false
private

flag if audio packets have been received

Definition at line 267 of file softhddevice.h.

Referenced by IsBufferingThresholdReached(), OnLeavingState(), PlayAudio(), and PlayVideo().

◆ m_receivedVideo

std::atomic<bool> cSoftHdDevice::m_receivedVideo = false
private

flag if video packets have been received

Definition at line 268 of file softhddevice.h.

Referenced by IsBufferingThresholdReached(), OnLeavingState(), PlayAudio(), and PlayVideo().

◆ m_screenHeight

int cSoftHdDevice::m_screenHeight
private

Definition at line 275 of file softhddevice.h.

Referenced by GetOsdSize(), and SetScreenSize().

◆ m_screenRefreshRateHz

double cSoftHdDevice::m_screenRefreshRateHz
private

Definition at line 276 of file softhddevice.h.

Referenced by SetScreenSize().

◆ m_screenWidth

int cSoftHdDevice::m_screenWidth
private

Definition at line 274 of file softhddevice.h.

Referenced by GetOsdSize(), and SetScreenSize().

◆ m_sizeMutex

std::mutex cSoftHdDevice::m_sizeMutex
private

mutex to lock screen size (which is accessed by different threads)

Definition at line 266 of file softhddevice.h.

Referenced by GetOsdSize(), and SetScreenSize().

◆ m_state

std::atomic<State> cSoftHdDevice::m_state = DETACHED
private

current plugin state, normal plugin start sets detached state

Definition at line 241 of file softhddevice.h.

Referenced by IsBufferingThresholdReached(), IsDetached(), OnEventReceived(), and SetState().

◆ m_videoJitterTracker

cJitterTracker cSoftHdDevice::m_videoJitterTracker {"video"}
private

video jitter tracker

Definition at line 254 of file softhddevice.h.

Referenced by OnEnteringState(), and PlayVideoInternal().

◆ m_videoReassemblyBuffer

cReassemblyBufferVideo cSoftHdDevice::m_videoReassemblyBuffer
private

video pes reassembly buffer

Definition at line 251 of file softhddevice.h.

Referenced by Clear(), HandleStillPicture(), OnEnteringState(), and PlayVideo().

◆ m_volume

int cSoftHdDevice::m_volume = 0
private

track the volume in the device (for attach)

Definition at line 272 of file softhddevice.h.

Referenced by OnEventReceived(), and SetVolumeDevice().

◆ MIN_BUFFER_FILL_LEVEL_THRESHOLD_MS

constexpr int cSoftHdDevice::MIN_BUFFER_FILL_LEVEL_THRESHOLD_MS = 450
staticconstexprprivate

min buffering threshold in ms

Definition at line 239 of file softhddevice.h.

Referenced by GetBufferFillLevelThresholdMs(), and GetMinBufferFillLevelThresholdMs().


The documentation for this class was generated from the following files: