kodi
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CRenderManager Class Reference
Collaboration diagram for CRenderManager:
Collaboration graph
[legend]

Classes

struct  CClockSync
 
struct  SPresent
 

Public Member Functions

 CRenderManager (CDVDClock &clock, IRenderMsg *player)
 
void GetVideoRect (CRect &source, CRect &dest, CRect &view) const
 
float GetAspectRatio () const
 
unsigned int GetOrientation () const
 
void FrameMove ()
 
void FrameWait (std::chrono::milliseconds duration)
 
void Render (bool clear, DWORD flags=0, DWORD alpha=255, bool gui=true)
 
bool IsVideoLayer ()
 
RESOLUTION GetResolution ()
 
void UpdateResolution ()
 
void TriggerUpdateResolution (float fps, int width, int height, std::string &stereomode)
 
void SetViewMode (int iViewMode)
 
void PreInit ()
 
void UnInit ()
 
bool Flush (bool wait, bool saveBuffers)
 
bool IsConfigured () const
 
void ToggleDebug ()
 
void ToggleDebugVideo ()
 
void SetSubtitleVerticalPosition (const int value, bool save)
 Set the subtitle vertical position, it depends on current screen resolution. More...
 
unsigned int AllocRenderCapture ()
 
void ReleaseRenderCapture (unsigned int captureId)
 
void StartRenderCapture (unsigned int captureId, unsigned int width, unsigned int height, int flags)
 
bool RenderCaptureGetPixels (unsigned int captureId, unsigned int millis, uint8_t *buffer, unsigned int size)
 
bool Supports (ERENDERFEATURE feature) const
 
bool Supports (ESCALINGMETHOD method) const
 
int GetSkippedFrames ()
 
bool Configure (const VideoPicture &picture, float fps, unsigned int orientation, int buffers=0)
 
bool AddVideoPicture (const VideoPicture &picture, volatile std::atomic_bool &bStop, EINTERLACEMETHOD deintMethod, bool wait)
 
void AddOverlay (std::shared_ptr< CDVDOverlay > o, double pts)
 
void ShowVideo (bool enable)
 
int WaitForBuffer (volatile std::atomic_bool &bStop, std::chrono::milliseconds timeout=std::chrono::milliseconds(100))
 If player uses buffering it has to wait for a buffer before it calls AddVideoPicture and AddOverlay. More...
 
bool GetStats (int &lateframes, double &pts, int &queued, int &discard)
 Can be called by player for lateness detection. More...
 
void DiscardBuffer ()
 Video player call this on flush in oder to discard any queued frames.
 
void SetDelay (int delay)
 
int GetDelay ()
 
void SetVideoSettings (const CVideoSettings &settings)
 

Protected Types

enum  EPRESENTSTEP {
  PRESENT_IDLE = 0, PRESENT_FLIP, PRESENT_FRAME, PRESENT_FRAME2,
  PRESENT_READY
}
 
enum  EPRESENTMETHOD { PRESENT_METHOD_SINGLE = 0, PRESENT_METHOD_BLEND, PRESENT_METHOD_BOB }
 
enum  ERENDERSTATE { STATE_UNCONFIGURED = 0, STATE_CONFIGURING, STATE_CONFIGURED }
 

Protected Member Functions

void PresentSingle (bool clear, DWORD flags, DWORD alpha)
 
void PresentFields (bool clear, DWORD flags, DWORD alpha)
 
void PresentBlend (bool clear, DWORD flags, DWORD alpha)
 
void PrepareNextRender ()
 
bool IsPresenting ()
 
bool IsGuiLayer ()
 
bool Configure ()
 
void CreateRenderer ()
 
void DeleteRenderer ()
 
void ManageCaptures ()
 
void UpdateLatencyTweak ()
 
void CheckEnableClockSync ()
 
void RenderCapture (CRenderCapture *capture)
 
void RemoveCaptures ()
 

Protected Attributes

CBaseRendererm_pRenderer = nullptr
 
OVERLAY::CRenderer m_overlays
 
CDebugRenderer m_debugRenderer
 
CCriticalSection m_statelock
 
CCriticalSection m_presentlock
 
CCriticalSection m_datalock
 
bool m_bTriggerUpdateResolution = false
 
bool m_bRenderGUI = true
 
bool m_renderedOverlay = false
 
bool m_renderDebug = false
 
bool m_renderDebugVideo = false
 
XbmcThreads::EndTime m_debugTimer
 
std::atomic_bool m_showVideo = {false}
 
ERENDERSTATE m_renderState = STATE_UNCONFIGURED
 
CEvent m_stateEvent
 
double m_latencyTweak = 0.0
 Display latency tweak value from AdvancedSettings for the current refresh rate in milliseconds.
 
double m_displayLatency = 0.0
 Display latency updated in PrepareNextRender in DVD clock units, includes m_latencyTweak.
 
std::atomic_int m_videoDelay = {}
 
int m_QueueSize = 2
 
int m_QueueSkip = 0
 
struct CRenderManager::SPresent m_Queue [NUM_BUFFERS]
 
std::deque< int > m_free
 
std::deque< int > m_queued
 
std::deque< int > m_discard
 
std::unique_ptr< VideoPicturem_pConfigPicture
 
unsigned int m_width = 0
 
unsigned int m_height = 0
 
unsigned int m_dwidth = 0
 
unsigned int m_dheight = 0
 
float m_fps = 0.0
 
unsigned int m_orientation = 0
 
int m_NumberBuffers = 0
 
std::string m_stereomode
 
int m_lateframes = -1
 
double m_presentpts = 0.0
 
EPRESENTSTEP m_presentstep = PRESENT_IDLE
 
XbmcThreads::EndTime m_presentTimer
 
bool m_forceNext = false
 
int m_presentsource = 0
 
int m_presentsourcePast = -1
 
XbmcThreads::ConditionVariable m_presentevent
 
CEvent m_flushEvent
 
CEvent m_initEvent
 
CDVDClockm_dvdClock
 
IRenderMsgm_playerPort
 
CClockSync m_clockSync
 
CCriticalSection m_captCritSect
 
std::map< unsigned int, CRenderCapture * > m_captures
 
unsigned int m_captureWaitCounter = 0
 
bool m_hasCaptures = false
 

Static Protected Attributes

static unsigned int m_nextCaptureId = 0
 

Member Function Documentation

◆ GetStats()

bool CRenderManager::GetStats ( int &  lateframes,
double &  pts,
int &  queued,
int &  discard 
)

Can be called by player for lateness detection.

This is done best by looking at the end of the queue.

◆ SetSubtitleVerticalPosition()

void CRenderManager::SetSubtitleVerticalPosition ( const int  value,
bool  save 
)

Set the subtitle vertical position, it depends on current screen resolution.

Parameters
valueThe subtitle position in pixels
saveIf true, the value will be saved to resolution info

◆ WaitForBuffer()

int CRenderManager::WaitForBuffer ( volatile std::atomic_bool &  bStop,
std::chrono::milliseconds  timeout = std::chrono::milliseconds(100) 
)

If player uses buffering it has to wait for a buffer before it calls AddVideoPicture and AddOverlay.

It waits for max 50 ms before it returns -1 in case no buffer is available. Player may call this in a loop and decides by itself when it wants to drop a frame.


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