vdr-plugin-softhddevice-drm-gles 1.4.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cVideoRender Class Reference

cVideoRender - Video render class More...

#include <videorender.h>

Collaboration diagram for cVideoRender:
Collaboration graph
[legend]

Public Member Functions

 cVideoRender (cSoftHdDevice *)
 cVideoRender constructor More...
 
virtual ~cVideoRender (void)
 cVideoRender destructor More...
 
void Init (void)
 Initialize the renderer. More...
 
void Exit (void)
 Exit and cleanup the renderer. More...
 
void SetVideoOutputPosition (const cRect &)
 Set size and position of the video on the screen. More...
 
void SetScreenSize (int, int, uint32_t)
 Wrapper to set the screen size in the device. More...
 
int64_t GetVideoClock (void)
 Wrapper to get the video clock (m_pts) More...
 
void GetStats (int *, int *, int *)
 Get some rendering statistics. More...
 
void ResetFrameCounter (void)
 Send start condition to video thread. More...
 
void Reset ()
 
void SetPlaybackPaused (bool pause)
 
void SetScheduleAudioResume (bool resume)
 
void ProcessEvents (void)
 Process queued events and forward to event receiver. More...
 
void ResetBufferReuseStrategy ()
 
void ResetDecodingStrategy ()
 
void OsdClear (void)
 Clear the OSD (draw an empty/ transparent OSD) More...
 
void OsdDrawARGB (int, int, int, int, int, const uint8_t *, int, int)
 Draw an OSD ARGB image. More...
 
void SetTrickSpeed (int, int)
 Set the trickspeed parameters. More...
 
int GetTrickSpeed (void)
 Get the current trickspeed. More...
 
int GetTrickForward (void)
 Get the current trickspeed direction. More...
 
int TriggerGrab (void)
 Trigger a screen grab. More...
 
void ConvertVideoBufToRgb (void)
 Convert the video drm buffer to an rgb image. More...
 
void ConvertOsdBufToRgb (void)
 Convert the osd drm buffer to an rgb image. More...
 
void ConvertPipBufToRgb (void)
 Convert the pip drm buffer to an rgb image. More...
 
void ClearGrab (void)
 Clear the grab drm buffers. More...
 
cSoftHdGrabGetGrab (int *, int *, int *, int *, int *, int)
 Get the grabbed image. More...
 
void ExitDisplayThread (void)
 Stop display thread. More...
 
void DisplayThreadHalt (void)
 
void DisplayThreadResume (void)
 
int DrmHandleEvent (void)
 Wrapper for drmHandleEvent() More...
 
bool DisplayFrame ()
 Display the frame (video and/or osd) More...
 
int GetFramesFilled (void)
 
void PushMainFrame (AVFrame *)
 
void PushPipFrame (AVFrame *)
 
int64_t GetOutputPtsMs (void)
 Get the output PTS in milliseconds. More...
 
void DisplayBlackFrame (void)
 
void ClearDecoderToDisplayQueue (void)
 Clear (empty) the decoder to display queue. More...
 
bool IsOutputBufferFull (void)
 Check, if the main render output buffer is full. More...
 
void SetDisplayOneFrameThenPause (bool pause)
 
void SchedulePlaybackStartAtPtsMs (int64_t ptsMs)
 
cQueue< cDrmBuffer > * GetMainOutputBuffer (void)
 
cQueue< cDrmBuffer > * GetPipOutputBuffer (void)
 
void SetPipActive (bool on)
 
bool IsPipActive (void)
 
void ClearPipDecoderToDisplayQueue (void)
 Clear (empty) the decoder to display queue. More...
 
void SetPipSize (bool)
 

Private Member Functions

int GetFrameFlags (AVFrame *)
 Get frame flags. More...
 
void SetFrameFlags (AVFrame *, int)
 Set frame flags. More...
 
void SetVideoClock (int64_t)
 Wrapper to set the video clock (m_pts) More...
 
bool PageFlip (cDrmBuffer *, cDrmBuffer *)
 Do the pageflip. More...
 
void SetVideoBuffer (cDrmBuffer *)
 Modesetting for video. More...
 
int SetOsdBuffer (drmModeAtomicReqPtr)
 Modesetting for osd. More...
 
void SetPipBuffer (cDrmBuffer *)
 Modesetting for pip. More...
 
int CommitBuffer (cDrmBuffer *, cDrmBuffer *)
 Commit the frame to the hardware. More...
 
void Grab (cDrmBuffer *, cDrmBuffer *)
 Grab video and osd. More...
 
void LogDroppedDuped (int64_t, int64_t, int)
 Log A/V sync debug message. More...
 
int64_t PtsToMs (int64_t)
 
void PushFrame (AVFrame *, bool, std::atomic< cBufferStrategy * > &, std::atomic< cDecodingStrategy * > &, cQueue< cDrmBuffer > *, cDrmBufferPool *)
 Push the frame into the render ringbuffer. More...
 

Private Attributes

cSoftHdDevicem_pDevice
 pointer to cSoftHdDevice More...
 
cSoftHdAudiom_pAudio
 pointer to cSoftHdAudio More...
 
cSoftHdConfigm_pConfig
 pointer to cSoftHdConfig More...
 
cDisplayThreadm_pDisplayThread
 pointer to display thread More...
 
cMutex m_trickspeedMutex
 mutex used while accessing trickspeed parameters More...
 
cMutex m_videoClockMutex
 mutex used around m_pts More...
 
std::vector< Eventm_eventQueue
 event queue for incoming events More...
 
cQueue< cDrmBufferm_drmBufferQueue {VIDEO_SURFACES_MAX}
 queue for DRM buffers to be displayed (VIDEO_SURFACES_MAX is defined in thread.h) More...
 
cQueue< cDrmBufferm_pipDrmBufferQueue {VIDEO_SURFACES_MAX}
 queue for PIP DRM buffers to be displayed (VIDEO_SURFACES_MAX is defined in thread.h) More...
 
int m_trickSpeed
 current trick speed More...
 
bool m_trickForward
 true, if trickspeed plays forward More...
 
int m_framePresentationCounter = 0
 number of times the current frame has to be shown (for slow motion) More...
 
int m_numWrongProgressive
 counter for progressive frames sent in an interlaced stream (only used for logging) More...
 
bool m_startgrab
 internal flag to trigger grabbing More...
 
cCondVar m_grabCond
 condition gets signalled, if renederer finished to clone the grabbed buffers More...
 
cSoftHdGrab m_grabOsd
 keeps the current grabbed osd More...
 
cSoftHdGrab m_grabVideo
 keeps the current grabbed video More...
 
cSoftHdGrab m_grabPip
 keeps the current grabbed pip video More...
 
cRect m_lastVideoGrab
 crtc rect of the last shown video frame More...
 
cRect m_lastPipGrab
 crtc rect of the last shown pip frame More...
 
int m_startCounter
 counter for displayed frames, indicates a video start More...
 
int m_framesDuped = 0
 number of frames duplicated More...
 
int m_framesDropped = 0
 number of frames dropped More...
 
bool m_lastFrameWasDropped = false
 true, if the last frame was dropped More...
 
AVRational m_timebase
 timebase used for pts, set by first RenderFrame() More...
 
cMutex m_timebaseMutex
 mutex used around m_timebase More...
 
int64_t m_pts = AV_NOPTS_VALUE
 current video PTS More...
 
cRect m_videoRect
 rect of the currently displayed video More...
 
bool m_videoIsScaled
 true, if the currently displayed video is scaled More...
 
int m_pipScalePercent
 scale factor for pip More...
 
int m_pipLeftPercent
 left margin for pip More...
 
int m_pipTopPercent
 top margin for pip More...
 
cDrmDevicem_pDrmDevice
 pointer cDrmDevice object More...
 
cDrmBufferm_pBufOsd
 pointer to osd drm buffer object More...
 
cDrmBuffer m_bufBlack
 black drm buffer object More...
 
cDrmBufferm_pCurrentlyDisplayed = nullptr
 pointer to currently displayed DRM buffer More...
 
cDrmBufferm_pCurrentlyPipDisplayed = nullptr
 pointer to currently displayed DRM buffer More...
 
bool m_osdShown
 set, if osd is shown currently More...
 
std::atomic< bool > m_videoPlaybackPaused = true
 set, if playback is frozen (used for pause) More...
 
std::atomic< bool > m_resumeAudioScheduled = false
 set, if audio resume is scheduled after a pause More...
 
std::atomic< bool > m_displayOneFrameThenPause = false
 set, if only one frame shall be displayed and then pause playback More...
 
std::atomic< int64_t > m_schedulePlaybackStartAtPtsMs = AV_NOPTS_VALUE
 if set, frames with PTS older than this will be dropped More...
 
IEventReceiverm_pEventReceiver
 pointer to event receiver More...
 
cDrmBufferPool m_drmBufferPool
 pool of drm buffers More...
 
cDrmBufferPool m_pipDrmBufferPool
 PIP pool of drm buffers. More...
 
std::atomic< cBufferStrategy * > m_bufferReuseStrategy = nullptr
 strategy to select drm buffers More...
 
std::atomic< cBufferStrategy * > m_pipBufferReuseStrategy = nullptr
 strategy to select drm buffers More...
 
std::atomic< cDecodingStrategy * > m_decodingStrategy = nullptr
 strategy for decoding setup More...
 
std::atomic< cDecodingStrategy * > m_pipDecodingStrategy = nullptr
 strategy for decoding setup More...
 
std::atomic< bool > m_pipActive = false
 true, if pip should be displayed More...
 

Detailed Description

cVideoRender - Video render class

Definition at line 121 of file videorender.h.

Constructor & Destructor Documentation

◆ cVideoRender()

cVideoRender::cVideoRender ( cSoftHdDevice device)

◆ ~cVideoRender()

cVideoRender::~cVideoRender ( void  )
virtual

cVideoRender destructor

Definition at line 111 of file videorender.cpp.

References L_DRM, LOGDEBUG2, m_pDisplayThread, and m_pDrmDevice.

Member Function Documentation

◆ ClearDecoderToDisplayQueue()

void cVideoRender::ClearDecoderToDisplayQueue ( void  )

◆ ClearGrab()

void cVideoRender::ClearGrab ( void  )

Clear the grab drm buffers.

Definition at line 1213 of file videorender.cpp.

References cSoftHdGrab::FreeBuf(), cSoftHdGrab::GetBuf(), m_grabOsd, m_grabPip, and m_grabVideo.

Referenced by cSoftHdDevice::GrabImage().

◆ ClearPipDecoderToDisplayQueue()

void cVideoRender::ClearPipDecoderToDisplayQueue ( void  )

Clear (empty) the decoder to display queue.

Definition at line 136 of file videorender.cpp.

References cQueue< T >::Clear(), cDrmBufferPool::DestroyAllExcept(), m_pCurrentlyPipDisplayed, m_pipDrmBufferPool, and m_pipDrmBufferQueue.

Referenced by cSoftHdDevice::DelPip().

◆ CommitBuffer()

int cVideoRender::CommitBuffer ( cDrmBuffer buf,
cDrmBuffer pip 
)
private

Commit the frame to the hardware.

Parameters
bufvideo drm buffer
Return values
0modesetting and commit was done, need to process outstanding DRM events
-1no modesetting and commit was done

Definition at line 376 of file videorender.cpp.

References cDrmPlane::ClearPlane(), cDrmPlane::DumpParameters(), cDrmDevice::Fd(), cDrmPlane::GetFbId(), Grab(), IsPipActive(), L_DRM, LOGDEBUG2, LOGERROR, m_osdShown, m_pCurrentlyDisplayed, m_pCurrentlyPipDisplayed, m_pDrmDevice, m_startgrab, cDrmDevice::OsdPlane(), cDrmDevice::PipPlane(), SetOsdBuffer(), SetPipBuffer(), cDrmPlane::SetPlane(), SetVideoBuffer(), and cDrmDevice::VideoPlane().

Referenced by PageFlip().

◆ ConvertOsdBufToRgb()

void cVideoRender::ConvertOsdBufToRgb ( void  )

◆ ConvertPipBufToRgb()

void cVideoRender::ConvertPipBufToRgb ( void  )

◆ ConvertVideoBufToRgb()

void cVideoRender::ConvertVideoBufToRgb ( void  )

◆ DisplayBlackFrame()

void cVideoRender::DisplayBlackFrame ( void  )

◆ DisplayFrame()

bool cVideoRender::DisplayFrame ( )

◆ DisplayThreadHalt()

void cVideoRender::DisplayThreadHalt ( void  )
inline

Definition at line 162 of file videorender.h.

References cDisplayThread::Halt(), and m_pDisplayThread.

Referenced by cSoftHdDevice::Clear(), and cSoftHdDevice::OnEventReceived().

◆ DisplayThreadResume()

void cVideoRender::DisplayThreadResume ( void  )
inline

◆ DrmHandleEvent()

int cVideoRender::DrmHandleEvent ( void  )

Wrapper for drmHandleEvent()

Definition at line 687 of file videorender.cpp.

References cDrmDevice::HandleEvent(), and m_pDrmDevice.

◆ Exit()

void cVideoRender::Exit ( void  )

◆ ExitDisplayThread()

void cVideoRender::ExitDisplayThread ( void  )

Stop display thread.

Definition at line 812 of file videorender.cpp.

References LOGDEBUG, m_pDisplayThread, Reset(), and cDisplayThread::Stop().

Referenced by Exit().

◆ GetFrameFlags()

int cVideoRender::GetFrameFlags ( AVFrame *  frame)
private

Get frame flags.

Parameters
frameAVFrame
Returns
FRAME_FLAG_TRICKSPEED or FRAME_FLAG_STILLPICTURE

Definition at line 497 of file videorender.cpp.

◆ GetFramesFilled()

int cVideoRender::GetFramesFilled ( void  )
inline

Definition at line 170 of file videorender.h.

References m_drmBufferQueue, and cQueue< T >::Size().

◆ GetGrab()

cSoftHdGrab * cVideoRender::GetGrab ( int *  size,
int *  width,
int *  height,
int *  x,
int *  y,
int  type 
)

Get the grabbed image.

Parameters
[out]sizereturns output size (memory)
[out]widthreturns output width
[out]heightreturns output height
[in]type0: video, 1: osd, 2: pip
Returns
the pointer to the cSoftHdGrab object

Definition at line 1233 of file videorender.cpp.

References cSoftHdGrab::GetData(), cSoftHdGrab::GetHeight(), cSoftHdGrab::GetSize(), cSoftHdGrab::GetWidth(), cSoftHdGrab::GetX(), cSoftHdGrab::GetY(), L_GRAB, LOGDEBUG2, LOGERROR, m_grabOsd, m_grabPip, and m_grabVideo.

Referenced by cSoftHdDevice::GrabImage().

◆ GetMainOutputBuffer()

cQueue< cDrmBuffer > * cVideoRender::GetMainOutputBuffer ( void  )
inline

Definition at line 179 of file videorender.h.

References m_drmBufferQueue.

Referenced by cSoftHdDevice::OnLeavingState().

◆ GetOutputPtsMs()

int64_t cVideoRender::GetOutputPtsMs ( void  )

Get the output PTS in milliseconds.

Returns the presentation timestamp of the next frame to be displayed.

Returns
PTS in milliseconds

Definition at line 991 of file videorender.cpp.

References AV_NOPTS_VALUE, m_pts, m_timebase, and m_timebaseMutex.

Referenced by cSoftHdDevice::GetFirstAudioPtsMsToPlay(), cSoftHdDevice::GetFirstVideoPtsMsToPlay(), cSoftHdDevice::IsBufferingThresholdReached(), and cSoftHdDevice::OnEventReceived().

◆ GetPipOutputBuffer()

cQueue< cDrmBuffer > * cVideoRender::GetPipOutputBuffer ( void  )
inline

Definition at line 180 of file videorender.h.

References m_pipDrmBufferQueue.

Referenced by cSoftHdDevice::OnLeavingState().

◆ GetStats()

void cVideoRender::GetStats ( int *  duped,
int *  dropped,
int *  counter 
)

Get some rendering statistics.

Parameters
[out]dupednumber of duplicated frames
[out]droppednumber of dropped frames
[out]counternumber of decoded frames

Definition at line 1275 of file videorender.cpp.

References m_framesDropped, m_framesDuped, and m_startCounter.

Referenced by cSoftHdDevice::GetStats().

◆ GetTrickForward()

int cVideoRender::GetTrickForward ( void  )

Get the current trickspeed direction.

Return values
1if forward trickspeed
0if backward trickspeed

Definition at line 1086 of file videorender.cpp.

References m_trickForward, and m_trickspeedMutex.

Referenced by cVideoStream::DecodeInput().

◆ GetTrickSpeed()

int cVideoRender::GetTrickSpeed ( void  )

Get the current trickspeed.

Returns
current trick speed value set with SetTrickSpeed()

Definition at line 1071 of file videorender.cpp.

References cVideoStream::IsInterlaced(), m_pDevice, m_trickSpeed, m_trickspeedMutex, and cSoftHdDevice::VideoStream().

Referenced by cVideoStream::DecodeInput(), DisplayFrame(), PushMainFrame(), and ResetFrameCounter().

◆ GetVideoClock()

int64_t cVideoRender::GetVideoClock ( void  )

Wrapper to get the video clock (m_pts)

Returns
the current pts

Definition at line 1020 of file videorender.cpp.

References m_pts, and m_videoClockMutex.

Referenced by cSoftHdDevice::GetSTC().

◆ Grab()

void cVideoRender::Grab ( cDrmBuffer buf,
cDrmBuffer pip 
)
private

Grab video and osd.

Parameters
bufvideo drm buffer if buf was (currently) set, it is used for the grab, otherwise the last displayed buffer is used (pause mode)

Definition at line 337 of file videorender.cpp.

References cDrmBuffer::Height(), L_GRAB, LOGDEBUG2, m_grabCond, m_grabOsd, m_grabPip, m_grabVideo, m_lastPipGrab, m_lastVideoGrab, m_osdShown, m_pBufOsd, m_pCurrentlyDisplayed, m_pCurrentlyPipDisplayed, cSoftHdGrab::SetBuf(), cSoftHdGrab::SetRect(), and cDrmBuffer::Width().

Referenced by CommitBuffer().

◆ Init()

void cVideoRender::Init ( void  )

◆ IsOutputBufferFull()

bool cVideoRender::IsOutputBufferFull ( void  )

Check, if the main render output buffer is full.

Return values
truerender output buffer is full

Definition at line 836 of file videorender.cpp.

References cQueue< T >::IsFull(), and m_drmBufferQueue.

Referenced by cSoftHdDevice::IsBufferingThresholdReached().

◆ IsPipActive()

bool cVideoRender::IsPipActive ( void  )
inline

Definition at line 195 of file videorender.h.

References m_pipActive.

Referenced by CommitBuffer().

◆ LogDroppedDuped()

void cVideoRender::LogDroppedDuped ( int64_t  audioPtsMs,
int64_t  videoPtsMs,
int  audioBehindVideoByMs 
)
private

Log A/V sync debug message.

Parameters
audioPtsMsaudio pts
videoPtsMsvideo pts
audioBehindVideoByMsaudio is behind video by this many ms

Definition at line 469 of file videorender.cpp.

References cVideoStream::GetAvPacketsFilled(), cSoftHdAudio::GetUsedBytes(), cSoftHdDevice::GetVideoAudioDelayMs(), L_AV_SYNC, LOGDEBUG2, m_drmBufferQueue, m_framesDropped, m_framesDuped, m_pAudio, m_pDevice, cQueue< T >::Size(), Timestamp2String(), and cSoftHdDevice::VideoStream().

Referenced by DisplayFrame().

◆ OsdClear()

void cVideoRender::OsdClear ( void  )

◆ OsdDrawARGB()

void cVideoRender::OsdDrawARGB ( int  xi,
int  yi,
int  width,
int  height,
int  pitch,
const uint8_t *  argb,
int  x,
int  y 
)

Draw an OSD ARGB image.

Parameters
xix-coordinate in argb image
yiy-coordinate in argb image
heightheight in pixel in argb image
widthwidth in pixel in argb image
pitchpitch of argb image
argb32bit ARGB image data
xx-coordinate on screen of argb image
yy-coordinate on screen of argb image

Definition at line 753 of file videorender.cpp.

References EGL_CHECK, cDrmBuffer::Height(), L_OPENGL, L_OSD, LOGDEBUG2, LOGERROR, m_osdShown, m_pBufOsd, m_pDrmDevice, cDrmBuffer::MarkDirty(), MIN, cDrmBuffer::Pitch(), cDrmBuffer::Plane(), and cDrmBuffer::Width().

Referenced by cSoftHdDevice::OsdDrawARGB().

◆ PageFlip()

bool cVideoRender::PageFlip ( cDrmBuffer buf,
cDrmBuffer pipBuf 
)
private

Do the pageflip.

Parameters
bufdrm buffer
pipBufdrm pip buffer
Returns
true if page flip was done

Definition at line 533 of file videorender.cpp.

References AV_NOPTS_VALUE, CommitBuffer(), cDrmBuffer::frame, cDrmDevice::HandleEvent(), cDrmBuffer::Id(), L_PACKET, LOGDEBUG2, LOGERROR, m_pDrmDevice, SetVideoClock(), and Timestamp2String().

Referenced by DisplayBlackFrame(), and DisplayFrame().

◆ ProcessEvents()

void cVideoRender::ProcessEvents ( void  )

Process queued events and forward to event receiver.

Definition at line 1461 of file videorender.cpp.

References m_eventQueue, m_pEventReceiver, and IEventReceiver::OnEventReceived().

Referenced by cDisplayThread::Action().

◆ PtsToMs()

int64_t cVideoRender::PtsToMs ( int64_t  pts)
private

Definition at line 675 of file videorender.cpp.

References m_timebase, and m_timebaseMutex.

Referenced by DisplayFrame().

◆ PushFrame()

void cVideoRender::PushFrame ( AVFrame *  frame,
bool  trickspeed,
std::atomic< cBufferStrategy * > &  bufferReuseStrategy,
std::atomic< cDecodingStrategy * > &  decodingStrategy,
cQueue< cDrmBuffer > *  drmBufferQueue,
cDrmBufferPool drmBufferPool 
)
private

Push the frame into the render ringbuffer.

Definition at line 942 of file videorender.cpp.

References AV_NOPTS_VALUE, cDrmDevice::Fd(), LOGFATAL, m_pDrmDevice, m_pts, and cQueue< T >::Push().

Referenced by PushMainFrame(), and PushPipFrame().

◆ PushMainFrame()

void cVideoRender::PushMainFrame ( AVFrame *  frame)

◆ PushPipFrame()

void cVideoRender::PushPipFrame ( AVFrame *  frame)

◆ Reset()

void cVideoRender::Reset ( void  )

◆ ResetBufferReuseStrategy()

void cVideoRender::ResetBufferReuseStrategy ( )
inline

◆ ResetDecodingStrategy()

void cVideoRender::ResetDecodingStrategy ( )
inline

Definition at line 141 of file videorender.h.

References m_decodingStrategy.

Referenced by cSoftHdDevice::OnEnteringState().

◆ ResetFrameCounter()

void cVideoRender::ResetFrameCounter ( void  )

Send start condition to video thread.

Definition at line 1032 of file videorender.cpp.

References GetTrickSpeed(), LOGDEBUG, and m_startCounter.

Referenced by cSoftHdDevice::OnEventReceived(), and cSoftHdDevice::OnLeavingState().

◆ SchedulePlaybackStartAtPtsMs()

void cVideoRender::SchedulePlaybackStartAtPtsMs ( int64_t  ptsMs)
inline

◆ SetDisplayOneFrameThenPause()

void cVideoRender::SetDisplayOneFrameThenPause ( bool  pause)
inline

Definition at line 177 of file videorender.h.

References m_displayOneFrameThenPause.

Referenced by cSoftHdDevice::Clear(), and cSoftHdDevice::OnLeavingState().

◆ SetFrameFlags()

void cVideoRender::SetFrameFlags ( AVFrame *  frame,
int  flags 
)
private

Set frame flags.

Parameters
frameAVFrame
flagsFRAME_FLAG_TRICKSPEED and/or FRAME_FLAG_STILLPICTURE

Definition at line 512 of file videorender.cpp.

References LOGFATAL.

◆ SetOsdBuffer()

int cVideoRender::SetOsdBuffer ( drmModeAtomicReqPtr  modeReq)
private

◆ SetPipActive()

void cVideoRender::SetPipActive ( bool  on)
inline

Definition at line 194 of file videorender.h.

References m_pipActive.

Referenced by cSoftHdDevice::SetEnablePip().

◆ SetPipBuffer()

void cVideoRender::SetPipBuffer ( cDrmBuffer buf)
private

◆ SetPipSize()

void cVideoRender::SetPipSize ( bool  useAlt)

◆ SetPlaybackPaused()

void cVideoRender::SetPlaybackPaused ( bool  pause)
inline

◆ SetScheduleAudioResume()

void cVideoRender::SetScheduleAudioResume ( bool  resume)
inline

Definition at line 137 of file videorender.h.

References m_resumeAudioScheduled.

Referenced by cSoftHdDevice::OnEventReceived().

◆ SetScreenSize()

void cVideoRender::SetScreenSize ( int  width,
int  height,
uint32_t  refreshRate 
)

Wrapper to set the screen size in the device.

Parameters
widthscreen width
heightscreen height
refreshRatescreen refresh rate

Definition at line 1293 of file videorender.cpp.

References m_pDevice, and cSoftHdDevice::SetScreenSize().

Referenced by cDrmDevice::Init().

◆ SetTrickSpeed()

void cVideoRender::SetTrickSpeed ( int  speed,
int  forward 
)

Set the trickspeed parameters.

Parameters
speedtrick speed value from VDR (0 = normal)
forward1 if forward trick speed, 0 if backward

Definition at line 1056 of file videorender.cpp.

References L_TRICK, LOGDEBUG2, m_framePresentationCounter, m_trickForward, m_trickSpeed, and m_trickspeedMutex.

Referenced by cSoftHdDevice::OnEventReceived(), and cSoftHdDevice::OnLeavingState().

◆ SetVideoBuffer()

void cVideoRender::SetVideoBuffer ( cDrmBuffer buf)
private

◆ SetVideoClock()

void cVideoRender::SetVideoClock ( int64_t  pts)
private

Wrapper to set the video clock (m_pts)

Parameters
ptsthe pts to be set

Definition at line 1008 of file videorender.cpp.

References m_pts, and m_videoClockMutex.

Referenced by PageFlip().

◆ SetVideoOutputPosition()

void cVideoRender::SetVideoOutputPosition ( const cRect &  rect)

Set size and position of the video on the screen.

Parameters
recta cRect, where the video should be rendered in

Definition at line 1446 of file videorender.cpp.

References LOGDEBUG, m_videoIsScaled, and m_videoRect.

Referenced by cSoftHdDevice::ScaleVideo().

◆ TriggerGrab()

int cVideoRender::TriggerGrab ( void  )

Trigger a screen grab.

Return values
0on success, grab was triggered
1on timeout, grab was not triggered

Definition at line 1105 of file videorender.cpp.

References LOGWARNING, m_grabCond, and m_startgrab.

Referenced by cSoftHdDevice::GrabImage().

Member Data Documentation

◆ m_bufBlack

cDrmBuffer cVideoRender::m_bufBlack
private

black drm buffer object

Definition at line 240 of file videorender.h.

Referenced by DisplayBlackFrame(), DisplayFrame(), Exit(), and Init().

◆ m_bufferReuseStrategy

std::atomic<cBufferStrategy *> cVideoRender::m_bufferReuseStrategy = nullptr
private

strategy to select drm buffers

Definition at line 252 of file videorender.h.

Referenced by PushMainFrame(), and ResetBufferReuseStrategy().

◆ m_decodingStrategy

std::atomic<cDecodingStrategy *> cVideoRender::m_decodingStrategy = nullptr
private

strategy for decoding setup

Definition at line 254 of file videorender.h.

Referenced by PushMainFrame(), Reset(), and ResetDecodingStrategy().

◆ m_displayOneFrameThenPause

std::atomic<bool> cVideoRender::m_displayOneFrameThenPause = false
private

set, if only one frame shall be displayed and then pause playback

Definition at line 246 of file videorender.h.

Referenced by DisplayFrame(), and SetDisplayOneFrameThenPause().

◆ m_drmBufferPool

cDrmBufferPool cVideoRender::m_drmBufferPool
private

pool of drm buffers

Definition at line 250 of file videorender.h.

Referenced by ClearDecoderToDisplayQueue(), and PushMainFrame().

◆ m_drmBufferQueue

cQueue<cDrmBuffer> cVideoRender::m_drmBufferQueue {VIDEO_SURFACES_MAX}
private

queue for DRM buffers to be displayed (VIDEO_SURFACES_MAX is defined in thread.h)

Definition at line 208 of file videorender.h.

Referenced by ClearDecoderToDisplayQueue(), DisplayFrame(), GetFramesFilled(), GetMainOutputBuffer(), IsOutputBufferFull(), LogDroppedDuped(), and PushMainFrame().

◆ m_eventQueue

std::vector<Event> cVideoRender::m_eventQueue
private

event queue for incoming events

Definition at line 206 of file videorender.h.

Referenced by DisplayFrame(), and ProcessEvents().

◆ m_framePresentationCounter

int cVideoRender::m_framePresentationCounter = 0
private

number of times the current frame has to be shown (for slow motion)

Definition at line 212 of file videorender.h.

Referenced by DisplayFrame(), and SetTrickSpeed().

◆ m_framesDropped

int cVideoRender::m_framesDropped = 0
private

number of frames dropped

Definition at line 226 of file videorender.h.

Referenced by GetStats(), LogDroppedDuped(), and Reset().

◆ m_framesDuped

int cVideoRender::m_framesDuped = 0
private

number of frames duplicated

Definition at line 225 of file videorender.h.

Referenced by GetStats(), LogDroppedDuped(), and Reset().

◆ m_grabCond

cCondVar cVideoRender::m_grabCond
private

condition gets signalled, if renederer finished to clone the grabbed buffers

Definition at line 217 of file videorender.h.

Referenced by Grab(), and TriggerGrab().

◆ m_grabOsd

cSoftHdGrab cVideoRender::m_grabOsd
private

keeps the current grabbed osd

Definition at line 218 of file videorender.h.

Referenced by ClearGrab(), ConvertOsdBufToRgb(), GetGrab(), and Grab().

◆ m_grabPip

cSoftHdGrab cVideoRender::m_grabPip
private

keeps the current grabbed pip video

Definition at line 220 of file videorender.h.

Referenced by ClearGrab(), ConvertPipBufToRgb(), GetGrab(), and Grab().

◆ m_grabVideo

cSoftHdGrab cVideoRender::m_grabVideo
private

keeps the current grabbed video

Definition at line 219 of file videorender.h.

Referenced by ClearGrab(), ConvertVideoBufToRgb(), GetGrab(), and Grab().

◆ m_lastFrameWasDropped

bool cVideoRender::m_lastFrameWasDropped = false
private

true, if the last frame was dropped

Definition at line 227 of file videorender.h.

Referenced by DisplayFrame().

◆ m_lastPipGrab

cRect cVideoRender::m_lastPipGrab
private

crtc rect of the last shown pip frame

Definition at line 222 of file videorender.h.

Referenced by Grab(), and SetPipBuffer().

◆ m_lastVideoGrab

cRect cVideoRender::m_lastVideoGrab
private

crtc rect of the last shown video frame

Definition at line 221 of file videorender.h.

Referenced by Grab(), and SetVideoBuffer().

◆ m_numWrongProgressive

int cVideoRender::m_numWrongProgressive
private

counter for progressive frames sent in an interlaced stream (only used for logging)

Definition at line 213 of file videorender.h.

Referenced by Reset().

◆ m_osdShown

bool cVideoRender::m_osdShown
private

set, if osd is shown currently

Definition at line 243 of file videorender.h.

Referenced by CommitBuffer(), Grab(), Init(), OsdClear(), OsdDrawARGB(), and SetOsdBuffer().

◆ m_pAudio

cSoftHdAudio* cVideoRender::m_pAudio
private

pointer to cSoftHdAudio

Definition at line 201 of file videorender.h.

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

◆ m_pBufOsd

cDrmBuffer* cVideoRender::m_pBufOsd
private

pointer to osd drm buffer object

Definition at line 239 of file videorender.h.

Referenced by cVideoRender(), DisplayFrame(), Exit(), Grab(), Init(), OsdClear(), OsdDrawARGB(), and SetOsdBuffer().

◆ m_pConfig

cSoftHdConfig* cVideoRender::m_pConfig
private

pointer to cSoftHdConfig

Definition at line 202 of file videorender.h.

Referenced by cVideoRender(), and SetPipSize().

◆ m_pCurrentlyDisplayed

cDrmBuffer* cVideoRender::m_pCurrentlyDisplayed = nullptr
private

pointer to currently displayed DRM buffer

Definition at line 241 of file videorender.h.

Referenced by ClearDecoderToDisplayQueue(), CommitBuffer(), DisplayBlackFrame(), DisplayFrame(), and Grab().

◆ m_pCurrentlyPipDisplayed

cDrmBuffer* cVideoRender::m_pCurrentlyPipDisplayed = nullptr
private

pointer to currently displayed DRM buffer

Definition at line 242 of file videorender.h.

Referenced by ClearPipDecoderToDisplayQueue(), CommitBuffer(), DisplayFrame(), and Grab().

◆ m_pDevice

cSoftHdDevice* cVideoRender::m_pDevice
private

pointer to cSoftHdDevice

Definition at line 200 of file videorender.h.

Referenced by cVideoRender(), DisplayFrame(), GetTrickSpeed(), LogDroppedDuped(), and SetScreenSize().

◆ m_pDisplayThread

cDisplayThread* cVideoRender::m_pDisplayThread
private

pointer to display thread

Definition at line 203 of file videorender.h.

Referenced by DisplayThreadHalt(), DisplayThreadResume(), ExitDisplayThread(), Init(), and ~cVideoRender().

◆ m_pDrmDevice

cDrmDevice* cVideoRender::m_pDrmDevice
private

◆ m_pEventReceiver

IEventReceiver* cVideoRender::m_pEventReceiver
private

pointer to event receiver

Definition at line 249 of file videorender.h.

Referenced by cVideoRender(), and ProcessEvents().

◆ m_pipActive

std::atomic<bool> cVideoRender::m_pipActive = false
private

true, if pip should be displayed

Definition at line 264 of file videorender.h.

Referenced by IsPipActive(), and SetPipActive().

◆ m_pipBufferReuseStrategy

std::atomic<cBufferStrategy *> cVideoRender::m_pipBufferReuseStrategy = nullptr
private

strategy to select drm buffers

Definition at line 253 of file videorender.h.

Referenced by PushPipFrame().

◆ m_pipDecodingStrategy

std::atomic<cDecodingStrategy *> cVideoRender::m_pipDecodingStrategy = nullptr
private

strategy for decoding setup

Definition at line 255 of file videorender.h.

Referenced by PushPipFrame().

◆ m_pipDrmBufferPool

cDrmBufferPool cVideoRender::m_pipDrmBufferPool
private

PIP pool of drm buffers.

Definition at line 251 of file videorender.h.

Referenced by ClearPipDecoderToDisplayQueue(), and PushPipFrame().

◆ m_pipDrmBufferQueue

cQueue<cDrmBuffer> cVideoRender::m_pipDrmBufferQueue {VIDEO_SURFACES_MAX}
private

queue for PIP DRM buffers to be displayed (VIDEO_SURFACES_MAX is defined in thread.h)

Definition at line 209 of file videorender.h.

Referenced by ClearPipDecoderToDisplayQueue(), DisplayFrame(), GetPipOutputBuffer(), and PushPipFrame().

◆ m_pipLeftPercent

int cVideoRender::m_pipLeftPercent
private

left margin for pip

Definition at line 235 of file videorender.h.

Referenced by SetPipBuffer(), and SetPipSize().

◆ m_pipScalePercent

int cVideoRender::m_pipScalePercent
private

scale factor for pip

Definition at line 234 of file videorender.h.

Referenced by SetPipBuffer(), and SetPipSize().

◆ m_pipTopPercent

int cVideoRender::m_pipTopPercent
private

top margin for pip

Definition at line 236 of file videorender.h.

Referenced by SetPipBuffer(), and SetPipSize().

◆ m_pts

int64_t cVideoRender::m_pts = AV_NOPTS_VALUE
private

current video PTS

Definition at line 230 of file videorender.h.

Referenced by GetOutputPtsMs(), GetVideoClock(), PushFrame(), Reset(), and SetVideoClock().

◆ m_resumeAudioScheduled

std::atomic<bool> cVideoRender::m_resumeAudioScheduled = false
private

set, if audio resume is scheduled after a pause

Definition at line 245 of file videorender.h.

Referenced by DisplayFrame(), and SetScheduleAudioResume().

◆ m_schedulePlaybackStartAtPtsMs

std::atomic<int64_t> cVideoRender::m_schedulePlaybackStartAtPtsMs = AV_NOPTS_VALUE
private

if set, frames with PTS older than this will be dropped

Definition at line 247 of file videorender.h.

Referenced by DisplayFrame(), and SchedulePlaybackStartAtPtsMs().

◆ m_startCounter

int cVideoRender::m_startCounter
private

counter for displayed frames, indicates a video start

Definition at line 224 of file videorender.h.

Referenced by cVideoRender(), DisplayFrame(), GetStats(), Reset(), and ResetFrameCounter().

◆ m_startgrab

bool cVideoRender::m_startgrab
private

internal flag to trigger grabbing

Definition at line 216 of file videorender.h.

Referenced by CommitBuffer(), cVideoRender(), DisplayFrame(), and TriggerGrab().

◆ m_timebase

AVRational cVideoRender::m_timebase
private

timebase used for pts, set by first RenderFrame()

Definition at line 228 of file videorender.h.

Referenced by cVideoRender(), DisplayFrame(), GetOutputPtsMs(), and PtsToMs().

◆ m_timebaseMutex

cMutex cVideoRender::m_timebaseMutex
private

mutex used around m_timebase

Definition at line 229 of file videorender.h.

Referenced by GetOutputPtsMs(), and PtsToMs().

◆ m_trickForward

bool cVideoRender::m_trickForward
private

true, if trickspeed plays forward

Definition at line 211 of file videorender.h.

Referenced by cVideoRender(), GetTrickForward(), and SetTrickSpeed().

◆ m_trickSpeed

int cVideoRender::m_trickSpeed
private

current trick speed

Definition at line 210 of file videorender.h.

Referenced by cVideoRender(), GetTrickSpeed(), and SetTrickSpeed().

◆ m_trickspeedMutex

cMutex cVideoRender::m_trickspeedMutex
private

mutex used while accessing trickspeed parameters

Definition at line 204 of file videorender.h.

Referenced by GetTrickForward(), GetTrickSpeed(), and SetTrickSpeed().

◆ m_videoClockMutex

cMutex cVideoRender::m_videoClockMutex
private

mutex used around m_pts

Definition at line 205 of file videorender.h.

Referenced by GetVideoClock(), and SetVideoClock().

◆ m_videoIsScaled

bool cVideoRender::m_videoIsScaled
private

true, if the currently displayed video is scaled

Definition at line 233 of file videorender.h.

Referenced by cVideoRender(), SetPipBuffer(), SetVideoBuffer(), and SetVideoOutputPosition().

◆ m_videoPlaybackPaused

std::atomic<bool> cVideoRender::m_videoPlaybackPaused = true
private

set, if playback is frozen (used for pause)

Definition at line 244 of file videorender.h.

Referenced by DisplayFrame(), and SetPlaybackPaused().

◆ m_videoRect

cRect cVideoRender::m_videoRect
private

rect of the currently displayed video

Definition at line 232 of file videorender.h.

Referenced by SetPipBuffer(), SetVideoBuffer(), and SetVideoOutputPosition().


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