| 1 |
/* |
| 2 |
* Copyright (C) 2005-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "guilib/DispResource.h" |
| 12 |
#include "threads/Event.h" |
| 13 |
#include "windowing/VideoSync.h" |
| 14 |
|
| 15 |
class CVideoSyncOsx : public CVideoSync, IDispResource |
| 16 |
{ |
| 17 |
public: |
| 18 |
CVideoSyncOsx(CVideoReferenceClock* clock) : CVideoSync(clock) {} |
| 19 |
|
| 20 |
// CVideoSync interface |
| 21 |
bool Setup() override; |
| 22 |
void Run(CEvent& stopEvent) override; |
| 23 |
void Cleanup() override; |
| 24 |
float GetFps() override; |
| 25 |
void RefreshChanged() override; |
| 26 |
|
| 27 |
// IDispResource interface |
| 28 |
void OnLostDisplay() override; |
| 29 |
void OnResetDisplay() override; |
| 30 |
|
| 31 |
// used in the displaylink callback |
| 32 |
void VblankHandler(int64_t nowtime, uint32_t timebase); |
| 33 |
|
| 34 |
private: |
| 35 |
virtual bool InitDisplayLink(); |
| 36 |
virtual void DeinitDisplayLink(); |
| 37 |
|
| 38 |
int64_t m_LastVBlankTime = |
| 39 |
0; //timestamp of the last vblank, used for calculating how many vblanks happened |
| 40 |
volatile bool m_displayLost = false; |
| 41 |
volatile bool m_displayReset = false; |
| 42 |
CEvent m_lostEvent; |
| 43 |
}; |
| 44 |
|